00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef POINTPARTICLERENDERER_H
00020 #define POINTPARTICLERENDERER_H
00021
00022 #include "baseParticleRenderer.h"
00023 #include "baseParticle.h"
00024
00025 #include <pointerTo.h>
00026 #include <pointerToArray.h>
00027 #include <luse.h>
00028 #include <geom.h>
00029 #include <geomPoint.h>
00030
00031
00032
00033
00034
00035
00036
00037
00038 class EXPCL_PANDAPHYSICS PointParticleRenderer : public BaseParticleRenderer {
00039 PUBLISHED:
00040 enum PointParticleBlendType {
00041 PP_ONE_COLOR,
00042 PP_BLEND_LIFE,
00043 PP_BLEND_VEL
00044 };
00045
00046 PointParticleRenderer(const PointParticleRenderer& copy);
00047 PointParticleRenderer(ParticleRendererAlphaMode ad = PR_ALPHA_NONE,
00048 float point_size = 1.0f,
00049 PointParticleBlendType bt = PP_ONE_COLOR,
00050 ParticleRendererBlendMethod bm = PP_NO_BLEND,
00051 const Colorf& sc = Colorf(1.0f, 1.0f, 1.0f, 1.0f),
00052 const Colorf& ec = Colorf(1.0f, 1.0f, 1.0f, 1.0f));
00053
00054 virtual ~PointParticleRenderer(void);
00055
00056 virtual BaseParticleRenderer *make_copy(void);
00057
00058 INLINE void set_point_size(float point_size);
00059 INLINE void set_start_color(const Colorf& sc);
00060 INLINE void set_end_color(const Colorf& ec);
00061 INLINE void set_blend_type(PointParticleBlendType bt);
00062 INLINE void set_blend_method(ParticleRendererBlendMethod bm);
00063
00064 INLINE float get_point_size(void) const;
00065 INLINE const Colorf& get_start_color(void) const;
00066 INLINE const Colorf& get_end_color(void) const;
00067 INLINE PointParticleBlendType get_blend_type(void) const;
00068 INLINE ParticleRendererBlendMethod get_blend_method(void) const;
00069
00070 private:
00071 Colorf _start_color, _end_color;
00072 float _point_size;
00073
00074 PT(GeomPoint) _point_primitive;
00075
00076 PTA_Vertexf _vertex_array;
00077 PTA_Colorf _color_array;
00078
00079 int _max_pool_size;
00080
00081 PointParticleBlendType _blend_type;
00082 ParticleRendererBlendMethod _blend_method;
00083
00084 LPoint3f _aabb_min, _aabb_max;
00085
00086 Colorf create_color(const BaseParticle *p);
00087
00088 virtual void birth_particle(int index);
00089 virtual void kill_particle(int index);
00090 virtual void init_geoms(void);
00091 virtual void render(pvector< PT(PhysicsObject) >& po_vector,
00092 int ttl_particles);
00093 virtual void resize_pool(int new_size);
00094 };
00095
00096 #include "pointParticleRenderer.I"
00097
00098 #endif // POINTPARTICLERENDERER_H