00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef POINTPARTICLERENDERER_H
00016 #define POINTPARTICLERENDERER_H
00017
00018 #include "baseParticleRenderer.h"
00019 #include "baseParticle.h"
00020 #include "renderModeAttrib.h"
00021 #include "pointerTo.h"
00022 #include "pointerToArray.h"
00023 #include "luse.h"
00024 #include "geom.h"
00025 #include "geomVertexData.h"
00026 #include "geomPoints.h"
00027 #include "pStatCollector.h"
00028
00029
00030
00031
00032
00033
00034
00035
00036 class EXPCL_PANDAPHYSICS PointParticleRenderer : public BaseParticleRenderer {
00037 PUBLISHED:
00038 enum PointParticleBlendType {
00039 PP_ONE_COLOR,
00040 PP_BLEND_LIFE,
00041 PP_BLEND_VEL
00042 };
00043
00044 PointParticleRenderer(const PointParticleRenderer& copy);
00045 PointParticleRenderer(ParticleRendererAlphaMode ad = PR_ALPHA_NONE,
00046 PN_stdfloat point_size = 1.0f,
00047 PointParticleBlendType bt = PP_ONE_COLOR,
00048 ParticleRendererBlendMethod bm = PP_NO_BLEND,
00049 const LColor& sc = LColor(1.0f, 1.0f, 1.0f, 1.0f),
00050 const LColor& ec = LColor(1.0f, 1.0f, 1.0f, 1.0f));
00051
00052 virtual ~PointParticleRenderer();
00053
00054 public:
00055 virtual BaseParticleRenderer *make_copy();
00056
00057 PUBLISHED:
00058 INLINE void set_point_size(PN_stdfloat point_size);
00059 INLINE void set_start_color(const LColor& sc);
00060 INLINE void set_end_color(const LColor& ec);
00061 INLINE void set_blend_type(PointParticleBlendType bt);
00062 INLINE void set_blend_method(ParticleRendererBlendMethod bm);
00063
00064 INLINE PN_stdfloat get_point_size() const;
00065 INLINE const LColor& get_start_color() const;
00066 INLINE const LColor& get_end_color() const;
00067 INLINE PointParticleBlendType get_blend_type() const;
00068 INLINE ParticleRendererBlendMethod get_blend_method() 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 _start_color;
00075 LColor _end_color;
00076 PN_stdfloat _point_size;
00077 CPT(RenderAttrib) _thick;
00078
00079 PT(Geom) _point_primitive;
00080 PT(GeomPoints) _points;
00081 PT(GeomVertexData) _vdata;
00082
00083 int _max_pool_size;
00084
00085 PointParticleBlendType _blend_type;
00086 ParticleRendererBlendMethod _blend_method;
00087
00088 LPoint3 _aabb_min;
00089 LPoint3 _aabb_max;
00090
00091 LColor create_color(const BaseParticle *p);
00092
00093 virtual void birth_particle(int index);
00094 virtual void kill_particle(int index);
00095 virtual void init_geoms();
00096 virtual void render(pvector< PT(PhysicsObject) >& po_vector,
00097 int ttl_particles);
00098 virtual void resize_pool(int new_size);
00099
00100 static PStatCollector _render_collector;
00101 };
00102
00103 #include "pointParticleRenderer.I"
00104
00105 #endif // POINTPARTICLERENDERER_H