mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
more conveyor aesthetics
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"identifier": "clear01",
|
||||
"skyboxGradColourMap": "model:hosek",
|
||||
"daylightClut": "lut:clut_daylight.tga",
|
||||
"tags": "generic,clear",
|
||||
"tags": "terrestrial,generic,clear",
|
||||
"cloudChance": 12,
|
||||
"cloudGamma": [1.2, 2.4],
|
||||
"cloudGammaVariance": [0.111, 0.0],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"identifier": "generic01",
|
||||
"skyboxGradColourMap": "model:hosek",
|
||||
"daylightClut": "lut:clut_daylight.tga",
|
||||
"tags": "generic",
|
||||
"tags": "terrestrial,generic",
|
||||
"cloudChance": 60,
|
||||
"cloudGamma": [0.9, 2.4],
|
||||
"cloudGammaVariance": [0.111, 0.0],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"identifier": "generic02",
|
||||
"skyboxGradColourMap": "model:hosek",
|
||||
"daylightClut": "lut:clut_daylight.tga",
|
||||
"tags": "generic2",
|
||||
"tags": "terrestrial,generic",
|
||||
"cloudChance": 150,
|
||||
"cloudGamma": [0.9, 2.4],
|
||||
"cloudGammaVariance": [0.111, 0.0],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"identifier": "overcast01",
|
||||
"skyboxGradColourMap": "model:hosek",
|
||||
"daylightClut": "lut:clut_daylight.tga",
|
||||
"tags": "overcast",
|
||||
"tags": "terrestrial,overcast",
|
||||
"cloudChance": 200,
|
||||
"cloudGamma": [1.45, 1.0],
|
||||
"cloudGammaVariance": [0.0, 0.0],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"identifier": "space",
|
||||
"skyboxGradColourMap": "static:#020202,#060604",
|
||||
"daylightClut": "static:#FFFFFF",
|
||||
"daylightClut": "static:#FFF7",
|
||||
"tags": "space",
|
||||
"cloudChance": 0,
|
||||
"cloudGamma": [1.0, 1.0],
|
||||
|
||||
@@ -137,10 +137,18 @@ class ActorConveyors : ActorWithBody {
|
||||
override fun updateImpl(delta: Float) {
|
||||
super.updateImpl(delta)
|
||||
|
||||
turn += delta * 2
|
||||
while (turn >= 1f) turn -= 1f
|
||||
// turn += delta * 2
|
||||
// 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) {
|
||||
batch.end()
|
||||
|
||||
@@ -160,14 +168,14 @@ class ActorConveyors : ActorWithBody {
|
||||
// draw belt stripes under
|
||||
it.color = COL_BELT_ALT
|
||||
val segmentLen = s / c
|
||||
val topSegRemainder = l % segmentLen
|
||||
var segmentsUsed = 0
|
||||
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 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 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)
|
||||
drawLineOnWorld(
|
||||
x1.coerceIn(btx1..btx2),
|
||||
@@ -184,27 +192,29 @@ class ActorConveyors : ActorWithBody {
|
||||
y2.coerceIn(bty2..bty1),
|
||||
2f
|
||||
)
|
||||
segmentsUsed++
|
||||
}
|
||||
}
|
||||
|
||||
// stripes at the left spindle
|
||||
smu = segmentsUsed
|
||||
// stripes at the right spindle
|
||||
// eq: k units/s on straight part == (k / r) rad/s on curve
|
||||
val k = topSegRemainder + turn // TODO calculate starting angle offset
|
||||
val angularOffsetStart = di + k
|
||||
val segmentCount = r / segmentLen
|
||||
val k = segmentsUsed * segmentLen - l - turn * segmentLen
|
||||
val angularOffsetStart = di + k / r // use di as a starting point, then add some value to offset it cw
|
||||
val segmentCount = 2//r / segmentLen
|
||||
for (i in 0 until segmentCount.toInt()) {
|
||||
val a1 = angularOffsetStart + segmentLen * i
|
||||
|
||||
drawArcOnWorld(cx1, cy1, r, a1, segmentLen * 0.25, 2f)
|
||||
it.color = listOf(Color.LIME, Color.CORAL, Color.CYAN)[i]
|
||||
drawArcOnWorld(cx2, cy2, r, -a1, -segmentLen * 0.25, 2f)
|
||||
}
|
||||
|
||||
// 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
|
||||
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 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 (bby2 > bby1)
|
||||
@@ -224,15 +234,15 @@ class ActorConveyors : ActorWithBody {
|
||||
2f
|
||||
)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
it.color = COL_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
|
||||
drawLineOnWorld(bbx1, bby1 - 0.5f, bbx2, bby2 - 0.5f, 1f)
|
||||
// drawLineOnWorld(bbx1, bby1 - 0.5f, bbx2, bby2 - 0.5f, 1f)
|
||||
}
|
||||
|
||||
batch.begin()
|
||||
@@ -248,10 +258,9 @@ class ActorConveyors : ActorWithBody {
|
||||
|
||||
private fun drawArcOnWorld(xc: Double, yc: Double, r: Double, arcStart: Double, arcDeg: Double, width: Float) {
|
||||
// dissect the circle
|
||||
val pathLen = (arcDeg * r).absoluteValue
|
||||
val pathLen = (arcDeg * r).absoluteValue * 2
|
||||
//// estimated number of segments. pathLen divided by sqrt(2)
|
||||
val segments = Math.round(pathLen).coerceAtLeast(1L).toInt()
|
||||
// val segments = 12 * 8
|
||||
val segments = (4 * Math.cbrt(r) * arcDeg.absoluteValue).toInt().coerceAtLeast(1)
|
||||
|
||||
for (i in 0 until segments) {
|
||||
val degStart = (i.toDouble() / segments) * arcDeg + arcStart
|
||||
|
||||
@@ -65,7 +65,10 @@ class Weatherbox {
|
||||
|
||||
private fun pickNextWeather(): WeatherSchedule {
|
||||
// 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()
|
||||
return WeatherSchedule(newWeather, newDuration)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user