fix: finalize GPU particle time interpolation
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -24,6 +24,8 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
private var fixtureMode = FIXTURE_UNIFORM_EAST
|
||||
private var timeMix = 0.0f
|
||||
private var timeWindowMode = false
|
||||
private var styleLoadEpoch = 0L
|
||||
private var styleReady = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
active = savedInstanceState?.getBoolean(STATE_ACTIVE, true) ?: true
|
||||
@@ -110,12 +112,15 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadValidationStyle(active: Boolean, enabled: Boolean) {
|
||||
private fun loadValidationStyle(active: Boolean, enabled: Boolean, reason: String = "STYLE_CHANGE") {
|
||||
this.active = active
|
||||
this.enabled = enabled
|
||||
val state = statusText()
|
||||
Log.i(TAG, "ParticleValidation30_03: Test App switching to $state")
|
||||
styleReady = false
|
||||
styleLoadEpoch += 1
|
||||
Log.i(TAG, "ParticleGPU: event=STYLE_LOAD epoch=$styleLoadEpoch reason=$reason")
|
||||
maplibreMap.setStyle(Style.Builder().fromJson(validationStyle(active, enabled))) {
|
||||
styleReady = true
|
||||
status.text = state
|
||||
}
|
||||
}
|
||||
@@ -140,15 +145,20 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
private fun setTimeMix(value: Float) {
|
||||
timeMix = value.coerceIn(0.0f, 1.0f)
|
||||
val layer = maplibreMap.style?.getLayer(PARTICLE_LAYER_ID)
|
||||
if (layer == null || !enabled || !timeWindowMode) {
|
||||
timeWindowMode = true
|
||||
fixtureMode = FIXTURE_UNIFORM_EAST
|
||||
loadValidationStyle(active, enabled)
|
||||
val rejectReason = when {
|
||||
!styleReady -> "STYLE_LOADING"
|
||||
layer == null -> "LAYER_NOT_READY"
|
||||
!enabled -> "DISABLED"
|
||||
!timeWindowMode -> "TIME_WINDOW_OFF"
|
||||
else -> null
|
||||
}
|
||||
if (rejectReason != null) {
|
||||
Log.i(TAG, "ParticleGPU: event=MIX_REJECTED reason=$rejectReason styleEpoch=$styleLoadEpoch")
|
||||
return
|
||||
}
|
||||
layer.setProperties(PaintPropertyValue("raster-particle-time-mix", timeMix))
|
||||
status.text = statusText()
|
||||
Log.i(TAG, "ParticleGPU: test timeMix=$timeMix; expect no Field upload or simulation rebuild")
|
||||
Log.i(TAG, "ParticleGPU: event=MIX_PROPERTY_ONLY value=$timeMix styleEpoch=$styleLoadEpoch")
|
||||
}
|
||||
|
||||
private fun statusText(): String {
|
||||
|
||||
Reference in New Issue
Block a user