Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/particlesystem/spriteParticleRenderer.h

Go to the documentation of this file.
00001 // Filename: spriteParticleRenderer.h
00002 // Created by:  charles (13Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef SPRITEPARTICLERENDERER_H
00020 #define SPRITEPARTICLERENDERER_H
00021 
00022 #include "pandabase.h"
00023 #include "texture.h"
00024 #include "pointerTo.h"
00025 #include "pointerToArray.h"
00026 #include "pta_float.h"
00027 #include "geom.h"
00028 #include "geomSprite.h"
00029 
00030 #include "baseParticleRenderer.h"
00031 #include "baseParticle.h"
00032 
00033 class NodePath;
00034 
00035 ////////////////////////////////////////////////////////////////////
00036 //       Class : SpriteParticleRenderer
00037 // Description : Renders a particle system with high-speed nasty
00038 //               trick sprites.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDAPHYSICS SpriteParticleRenderer : public BaseParticleRenderer {
00041 
00042 PUBLISHED:
00043   // This enumerated type indicates the source of the sprite texture:
00044   // whether it came from an explicit call to set_texture(), or
00045   // whether from a call to set_from_node().
00046   enum SourceType {
00047     ST_texture,
00048     ST_from_node,
00049   };
00050 
00051 private:
00052   PT(GeomSprite) _sprite_primitive;
00053   PTA_Vertexf _vertex_array;
00054   PTA_Colorf _color_array;
00055   PTA_float _x_texel_array;
00056   PTA_float _y_texel_array;
00057   PTA_float _theta_array;
00058 
00059   Colorf _color;
00060 
00061   float _initial_x_texel_ratio, _final_x_texel_ratio;
00062   float _initial_y_texel_ratio, _final_y_texel_ratio;
00063   float _theta;
00064 
00065   bool _animate_x_ratio, _animate_y_ratio;
00066   bool _animate_theta;
00067 
00068   ParticleRendererBlendMethod _blend_method;
00069 
00070   Vertexf _aabb_min, _aabb_max;
00071 
00072   int _pool_size;
00073   SourceType _source_type;
00074 
00075   virtual void birth_particle(int index);
00076   virtual void kill_particle(int index);
00077   virtual void init_geoms(void);
00078   virtual void render(pvector< PT(PhysicsObject) > &po_vector,
00079                       int ttl_particles);
00080   virtual void resize_pool(int new_size);
00081 
00082 PUBLISHED:
00083   SpriteParticleRenderer(Texture *tex = (Texture *) NULL);
00084   SpriteParticleRenderer(const SpriteParticleRenderer &copy);
00085   virtual ~SpriteParticleRenderer(void);
00086 
00087   virtual BaseParticleRenderer *make_copy(void);
00088 
00089   INLINE SourceType get_source_type() const;
00090 
00091   void set_from_node(const NodePath &node_path);
00092 
00093   INLINE void set_texture(Texture *tex);
00094   INLINE void set_ll_uv(const TexCoordf &ll_uv);
00095   INLINE void set_ur_uv(const TexCoordf &ur_uv);
00096   INLINE void set_color(const Colorf &color);
00097   INLINE void set_x_scale_flag(bool animate_x_ratio);
00098   INLINE void set_y_scale_flag(bool animate_y_ratio);
00099   INLINE void set_anim_angle_flag(bool animate_theta);
00100   INLINE void set_initial_x_scale(float initial_x_scale);
00101   INLINE void set_final_x_scale(float final_x_scale);
00102   INLINE void set_initial_y_scale(float initial_y_scale);
00103   INLINE void set_final_y_scale(float final_y_scale);
00104   INLINE void set_nonanimated_theta(float theta);
00105   INLINE void set_alpha_blend_method(ParticleRendererBlendMethod bm);
00106   INLINE void set_alpha_disable(bool ad);
00107 
00108   INLINE Texture *get_texture(void) const;
00109   INLINE const TexCoordf &get_ll_uv() const;
00110   INLINE const TexCoordf &get_ur_uv() const;
00111   INLINE Colorf get_color(void) const;
00112   INLINE bool get_x_scale_flag(void) const;
00113   INLINE bool get_y_scale_flag(void) const;
00114   INLINE bool get_anim_angle_flag(void) const;
00115   INLINE float get_initial_x_scale(void) const;
00116   INLINE float get_final_x_scale(void) const;
00117   INLINE float get_initial_y_scale(void) const;
00118   INLINE float get_final_y_scale(void) const;
00119   INLINE float get_nonanimated_theta(void) const;
00120   INLINE ParticleRendererBlendMethod get_alpha_blend_method(void) const;
00121   INLINE bool get_alpha_disable(void) const;
00122 };
00123 
00124 #include "spriteParticleRenderer.I"
00125 
00126 #endif // SPRITEPARTICLERENDERER_H

Generated on Fri May 2 00:41:01 2003 for Panda by doxygen1.3