determine where texture was set from

This commit is contained in:
David Rose 2001-06-19 00:59:31 +00:00
parent 78bc1e00c3
commit 71f8b354bd
3 changed files with 29 additions and 0 deletions

View File

@ -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;
}
////////////////////////////////////////////////////////////////////

View File

@ -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;
}
////////////////////////////////////////////////////////////////////

View File

@ -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);