summaryrefslogtreecommitdiffstats
path: root/servers/rendering/renderer_rd/storage_rd
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2023-02-14 14:37:47 -0800
committerclayjohn <claynjohn@gmail.com>2023-02-14 14:37:47 -0800
commitf35ca4a9c735e49d496c4e733e7dc9a072841f92 (patch)
tree3feaf292315068218f338e06a82af8479e81beea /servers/rendering/renderer_rd/storage_rd
parent8c7b98d4526c6ba66d7f1636abb71ccbe54727c6 (diff)
downloadredot-engine-f35ca4a9c735e49d496c4e733e7dc9a072841f92.tar.gz
Properly calculate lifetime_split for particles
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd')
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index 00fb8acca8..c2fe3b96b9 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -1193,7 +1193,7 @@ void ParticlesStorage::particles_set_view_axis(RID p_particles, const Vector3 &p
}
copy_push_constant.order_by_lifetime = (particles->draw_order == RS::PARTICLES_DRAW_ORDER_LIFETIME || particles->draw_order == RS::PARTICLES_DRAW_ORDER_REVERSE_LIFETIME);
- copy_push_constant.lifetime_split = MIN(particles->amount * particles->phase, particles->amount - 1);
+ copy_push_constant.lifetime_split = (MIN(int(particles->amount * particles->phase), particles->amount - 1) + 1) % particles->amount;
copy_push_constant.lifetime_reverse = particles->draw_order == RS::PARTICLES_DRAW_ORDER_REVERSE_LIFETIME;
copy_push_constant.frame_remainder = particles->interpolate ? particles->frame_remainder : 0.0;
@@ -1511,7 +1511,7 @@ void ParticlesStorage::update_particles() {
}
copy_push_constant.order_by_lifetime = (particles->draw_order == RS::PARTICLES_DRAW_ORDER_LIFETIME || particles->draw_order == RS::PARTICLES_DRAW_ORDER_REVERSE_LIFETIME);
- copy_push_constant.lifetime_split = MIN(particles->amount * particles->phase, particles->amount - 1);
+ copy_push_constant.lifetime_split = (MIN(int(particles->amount * particles->phase), particles->amount - 1) + 1) % particles->amount;
copy_push_constant.lifetime_reverse = particles->draw_order == RS::PARTICLES_DRAW_ORDER_REVERSE_LIFETIME;
RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();