00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SPARKLEPARTICLERENDERER_H
00020 #define SPARKLEPARTICLERENDERER_H
00021
00022 #include "baseParticle.h"
00023 #include "baseParticleRenderer.h"
00024
00025 #include <pointerTo.h>
00026 #include <pointerToArray.h>
00027 #include <geom.h>
00028 #include <geomLine.h>
00029
00030 enum SparkleParticleLifeScale {
00031 SP_NO_SCALE,
00032 SP_SCALE
00033 };
00034
00035
00036
00037
00038
00039
00040 class EXPCL_PANDAPHYSICS SparkleParticleRenderer : public BaseParticleRenderer {
00041 PUBLISHED:
00042 enum SparkleParticleLifeScale {
00043 SP_NO_SCALE,
00044 SP_SCALE
00045 };
00046
00047 SparkleParticleRenderer(void);
00048 SparkleParticleRenderer(const SparkleParticleRenderer& copy);
00049 SparkleParticleRenderer(const Colorf& center,
00050 const Colorf& edge,
00051 float birth_radius,
00052 float death_radius,
00053 SparkleParticleLifeScale life_scale,
00054 ParticleRendererAlphaMode alpha_mode);
00055
00056 virtual ~SparkleParticleRenderer(void);
00057
00058 virtual BaseParticleRenderer *make_copy(void);
00059
00060 INLINE void set_center_color(const Colorf& c);
00061 INLINE void set_edge_color(const Colorf& c);
00062 INLINE void set_birth_radius(float radius);
00063 INLINE void set_death_radius(float radius);
00064 INLINE void set_life_scale(SparkleParticleLifeScale);
00065
00066 INLINE const Colorf& get_center_color(void) const;
00067 INLINE const Colorf& get_edge_color(void) const;
00068 INLINE float get_birth_radius(void) const;
00069 INLINE float get_death_radius(void) const;
00070 INLINE SparkleParticleLifeScale get_life_scale(void) const;
00071
00072 private:
00073
00074 Colorf _center_color;
00075 Colorf _edge_color;
00076
00077 float _birth_radius;
00078 float _death_radius;
00079
00080 PT(GeomLine) _line_primitive;
00081
00082 PTA_Vertexf _vertex_array;
00083 PTA_Colorf _color_array;
00084
00085 int _max_pool_size;
00086
00087 SparkleParticleLifeScale _life_scale;
00088 LPoint3f _aabb_min, _aabb_max;
00089
00090 INLINE float get_radius(BaseParticle *bp);
00091
00092 virtual void birth_particle(int index);
00093 virtual void kill_particle(int index);
00094 virtual void init_geoms(void);
00095 virtual void render(pvector< PT(PhysicsObject) >& po_vector,
00096 int ttl_particles);
00097 virtual void resize_pool(int new_size);
00098 };
00099
00100 #include "sparkleParticleRenderer.I"
00101
00102 #endif // SPARKLEPARTICLERENDERER_H