diff --git a/panda/src/particlesystem/baseParticleEmitter.h b/panda/src/particlesystem/baseParticleEmitter.h index 8dd741a308..6e42a7615f 100644 --- a/panda/src/particlesystem/baseParticleEmitter.h +++ b/panda/src/particlesystem/baseParticleEmitter.h @@ -20,7 +20,7 @@ // particles are randomly generated. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS BaseParticleEmitter : public ReferenceCount { -public: +PUBLISHED: enum emissionType { ET_EXPLICIT, // all particles are emitted in the same direction ET_RADIATE, // all particles radiate away from a single point diff --git a/panda/src/particlesystem/baseParticleFactory.h b/panda/src/particlesystem/baseParticleFactory.h index 3b54d8a98a..42ef24f784 100644 --- a/panda/src/particlesystem/baseParticleFactory.h +++ b/panda/src/particlesystem/baseParticleFactory.h @@ -35,7 +35,7 @@ protected: BaseParticleFactory(void); BaseParticleFactory(const BaseParticleFactory ©); -public: +PUBLISHED: virtual ~BaseParticleFactory(void); INLINE void set_lifespan_base(float lb); diff --git a/panda/src/particlesystem/baseParticleRenderer.I b/panda/src/particlesystem/baseParticleRenderer.I index 20133b80c9..cd3d3f42f2 100644 --- a/panda/src/particlesystem/baseParticleRenderer.I +++ b/panda/src/particlesystem/baseParticleRenderer.I @@ -35,7 +35,7 @@ disable_alpha(void) { // Access : public //////////////////////////////////////////////////////////////////// INLINE void BaseParticleRenderer:: -set_alpha_mode(ParticleRendererAlphaMode am) { +set_alpha_mode(BaseParticleRenderer::ParticleRendererAlphaMode am) { update_alpha_mode(am); init_geoms(); } @@ -44,7 +44,7 @@ set_alpha_mode(ParticleRendererAlphaMode am) { // Function : get_alpha_mode // Access : public //////////////////////////////////////////////////////////////////// -INLINE ParticleRendererAlphaMode BaseParticleRenderer:: +INLINE BaseParticleRenderer::ParticleRendererAlphaMode BaseParticleRenderer:: get_alpha_mode(void) const { return _alpha_mode; } diff --git a/panda/src/particlesystem/baseParticleRenderer.h b/panda/src/particlesystem/baseParticleRenderer.h index 86610733c1..e4e37e7a79 100644 --- a/panda/src/particlesystem/baseParticleRenderer.h +++ b/panda/src/particlesystem/baseParticleRenderer.h @@ -19,20 +19,6 @@ #include -enum ParticleRendererAlphaMode { - PR_ALPHA_NONE, - PR_ALPHA_OUT, - PR_ALPHA_IN, - PR_ALPHA_USER, - PR_NOT_INITIALIZED_YET -}; - -enum ParticleRendererBlendMethod { - PP_NO_BLEND, - PP_BLEND_LINEAR, - PP_BLEND_CUBIC -}; - //////////////////////////////////////////////////////////////////// // Class : BaseParticleRenderer // Description : Pure virtual particle renderer base class @@ -65,6 +51,31 @@ private: virtual void render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) = 0; +PUBLISHED: + enum ParticleRendererAlphaMode { + PR_ALPHA_NONE, + PR_ALPHA_OUT, + PR_ALPHA_IN, + PR_ALPHA_USER, + PR_NOT_INITIALIZED_YET + }; + + enum ParticleRendererBlendMethod { + PP_NO_BLEND, + PP_BLEND_LINEAR, + PP_BLEND_CUBIC + }; + + virtual ~BaseParticleRenderer(void); + + INLINE GeomNode *get_render_node(void) const; + + INLINE void set_alpha_mode(ParticleRendererAlphaMode am); + INLINE ParticleRendererAlphaMode get_alpha_mode(void) const; + + INLINE void set_user_alpha(float ua); + INLINE float get_user_alpha(void) const; + protected: GeomNode *_interface_node; @@ -83,17 +94,6 @@ protected: virtual void resize_pool(int new_size) = 0; public: - - virtual ~BaseParticleRenderer(void); - - INLINE GeomNode *get_render_node(void) const; - - INLINE void set_alpha_mode(ParticleRendererAlphaMode am); - INLINE ParticleRendererAlphaMode get_alpha_mode(void) const; - - INLINE void set_user_alpha(float ua); - INLINE float get_user_alpha(void) const; - virtual BaseParticleRenderer *make_copy(void) = 0; friend class ParticleSystem; diff --git a/panda/src/particlesystem/pointParticleRenderer.I b/panda/src/particlesystem/pointParticleRenderer.I index 71d1866874..b5a42f808f 100644 --- a/panda/src/particlesystem/pointParticleRenderer.I +++ b/panda/src/particlesystem/pointParticleRenderer.I @@ -36,7 +36,7 @@ set_end_color(const Colorf& ec) { // Access : Public //////////////////////////////////////////////////////////////////// INLINE void PointParticleRenderer:: -set_blend_type(PointParticleBlendType bt) { +set_blend_type(PointParticleRenderer::PointParticleBlendType bt) { _blend_type = bt; } @@ -45,7 +45,7 @@ set_blend_type(PointParticleBlendType bt) { // Access : Public //////////////////////////////////////////////////////////////////// INLINE void PointParticleRenderer:: -set_blend_method(ParticleRendererBlendMethod bm) { +set_blend_method(BaseParticleRenderer::ParticleRendererBlendMethod bm) { _blend_method = bm; } @@ -80,7 +80,7 @@ get_end_color(void) const { // Function : get_blend_type // Access : Public //////////////////////////////////////////////////////////////////// -INLINE PointParticleBlendType PointParticleRenderer:: +INLINE PointParticleRenderer::PointParticleBlendType PointParticleRenderer:: get_blend_type(void) const { return _blend_type; } @@ -89,7 +89,7 @@ get_blend_type(void) const { // Function : get_blend_method // Access : Public //////////////////////////////////////////////////////////////////// -INLINE ParticleRendererBlendMethod PointParticleRenderer:: +INLINE BaseParticleRenderer::ParticleRendererBlendMethod PointParticleRenderer:: get_blend_method(void) const { return _blend_method; } diff --git a/panda/src/particlesystem/pointParticleRenderer.h b/panda/src/particlesystem/pointParticleRenderer.h index f03b7c7d11..479c4a36d9 100644 --- a/panda/src/particlesystem/pointParticleRenderer.h +++ b/panda/src/particlesystem/pointParticleRenderer.h @@ -15,12 +15,6 @@ #include #include -enum PointParticleBlendType { - PP_ONE_COLOR, - PP_BLEND_LIFE, - PP_BLEND_VEL -}; - //////////////////////////////////////////////////////////////////// // Class : PointParticleRenderer // Description : Simple point/point particle renderer. Does NOT @@ -29,33 +23,13 @@ enum PointParticleBlendType { //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS PointParticleRenderer : public BaseParticleRenderer { -private: - - Colorf _start_color, _end_color; - float _point_size; - - PT(GeomPoint) _point_primitive; - - PTA_Vertexf _vertex_array; - PTA_Colorf _color_array; - - int _max_pool_size; - - PointParticleBlendType _blend_type; - ParticleRendererBlendMethod _blend_method; - - LPoint3f _aabb_min, _aabb_max; - - Colorf create_color(const BaseParticle *p); - - virtual void birth_particle(int index); - virtual void kill_particle(int index); - virtual void init_geoms(void); - virtual void render(vector< PT(PhysicsObject) >& po_vector, - int ttl_particles); - virtual void resize_pool(int new_size); - PUBLISHED: + enum PointParticleBlendType { + PP_ONE_COLOR, + PP_BLEND_LIFE, + PP_BLEND_VEL + }; + PointParticleRenderer(const PointParticleRenderer& copy); PointParticleRenderer(ParticleRendererAlphaMode ad = PR_ALPHA_NONE, float point_size = 1.0f, @@ -79,6 +53,31 @@ PUBLISHED: INLINE const Colorf& get_end_color(void) const; INLINE PointParticleBlendType get_blend_type(void) const; INLINE ParticleRendererBlendMethod get_blend_method(void) const; + +private: + Colorf _start_color, _end_color; + float _point_size; + + PT(GeomPoint) _point_primitive; + + PTA_Vertexf _vertex_array; + PTA_Colorf _color_array; + + int _max_pool_size; + + PointParticleBlendType _blend_type; + ParticleRendererBlendMethod _blend_method; + + LPoint3f _aabb_min, _aabb_max; + + Colorf create_color(const BaseParticle *p); + + virtual void birth_particle(int index); + virtual void kill_particle(int index); + virtual void init_geoms(void); + virtual void render(vector< PT(PhysicsObject) >& po_vector, + int ttl_particles); + virtual void resize_pool(int new_size); }; #include "pointParticleRenderer.I" diff --git a/panda/src/particlesystem/spriteParticleRenderer.I b/panda/src/particlesystem/spriteParticleRenderer.I index 0e69ff6665..bf0871746e 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.I +++ b/panda/src/particlesystem/spriteParticleRenderer.I @@ -232,7 +232,7 @@ get_nonanimated_theta(void) const { // Function : get_alpha_blend_method // Access : public //////////////////////////////////////////////////////////////////// -INLINE ParticleRendererBlendMethod SpriteParticleRenderer:: +INLINE BaseParticleRenderer::ParticleRendererBlendMethod SpriteParticleRenderer:: get_alpha_blend_method(void) const { return _blend_method; } diff --git a/panda/src/testbed/test_particles.cxx b/panda/src/testbed/test_particles.cxx index f076e9043b..6a85ee1d7e 100644 --- a/panda/src/testbed/test_particles.cxx +++ b/panda/src/testbed/test_particles.cxx @@ -110,7 +110,7 @@ //#define PARTICLE_RENDERER_ALPHA_MODE PR_ALPHA_NONE //#define PARTICLE_RENDERER_ALPHA_MODE PR_ALPHA_IN //#define PARTICLE_RENDERER_ALPHA_MODE PR_ALPHA_OUT -#define PARTICLE_RENDERER_ALPHA_MODE PR_ALPHA_USER +#define PARTICLE_RENDERER_ALPHA_MODE BaseParticleRenderer::PR_ALPHA_USER #define PARTICLE_RENDERER_USER_ALPHA 1.0 #ifdef GEOM_PARTICLE_RENDERER