feat: add weather-local render cadence
This commit is contained in:
@@ -49,6 +49,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
private var timelineState = "NOT READY"
|
||||
private var timelineSpeed = "1x"
|
||||
private var weatherRuntime: WeatherRuntime? = null
|
||||
private var realWeatherTargetFps = WeatherRuntime.TargetFps.AUTO
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
active = savedInstanceState?.getBoolean(STATE_ACTIVE, true) ?: true
|
||||
@@ -283,6 +284,9 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
popup.menu.add(0, 100, 0, "PARTICLE TUNING").isEnabled = false
|
||||
arrayOf("P -", "P +", "W -", "W +", "L -", "L +", "O -", "O +", "T -", "T +", "F -", "F +", "RESET DEFAULT")
|
||||
.forEachIndexed { index, label -> popup.menu.add(0, index, index, label) }
|
||||
popup.menu.add(0, 20, 20, "FPS AUTO")
|
||||
popup.menu.add(0, 21, 21, "FPS 30")
|
||||
popup.menu.add(0, 22, 22, "FPS 60")
|
||||
popup.setOnMenuItemClickListener { item -> adjustRealWeatherTuning(item.itemId); true }
|
||||
popup.setOnDismissListener { if (realWeatherTuningMenu === popup) realWeatherTuningMenu = null }
|
||||
popup.show()
|
||||
@@ -303,10 +307,21 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
10 -> setVisualFloat("raster-particle-trail-fade", (trailFade - 0.01f).coerceAtLeast(0.80f)) { trailFade = it }
|
||||
11 -> setVisualFloat("raster-particle-trail-fade", (trailFade + 0.01f).coerceAtMost(0.99f)) { trailFade = it }
|
||||
12 -> resetRealWeatherDefaults()
|
||||
20 -> setRealWeatherTargetFps(WeatherRuntime.TargetFps.AUTO)
|
||||
21 -> setRealWeatherTargetFps(WeatherRuntime.TargetFps.FPS_30)
|
||||
22 -> setRealWeatherTargetFps(WeatherRuntime.TargetFps.FPS_60)
|
||||
}
|
||||
Log.i(TAG, "ParticleTuning: event=APPLY realWeather=true action=$action values=${realWeatherHudValues()}")
|
||||
}
|
||||
|
||||
private fun setRealWeatherTargetFps(target: WeatherRuntime.TargetFps) {
|
||||
if (weatherRuntime?.setTargetFps(target) == WeatherRuntime.CommandResult.ACCEPTED) {
|
||||
realWeatherTargetFps = target
|
||||
status.text = statusText()
|
||||
Log.i(TAG, "WeatherCadence: event=TARGET_FPS_CHANGED target=${target.name}")
|
||||
}
|
||||
}
|
||||
|
||||
private fun nextRealWeatherCount(direction: Int): Int {
|
||||
val index = REAL_WEATHER_PARTICLE_COUNTS.indexOf(particleCount).let { if (it < 0) 3 else it }
|
||||
return REAL_WEATHER_PARTICLE_COUNTS[(index + direction).coerceIn(0, REAL_WEATHER_PARTICLE_COUNTS.lastIndex)]
|
||||
@@ -433,6 +448,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
styleReady = true
|
||||
if (realWeatherMode) {
|
||||
weatherRuntime = WeatherRuntime(maplibreMap, WeatherRuntime.Config(PARTICLE_SOURCE_ID, WEATHER_COLOR_LAYER_ID, PARTICLE_LAYER_ID))
|
||||
weatherRuntime?.setTargetFps(realWeatherTargetFps)
|
||||
} else {
|
||||
weatherRuntime = null
|
||||
}
|
||||
@@ -706,7 +722,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
return if (realWeatherMode) "$summary\n${realWeatherHudValues()}" else "$summary · $particleCount · W ${"%.1f".format(lineWidth)} L ${"%.3f".format(particleLength)} O ${(particleOpacity * 100).toInt()} T ${(trailOpacity * 100).toInt()} F ${(trailFade * 100).toInt()} C ${if (speedColorEnabled) "ON" else "OFF"}"
|
||||
}
|
||||
|
||||
private fun realWeatherHudValues(): String = "P $particleCount · W ${"%.2f".format(lineWidth)} · L ${"%.4f".format(particleLength)} · O ${"%.2f".format(particleOpacity)} · T ${"%.2f".format(trailOpacity)} · F ${"%.2f".format(trailFade)}"
|
||||
private fun realWeatherHudValues(): String = "FPS ${realWeatherTargetFps.name.removePrefix("FPS_")} · P $particleCount · W ${"%.2f".format(lineWidth)} · L ${"%.4f".format(particleLength)} · O ${"%.2f".format(particleOpacity)} · T ${"%.2f".format(trailOpacity)} · F ${"%.2f".format(trailFade)}"
|
||||
|
||||
private fun validationStyle(active: Boolean, enabled: Boolean, reason: String): String {
|
||||
val fixtureId = fixtureId()
|
||||
|
||||
Reference in New Issue
Block a user