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