feat: add weather-local render cadence

This commit is contained in:
OpenAI Codex
2026-09-07 14:55:32 +08:00
parent 6d514e3aae
commit b9b3dd2253
13 changed files with 224 additions and 8 deletions

View File

@@ -41,6 +41,8 @@ enum class RasterArrayPlaybackState : uint8_t {
Ended
};
enum class RasterArrayTargetFps : uint8_t { Auto = 0, Fps30 = 30, Fps60 = 60 };
struct RasterArrayTimelineFrame {
std::shared_ptr<const particle::ParticleFieldSnapshot> t0;
std::shared_ptr<const particle::ParticleFieldSnapshot> t1;
@@ -72,6 +74,10 @@ public:
bool injectGap();
bool injectInvalid();
bool recover();
bool setTargetFps(RasterArrayTargetFps);
RasterArrayTargetFps targetFps() const;
bool cadenceDue(std::chrono::steady_clock::time_point) const;
void markCadenceTick(std::chrono::steady_clock::time_point);
RasterArrayTimelineFrame frame() const;
float playbackSpeed() const;
size_t size() const;
@@ -92,6 +98,10 @@ private:
RasterArrayPlaybackState stateBeforeWait = RasterArrayPlaybackState::Paused;
uint64_t windowRevision = 1;
std::chrono::steady_clock::time_point lastTick{};
std::chrono::steady_clock::time_point lastCadenceTick{};
std::chrono::steady_clock::time_point lastCadenceLog{};
uint64_t cadenceTickCount = 0;
RasterArrayTargetFps targetFps_ = RasterArrayTargetFps::Auto;
const size_t cacheCapacity_ = 8;
};
@@ -162,6 +172,8 @@ public:
bool seekRuntimeTimelineToTimestamp(uint64_t timestamp);
// Low-frequency JNI commands for the Source-owned validation timeline.
bool controlRuntimeTimeline(int command, float value = 0.0f);
bool setRuntimeTargetFps(uint8_t targetFps);
uint8_t runtimeTargetFps() const;
bool supportsLayerType(const LayerTypeInfo*) const override;
mapbox::base::WeakPtr<Source> makeWeakPtr() override { return weakFactory.makeWeakPtr(); }
@@ -207,6 +219,7 @@ private:
size_t nextRuntimeField = 0;
uint64_t runtimeUpdateSequence = 0;
std::shared_ptr<RasterArrayTimelineRuntime> timeline;
RasterArrayTargetFps targetFps = RasterArrayTargetFps::Auto;
mapbox::base::WeakPtrFactory<Source> weakFactory{this};
};