diff --git a/panda/src/particlesystem/spriteParticleRenderer.I b/panda/src/particlesystem/spriteParticleRenderer.I index a14a2bb119..adf6f9ee7a 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.I +++ b/panda/src/particlesystem/spriteParticleRenderer.I @@ -16,6 +16,18 @@ // //////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function : SpriteParticleRenderer::get_source_type +// Access : public +// Description : Returns an indication of whether the texture for this +// renderer was set via a call to set_texture(), or via +// set_from_node(). +//////////////////////////////////////////////////////////////////// +INLINE SpriteParticleRenderer::SourceType SpriteParticleRenderer:: +get_source_type() const { + return _source_type; +} + //////////////////////////////////////////////////////////////////// // Function : SpriteParticleRenderer::set_texture // Access : public @@ -23,6 +35,9 @@ INLINE void SpriteParticleRenderer:: set_texture(Texture *tex) { _sprite_primitive->set_texture(tex); + _sprite_primitive->set_ll_uv(TexCoordf(0.0, 0.0)); + _sprite_primitive->set_ur_uv(TexCoordf(0.0, 0.0)); + _source_type = ST_texture; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/spriteParticleRenderer.cxx b/panda/src/particlesystem/spriteParticleRenderer.cxx index 83add609c9..a2fb0f9843 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.cxx +++ b/panda/src/particlesystem/spriteParticleRenderer.cxx @@ -192,6 +192,7 @@ set_from_node(const NodePath &node_path) { set_texture(tex); set_ll_uv(min_uv); set_ur_uv(max_uv); + _source_type = ST_from_node; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/spriteParticleRenderer.h b/panda/src/particlesystem/spriteParticleRenderer.h index 529d2da8af..275d61f428 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.h +++ b/panda/src/particlesystem/spriteParticleRenderer.h @@ -38,6 +38,16 @@ class NodePath; // trick sprites. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS SpriteParticleRenderer : public BaseParticleRenderer { + +PUBLISHED: + // This enumerated type indicates the source of the sprite texture: + // whether it came from an explicit call to set_texture(), or + // whether from a call to set_from_node(). + enum SourceType { + ST_texture, + ST_from_node, + }; + private: PT(GeomSprite) _sprite_primitive; PTA_Vertexf _vertex_array; @@ -60,6 +70,7 @@ private: Vertexf _aabb_min, _aabb_max; int _pool_size; + SourceType _source_type; virtual void birth_particle(int index); virtual void kill_particle(int index); @@ -75,6 +86,8 @@ PUBLISHED: virtual BaseParticleRenderer *make_copy(void); + INLINE SourceType get_source_type() const; + void set_from_node(const NodePath &node_path); INLINE void set_texture(Texture *tex);