From 39f37d0567089bd3f9614a127697e93d779bedb3 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 13 Jul 2006 17:34:10 +0000 Subject: [PATCH] fix particles --- .../particlesystem/lineParticleRenderer.cxx | 2 +- .../particlesystem/pointParticleRenderer.cxx | 2 +- .../sparkleParticleRenderer.cxx | 2 +- .../particlesystem/spriteParticleRenderer.cxx | 2 +- panda/src/pgraph/pandaNode.cxx | 44 ++++++++++--------- panda/src/pgraph/pandaNode.h | 2 +- 6 files changed, 29 insertions(+), 25 deletions(-) diff --git a/panda/src/particlesystem/lineParticleRenderer.cxx b/panda/src/particlesystem/lineParticleRenderer.cxx index 811e13f8a9..9fddbedb1d 100644 --- a/panda/src/particlesystem/lineParticleRenderer.cxx +++ b/panda/src/particlesystem/lineParticleRenderer.cxx @@ -247,7 +247,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { BoundingSphere sphere(aabb_center, radius); _line_primitive->set_bounds(&sphere); - get_render_node()->mark_bounds_stale(); + get_render_node()->mark_internal_bounds_stale(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/pointParticleRenderer.cxx b/panda/src/particlesystem/pointParticleRenderer.cxx index 56313fde15..efeb7a5fb0 100644 --- a/panda/src/particlesystem/pointParticleRenderer.cxx +++ b/panda/src/particlesystem/pointParticleRenderer.cxx @@ -286,7 +286,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { BoundingSphere sphere(aabb_center, radius); _point_primitive->set_bounds(&sphere); - get_render_node()->mark_bounds_stale(); + get_render_node()->mark_internal_bounds_stale(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/sparkleParticleRenderer.cxx b/panda/src/particlesystem/sparkleParticleRenderer.cxx index c809839d45..dbd12f98ab 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.cxx +++ b/panda/src/particlesystem/sparkleParticleRenderer.cxx @@ -277,7 +277,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { BoundingSphere sphere(aabb_center, radius); _line_primitive->set_bounds(&sphere); - get_render_node()->mark_bounds_stale(); + get_render_node()->mark_internal_bounds_stale(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/spriteParticleRenderer.cxx b/panda/src/particlesystem/spriteParticleRenderer.cxx index 62321ce936..df2cf98c4b 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.cxx +++ b/panda/src/particlesystem/spriteParticleRenderer.cxx @@ -766,7 +766,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { } } - get_render_node()->mark_bounds_stale(); + get_render_node()->mark_internal_bounds_stale(); nassertv(render_node->check_valid()); _animation_removed = false; } diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index 05f4057bc9..c2b9cceca7 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -1847,6 +1847,30 @@ mark_bounds_stale(Thread *current_thread) const { CLOSE_ITERATE_CURRENT_AND_UPSTREAM_NOLOCK(_cycler); } +//////////////////////////////////////////////////////////////////// +// Function: PandaNode::mark_internal_bounds_stale +// Access: Published +// Description: Should be called by a derived class to mark the +// internal bounding volume stale, so that +// compute_internal_bounds() will be called when the +// bounding volume is next requested. +// +// With no parameters, this means to iterate through all +// stages including and upstream of the current pipeline +// stage. +// +// It is normally not necessary to call this method +// directly; each node should be responsible for calling +// it when its internals have changed. +//////////////////////////////////////////////////////////////////// +void PandaNode:: +mark_internal_bounds_stale(Thread *current_thread) { + OPEN_ITERATE_CURRENT_AND_UPSTREAM_NOLOCK(_cycler, current_thread) { + mark_internal_bounds_stale(pipeline_stage, current_thread); + } + CLOSE_ITERATE_CURRENT_AND_UPSTREAM_NOLOCK(_cycler); +} + //////////////////////////////////////////////////////////////////// // Function: PandaNode::is_geom_node // Access: Published, Virtual @@ -1986,26 +2010,6 @@ force_bounds_stale(int pipeline_stage, Thread *current_thread) { } } -//////////////////////////////////////////////////////////////////// -// Function: PandaNode::mark_internal_bounds_stale -// Access: Protected -// Description: Should be called by a derived class to mark the -// internal bounding volume stale, so that -// compute_internal_bounds() will be called when the -// bounding volume is next requested. -// -// With no parameters, this means to iterate through all -// stages including and upstream of the current pipeline -// stage. -//////////////////////////////////////////////////////////////////// -void PandaNode:: -mark_internal_bounds_stale(Thread *current_thread) { - OPEN_ITERATE_CURRENT_AND_UPSTREAM_NOLOCK(_cycler, current_thread) { - mark_internal_bounds_stale(pipeline_stage, current_thread); - } - CLOSE_ITERATE_CURRENT_AND_UPSTREAM_NOLOCK(_cycler); -} - //////////////////////////////////////////////////////////////////// // Function: PandaNode::compute_internal_bounds // Access: Protected, Virtual diff --git a/panda/src/pgraph/pandaNode.h b/panda/src/pgraph/pandaNode.h index 2c2913c961..8969cd0668 100644 --- a/panda/src/pgraph/pandaNode.h +++ b/panda/src/pgraph/pandaNode.h @@ -243,6 +243,7 @@ PUBLISHED: INLINE CPT(BoundingVolume) get_internal_bounds() const; void mark_bounds_stale(Thread *current_thread = Thread::get_current_thread()) const; + void mark_internal_bounds_stale(Thread *current_thread = Thread::get_current_thread()); INLINE void set_final(bool flag); INLINE bool is_final(Thread *current_thread = Thread::get_current_thread()) const; @@ -259,7 +260,6 @@ protected: INLINE void mark_bounds_stale(int pipeline_stage, Thread *current_thread) const; void force_bounds_stale(Thread *current_thread = Thread::get_current_thread()); void force_bounds_stale(int pipeline_stage, Thread *current_thread); - void mark_internal_bounds_stale(Thread *current_thread = Thread::get_current_thread()); INLINE void mark_internal_bounds_stale(int pipeline_stage, Thread *current_thread); virtual PT(BoundingVolume) compute_internal_bounds(int pipeline_stage, Thread *current_thread) const;