00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef GEOMPARTICLERENDERER_H
00016 #define GEOMPARTICLERENDERER_H
00017
00018 #include "baseParticleRenderer.h"
00019 #include "baseParticle.h"
00020 #include "colorInterpolationManager.h"
00021 #include "pandaNode.h"
00022 #include "pointerTo.h"
00023 #include "pointerToArray.h"
00024 #include "pvector.h"
00025 #include "pStatCollector.h"
00026
00027 class EXPCL_PANDAPHYSICS GeomParticleRenderer : public BaseParticleRenderer {
00028 PUBLISHED:
00029 GeomParticleRenderer(ParticleRendererAlphaMode am = PR_ALPHA_NONE,
00030 PandaNode *geom_node = (PandaNode *) NULL);
00031 GeomParticleRenderer(const GeomParticleRenderer& copy);
00032 virtual ~GeomParticleRenderer();
00033
00034 INLINE void set_geom_node(PandaNode *node);
00035 INLINE PandaNode *get_geom_node();
00036 INLINE ColorInterpolationManager* get_color_interpolation_manager() const;
00037
00038 INLINE void set_x_scale_flag(bool animate_x_ratio);
00039 INLINE void set_y_scale_flag(bool animate_y_ratio);
00040 INLINE void set_z_scale_flag(bool animate_z_ratio);
00041 INLINE void set_initial_x_scale(PN_stdfloat initial_x_scale);
00042 INLINE void set_final_x_scale(PN_stdfloat final_x_scale);
00043 INLINE void set_initial_y_scale(PN_stdfloat initial_y_scale);
00044 INLINE void set_final_y_scale(PN_stdfloat final_y_scale);
00045 INLINE void set_initial_z_scale(PN_stdfloat initial_z_scale);
00046 INLINE void set_final_z_scale(PN_stdfloat final_z_scale);
00047
00048 INLINE bool get_x_scale_flag() const;
00049 INLINE bool get_y_scale_flag() const;
00050 INLINE bool get_z_scale_flag() const;
00051 INLINE PN_stdfloat get_initial_x_scale() const;
00052 INLINE PN_stdfloat get_final_x_scale() const;
00053 INLINE PN_stdfloat get_initial_y_scale() const;
00054 INLINE PN_stdfloat get_final_y_scale() const;
00055 INLINE PN_stdfloat get_initial_z_scale() const;
00056 INLINE PN_stdfloat get_final_z_scale() const;
00057
00058 public:
00059 virtual BaseParticleRenderer *make_copy();
00060
00061 virtual void output(ostream &out) const;
00062 virtual void write_linear_forces(ostream &out, int indent=0) const;
00063 virtual void write(ostream &out, int indent=0) const;
00064
00065 private:
00066 PT(PandaNode) _geom_node;
00067 PT(ColorInterpolationManager) _color_interpolation_manager;
00068
00069 pvector< PT(PandaNode) > _node_vector;
00070
00071 int _pool_size;
00072 PN_stdfloat _initial_x_scale;
00073 PN_stdfloat _final_x_scale;
00074 PN_stdfloat _initial_y_scale;
00075 PN_stdfloat _final_y_scale;
00076 PN_stdfloat _initial_z_scale;
00077 PN_stdfloat _final_z_scale;
00078
00079 bool _animate_x_ratio;
00080 bool _animate_y_ratio;
00081 bool _animate_z_ratio;
00082
00083
00084
00085 virtual void birth_particle(int index);
00086 virtual void kill_particle(int index);
00087
00088 virtual void init_geoms();
00089 virtual void render(pvector< PT(PhysicsObject) >& po_vector,
00090 int ttl_particles);
00091
00092 virtual void resize_pool(int new_size);
00093 void kill_nodes();
00094
00095 static PStatCollector _render_collector;
00096 };
00097
00098 #include "geomParticleRenderer.I"
00099
00100 #endif // GEOMPARTICLERENDERER_H