diff options
author | Per Melin <git@melin.net> | 2024-03-01 13:17:25 +0100 |
---|---|---|
committer | Per Melin <git@melin.net> | 2024-03-01 19:32:43 +0100 |
commit | 9b2d77a23826d0bfaadb13f9d9d98a3e15ea1830 (patch) | |
tree | 5ff5d2a0d78f3d6fedf49103e8462f500f5999ed | |
parent | 7d2ca2d8ac49cde9767e00b70f9eaf1920eb266d (diff) | |
download | redot-engine-9b2d77a23826d0bfaadb13f9d9d98a3e15ea1830.tar.gz |
Initialize particle trail history frame numbers
Fixes #88712
All particle trail sections were activated at once on the first cycle, instead
of being spread out over the trail's lifetime.
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/particles_storage.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp index a854e78f53..73ac875058 100644 --- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp @@ -1452,6 +1452,11 @@ void ParticlesStorage::update_particles() { if (uint32_t(history_size) != particles->frame_history.size()) { particles->frame_history.resize(history_size); memset(particles->frame_history.ptr(), 0, sizeof(ParticlesFrameParams) * history_size); + // Set the frame number so that we are able to distinguish an uninitialized + // frame from the true frame number zero. See issue #88712 for details. + for (int i = 0; i < history_size; i++) { + particles->frame_history[i].frame = UINT32_MAX; + } } if (uint32_t(trail_steps) != particles->trail_params.size() || particles->frame_params_buffer.is_null()) { |