Do not draw particles if they are not processing at all, fixes #19507
This commit is contained in:
parent
55ded6b2de
commit
d304228003
@ -681,6 +681,8 @@ public:
|
||||
int particles_get_draw_passes(RID p_particles) const { return 0; }
|
||||
RID particles_get_draw_pass_mesh(RID p_particles, int p_pass) const { return RID(); }
|
||||
|
||||
virtual bool particles_is_inactive(RID p_particles) const { return false; }
|
||||
|
||||
/* RENDER TARGET */
|
||||
|
||||
RID render_target_create() { return RID(); }
|
||||
|
@ -3842,6 +3842,10 @@ RID RasterizerStorageGLES2::particles_get_draw_pass_mesh(RID p_particles, int p_
|
||||
void RasterizerStorageGLES2::update_particles() {
|
||||
}
|
||||
|
||||
bool RasterizerStorageGLES2::particles_is_inactive(RID p_particles) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
////////
|
||||
|
||||
void RasterizerStorageGLES2::instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {
|
||||
|
@ -1090,6 +1090,8 @@ public:
|
||||
virtual int particles_get_draw_passes(RID p_particles) const;
|
||||
virtual RID particles_get_draw_pass_mesh(RID p_particles, int p_pass) const;
|
||||
|
||||
virtual bool particles_is_inactive(RID p_particles) const;
|
||||
|
||||
/* INSTANCE */
|
||||
|
||||
virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance);
|
||||
|
@ -6455,6 +6455,13 @@ void RasterizerStorageGLES3::update_particles() {
|
||||
glDisable(GL_RASTERIZER_DISCARD);
|
||||
}
|
||||
|
||||
bool RasterizerStorageGLES3::particles_is_inactive(RID p_particles) const {
|
||||
|
||||
const Particles *particles = particles_owner.getornull(p_particles);
|
||||
ERR_FAIL_COND_V(!particles, false);
|
||||
return !particles->emitting && particles->inactive;
|
||||
}
|
||||
|
||||
////////
|
||||
|
||||
void RasterizerStorageGLES3::instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {
|
||||
|
@ -1261,6 +1261,8 @@ public:
|
||||
virtual int particles_get_draw_passes(RID p_particles) const;
|
||||
virtual RID particles_get_draw_pass_mesh(RID p_particles, int p_pass) const;
|
||||
|
||||
virtual bool particles_is_inactive(RID p_particles) const;
|
||||
|
||||
/* INSTANCE */
|
||||
|
||||
virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance);
|
||||
|
@ -518,6 +518,8 @@ public:
|
||||
virtual void particles_set_fractional_delta(RID p_particles, bool p_enable) = 0;
|
||||
virtual void particles_restart(RID p_particles) = 0;
|
||||
|
||||
virtual bool particles_is_inactive(RID p_particles) const = 0;
|
||||
|
||||
virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) = 0;
|
||||
|
||||
virtual void particles_set_draw_passes(RID p_particles, int p_count) = 0;
|
||||
|
@ -1912,9 +1912,14 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
|
||||
|
||||
if (ins->base_type == VS::INSTANCE_PARTICLES) {
|
||||
//particles visible? process them
|
||||
VSG::storage->particles_request_process(ins->base);
|
||||
//particles visible? request redraw
|
||||
VisualServerRaster::redraw_request();
|
||||
if (VSG::storage->particles_is_inactive(ins->base)) {
|
||||
//but if nothing is going on, don't do it.
|
||||
keep = false;
|
||||
} else {
|
||||
VSG::storage->particles_request_process(ins->base);
|
||||
//particles visible? request redraw
|
||||
VisualServerRaster::redraw_request();
|
||||
}
|
||||
}
|
||||
|
||||
if (geom->lighting_dirty) {
|
||||
|
Loading…
Reference in New Issue
Block a user