more conveyor aesthetics

This commit is contained in:
minjaesong
2025-03-22 23:29:23 +09:00
parent 5c2d201151
commit 7188fddc7e
7 changed files with 38 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
"identifier": "clear01", "identifier": "clear01",
"skyboxGradColourMap": "model:hosek", "skyboxGradColourMap": "model:hosek",
"daylightClut": "lut:clut_daylight.tga", "daylightClut": "lut:clut_daylight.tga",
"tags": "generic,clear", "tags": "terrestrial,generic,clear",
"cloudChance": 12, "cloudChance": 12,
"cloudGamma": [1.2, 2.4], "cloudGamma": [1.2, 2.4],
"cloudGammaVariance": [0.111, 0.0], "cloudGammaVariance": [0.111, 0.0],

View File

@@ -2,7 +2,7 @@
"identifier": "generic01", "identifier": "generic01",
"skyboxGradColourMap": "model:hosek", "skyboxGradColourMap": "model:hosek",
"daylightClut": "lut:clut_daylight.tga", "daylightClut": "lut:clut_daylight.tga",
"tags": "generic", "tags": "terrestrial,generic",
"cloudChance": 60, "cloudChance": 60,
"cloudGamma": [0.9, 2.4], "cloudGamma": [0.9, 2.4],
"cloudGammaVariance": [0.111, 0.0], "cloudGammaVariance": [0.111, 0.0],

View File

@@ -2,7 +2,7 @@
"identifier": "generic02", "identifier": "generic02",
"skyboxGradColourMap": "model:hosek", "skyboxGradColourMap": "model:hosek",
"daylightClut": "lut:clut_daylight.tga", "daylightClut": "lut:clut_daylight.tga",
"tags": "generic2", "tags": "terrestrial,generic",
"cloudChance": 150, "cloudChance": 150,
"cloudGamma": [0.9, 2.4], "cloudGamma": [0.9, 2.4],
"cloudGammaVariance": [0.111, 0.0], "cloudGammaVariance": [0.111, 0.0],

View File

@@ -2,7 +2,7 @@
"identifier": "overcast01", "identifier": "overcast01",
"skyboxGradColourMap": "model:hosek", "skyboxGradColourMap": "model:hosek",
"daylightClut": "lut:clut_daylight.tga", "daylightClut": "lut:clut_daylight.tga",
"tags": "overcast", "tags": "terrestrial,overcast",
"cloudChance": 200, "cloudChance": 200,
"cloudGamma": [1.45, 1.0], "cloudGamma": [1.45, 1.0],
"cloudGammaVariance": [0.0, 0.0], "cloudGammaVariance": [0.0, 0.0],

View File

@@ -1,7 +1,7 @@
{ {
"identifier": "space", "identifier": "space",
"skyboxGradColourMap": "static:#020202,#060604", "skyboxGradColourMap": "static:#020202,#060604",
"daylightClut": "static:#FFFFFF", "daylightClut": "static:#FFF7",
"tags": "space", "tags": "space",
"cloudChance": 0, "cloudChance": 0,
"cloudGamma": [1.0, 1.0], "cloudGamma": [1.0, 1.0],

View File

@@ -137,10 +137,18 @@ class ActorConveyors : ActorWithBody {
override fun updateImpl(delta: Float) { override fun updateImpl(delta: Float) {
super.updateImpl(delta) super.updateImpl(delta)
turn += delta * 2 // turn += delta * 2
while (turn >= 1f) turn -= 1f // while (turn >= 1.0) turn -= 1.0
turn = 0.0
} }
@Transient var smu = 0
override var tooltipText: String?
get() = "segmentsUsed=$smu"
set(value) {}
override fun drawBody(frameDelta: Float, batch: SpriteBatch) { override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
batch.end() batch.end()
@@ -160,14 +168,14 @@ class ActorConveyors : ActorWithBody {
// draw belt stripes under // draw belt stripes under
it.color = COL_BELT_ALT it.color = COL_BELT_ALT
val segmentLen = s / c val segmentLen = s / c
val topSegRemainder = l % segmentLen var segmentsUsed = 0
for (i in 0 until c / 2) { // not exact code but whatever for (i in 0 until c / 2) { // not exact code but whatever
val x1 = btx1 + r * sin(di - HALF_PI) * (i - turn + 0.00) * segmentLen val x1 = btx1 + r * sin(di - HALF_PI) * (i - turn + 0.00) * segmentLen
val y1 = bty1 + r * cos(di - HALF_PI) * (i - turn + 0.00) * segmentLen val y1 = bty1 + r * cos(di - HALF_PI) * (i - turn + 0.00) * segmentLen
val x2 = btx1 + r * sin(di - HALF_PI) * (i - turn + 0.25) * segmentLen val x2 = btx1 + r * sin(di - HALF_PI) * (i - turn + 0.25) * segmentLen
val y2 = bty1 + r * cos(di - HALF_PI) * (i - turn + 0.25) * segmentLen val y2 = bty1 + r * cos(di - HALF_PI) * (i - turn + 0.25) * segmentLen
if (x1 in btx1 - 4..btx2 + 4) { if (x1 in btx1..btx2) {
if (bty2 > bty1) if (bty2 > bty1)
drawLineOnWorld( drawLineOnWorld(
x1.coerceIn(btx1..btx2), x1.coerceIn(btx1..btx2),
@@ -184,27 +192,29 @@ class ActorConveyors : ActorWithBody {
y2.coerceIn(bty2..bty1), y2.coerceIn(bty2..bty1),
2f 2f
) )
segmentsUsed++
} }
} }
smu = segmentsUsed
// stripes at the left spindle // stripes at the right spindle
// eq: k units/s on straight part == (k / r) rad/s on curve // eq: k units/s on straight part == (k / r) rad/s on curve
val k = topSegRemainder + turn // TODO calculate starting angle offset val k = segmentsUsed * segmentLen - l - turn * segmentLen
val angularOffsetStart = di + k val angularOffsetStart = di + k / r // use di as a starting point, then add some value to offset it cw
val segmentCount = r / segmentLen val segmentCount = 2//r / segmentLen
for (i in 0 until segmentCount.toInt()) { for (i in 0 until segmentCount.toInt()) {
val a1 = angularOffsetStart + segmentLen * i val a1 = angularOffsetStart + segmentLen * i
it.color = listOf(Color.LIME, Color.CORAL, Color.CYAN)[i]
drawArcOnWorld(cx1, cy1, r, a1, segmentLen * 0.25, 2f) drawArcOnWorld(cx2, cy2, r, -a1, -segmentLen * 0.25, 2f)
} }
// bottom straight part // bottom straight part
val bottomSectionOffset = (l + Math.PI * r) % segmentLen it.color = COL_BELT_ALT
/*val bottomSectionOffset = (l + Math.PI * r) % segmentLen
for (i in 0 until c / 2) { // not exact code but whatever for (i in 0 until c / 2) { // not exact code but whatever
val x1 = bbx1 + bottomSectionOffset + r * sin(di - HALF_PI) * (i + turn - 0.00) * segmentLen val x1 = bbx1 + bottomSectionOffset + r * sin(di - HALF_PI) * (i + turn - 0.00) * segmentLen
val y1 = bby1 + bottomSectionOffset + r * cos(di - HALF_PI) * (i + turn - 0.00) * segmentLen val y1 = bby1 + bottomSectionOffset + r * cos(di - HALF_PI) * (i + turn - 0.00) * segmentLen - 1
val x2 = bbx1 + bottomSectionOffset + r * sin(di - HALF_PI) * (i + turn - 0.25) * segmentLen val x2 = bbx1 + bottomSectionOffset + r * sin(di - HALF_PI) * (i + turn - 0.25) * segmentLen
val y2 = bby1 + bottomSectionOffset + r * cos(di - HALF_PI) * (i + turn - 0.25) * segmentLen val y2 = bby1 + bottomSectionOffset + r * cos(di - HALF_PI) * (i + turn - 0.25) * segmentLen - 1
if (x1 in bbx1 - 4..bbx2 + 4) { if (x1 in bbx1 - 4..bbx2 + 4) {
if (bby2 > bby1) if (bby2 > bby1)
@@ -224,15 +234,15 @@ class ActorConveyors : ActorWithBody {
2f 2f
) )
} }
} }*/
it.color = COL_BELT_TOP it.color = COL_BELT_TOP
// belt top // belt top
drawLineOnWorld(btx1, bty1 - 0.5f, btx2, bty2 - 0.5f, 1f) // drawLineOnWorld(btx1, bty1 - 0.5f, btx2, bty2 - 0.5f, 1f)
// belt bottom // belt bottom
drawLineOnWorld(bbx1, bby1 - 0.5f, bbx2, bby2 - 0.5f, 1f) // drawLineOnWorld(bbx1, bby1 - 0.5f, bbx2, bby2 - 0.5f, 1f)
} }
batch.begin() batch.begin()
@@ -248,10 +258,9 @@ class ActorConveyors : ActorWithBody {
private fun drawArcOnWorld(xc: Double, yc: Double, r: Double, arcStart: Double, arcDeg: Double, width: Float) { private fun drawArcOnWorld(xc: Double, yc: Double, r: Double, arcStart: Double, arcDeg: Double, width: Float) {
// dissect the circle // dissect the circle
val pathLen = (arcDeg * r).absoluteValue val pathLen = (arcDeg * r).absoluteValue * 2
//// estimated number of segments. pathLen divided by sqrt(2) //// estimated number of segments. pathLen divided by sqrt(2)
val segments = Math.round(pathLen).coerceAtLeast(1L).toInt() val segments = (4 * Math.cbrt(r) * arcDeg.absoluteValue).toInt().coerceAtLeast(1)
// val segments = 12 * 8
for (i in 0 until segments) { for (i in 0 until segments) {
val degStart = (i.toDouble() / segments) * arcDeg + arcStart val degStart = (i.toDouble() / segments) * arcDeg + arcStart

View File

@@ -65,7 +65,10 @@ class Weatherbox {
private fun pickNextWeather(): WeatherSchedule { private fun pickNextWeather(): WeatherSchedule {
// temporary setup for the release // temporary setup for the release
val newWeather = WeatherCodex.getRandom() var newWeather = WeatherCodex.getRandom()
while (!newWeather.tags.contains("terrestrial")) {
newWeather = WeatherCodex.getRandom()
}
val newDuration = takeTriangularRand(3600f..10800f).roundToLong() val newDuration = takeTriangularRand(3600f..10800f).roundToLong()
return WeatherSchedule(newWeather, newDuration) return WeatherSchedule(newWeather, newDuration)
} }