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

@@ -995,8 +995,9 @@ void RenderRasterParticleLayer::evaluate(const PropertyEvaluationParameters&) {
bool RenderRasterParticleLayer::needsRepaint() const {
const auto& properties = static_cast<const style::ParticleRenderLayerProperties&>(*evaluatedProperties);
return properties.active && (!formalSource || (sourceField && sourceNextField)) &&
baseImpl->visibility != style::VisibilityType::None;
if (!properties.active || (formalSource && (!sourceField || !sourceNextField)) ||
baseImpl->visibility == style::VisibilityType::None) return false;
return !formalSource || !sourceTimeline || sourceTimeline->cadenceDue(std::chrono::steady_clock::now());
}
bool RenderRasterParticleLayer::needsHiddenLayerSourceCleanup(const RenderSource& renderSource) const {
@@ -1738,6 +1739,20 @@ void RenderRasterParticleLayer::update(gfx::ShaderRegistry& shaders,
return;
}
// Camera-driven frames may recompose existing weather drawables, but do
// not advance the shared timeline, State, or Trail before the deadline.
if (formalSource && sourceTimeline && !sourceTimeline->cadenceDue(std::chrono::steady_clock::now())) {
auto& compositeGroup = static_cast<LayerGroup&>(*layerGroup);
compositeGroup.clearDrawables();
const auto center = transformState.getLatLng(LatLng::Unwrapped);
const auto centerWrap = wrapForLongitude(center.longitude());
const auto wrap = static_cast<int16_t>(centerWrap);
buildQuad(context, resources, compositeGroup, getID() + "-composite-pass-" + std::to_string(wrap),
resources->trailTargets[resources->trailRead]->getTexture(), {}, resources->maskTexture, {}, 0.0f,
ValidationPass::Composite, resources->trailRead, resources->trailRead, wrap, maskMode, false);
return;
}
const auto stateWrite = resources->stateWrite();
const auto trailWrite = resources->trailWrite();
auto& stateGroup = static_cast<LayerGroup&>(*resources->stateTargets[stateWrite]->getLayerGroup(0));