mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 04:15:14 -04:00
calculate cloud speed from time
Now their speed is not frame rate specific anymore
This commit is contained in:
parent
251c257bed
commit
e2f90cb625
@ -126,7 +126,7 @@ class CloudLayer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getCloudSpeed(): Float {
|
private fun getCloudSpeed(): Float {
|
||||||
return randomSpeed + 0.05f
|
return randomSpeed + 0.1f
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateOffset() {
|
private fun updateOffset() {
|
||||||
@ -134,7 +134,7 @@ class CloudLayer(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var offset = this.offset
|
var offset = this.offset
|
||||||
offset += getCloudSpeed()
|
offset += getCloudSpeed() * clouds.delta * 10
|
||||||
if (offset > MAX_OFFSET) {
|
if (offset > MAX_OFFSET) {
|
||||||
offset -= MAX_OFFSET
|
offset -= MAX_OFFSET
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import de.bixilon.kotlinglm.vec3.Vec3
|
|||||||
import de.bixilon.kotlinglm.vec4.Vec4
|
import de.bixilon.kotlinglm.vec4.Vec4
|
||||||
import de.bixilon.kutil.latch.CountUpAndDownLatch
|
import de.bixilon.kutil.latch.CountUpAndDownLatch
|
||||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||||
|
import de.bixilon.kutil.time.TimeUtil.millis
|
||||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
import de.bixilon.minosoft.data.world.time.DayPhases
|
import de.bixilon.minosoft.data.world.time.DayPhases
|
||||||
import de.bixilon.minosoft.data.world.time.MoonPhases
|
import de.bixilon.minosoft.data.world.time.MoonPhases
|
||||||
@ -59,6 +60,10 @@ class CloudRenderer(
|
|||||||
private set
|
private set
|
||||||
private var toUnload: MutableSet<CloudLayer> = mutableSetOf()
|
private var toUnload: MutableSet<CloudLayer> = mutableSetOf()
|
||||||
|
|
||||||
|
private var time = millis()
|
||||||
|
var delta = 0.0f
|
||||||
|
private set
|
||||||
|
|
||||||
override val skipOpaque: Boolean
|
override val skipOpaque: Boolean
|
||||||
get() = !sky.effects.clouds || !sky.profile.clouds.enabled || connection.profiles.block.viewDistance < 3 || layers.isEmpty()
|
get() = !sky.effects.clouds || !sky.profile.clouds.enabled || connection.profiles.block.viewDistance < 3 || layers.isEmpty()
|
||||||
|
|
||||||
@ -113,6 +118,12 @@ class CloudRenderer(
|
|||||||
if (layers.size != nextLayers) {
|
if (layers.size != nextLayers) {
|
||||||
updateLayers(nextLayers)
|
updateLayers(nextLayers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val time = millis()
|
||||||
|
val delta = time - this.time
|
||||||
|
this.delta = delta / 1000.0f
|
||||||
|
this.time = time
|
||||||
|
|
||||||
for (layer in layers) {
|
for (layer in layers) {
|
||||||
layer.prepareAsync()
|
layer.prepareAsync()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user