Panda3D
geomParticleRenderer.h
1 // Filename: geomParticleRenderer.h
2 // Created by: charles (05Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef GEOMPARTICLERENDERER_H
16 #define GEOMPARTICLERENDERER_H
17 
18 #include "baseParticleRenderer.h"
19 #include "baseParticle.h"
20 #include "colorInterpolationManager.h"
21 #include "pandaNode.h"
22 #include "pointerTo.h"
23 #include "pointerToArray.h"
24 #include "pvector.h"
25 #include "pStatCollector.h"
26 
27 class EXPCL_PANDAPHYSICS GeomParticleRenderer : public BaseParticleRenderer {
28 PUBLISHED:
29  GeomParticleRenderer(ParticleRendererAlphaMode am = PR_ALPHA_NONE,
30  PandaNode *geom_node = (PandaNode *) NULL);
32  virtual ~GeomParticleRenderer();
33 
34  INLINE void set_geom_node(PandaNode *node);
35  INLINE PandaNode *get_geom_node();
36  INLINE ColorInterpolationManager* get_color_interpolation_manager() const;
37 
38  INLINE void set_x_scale_flag(bool animate_x_ratio);
39  INLINE void set_y_scale_flag(bool animate_y_ratio);
40  INLINE void set_z_scale_flag(bool animate_z_ratio);
41  INLINE void set_initial_x_scale(PN_stdfloat initial_x_scale);
42  INLINE void set_final_x_scale(PN_stdfloat final_x_scale);
43  INLINE void set_initial_y_scale(PN_stdfloat initial_y_scale);
44  INLINE void set_final_y_scale(PN_stdfloat final_y_scale);
45  INLINE void set_initial_z_scale(PN_stdfloat initial_z_scale);
46  INLINE void set_final_z_scale(PN_stdfloat final_z_scale);
47 
48  INLINE bool get_x_scale_flag() const;
49  INLINE bool get_y_scale_flag() const;
50  INLINE bool get_z_scale_flag() const;
51  INLINE PN_stdfloat get_initial_x_scale() const;
52  INLINE PN_stdfloat get_final_x_scale() const;
53  INLINE PN_stdfloat get_initial_y_scale() const;
54  INLINE PN_stdfloat get_final_y_scale() const;
55  INLINE PN_stdfloat get_initial_z_scale() const;
56  INLINE PN_stdfloat get_final_z_scale() const;
57 
58 public:
59  virtual BaseParticleRenderer *make_copy();
60 
61  virtual void output(ostream &out) const;
62  virtual void write_linear_forces(ostream &out, int indent=0) const;
63  virtual void write(ostream &out, int indent=0) const;
64 
65 private:
66  PT(PandaNode) _geom_node;
67  PT(ColorInterpolationManager) _color_interpolation_manager;
68 
69  pvector< PT(PandaNode) > _node_vector;
70 
71  int _pool_size;
72  PN_stdfloat _initial_x_scale;
73  PN_stdfloat _final_x_scale;
74  PN_stdfloat _initial_y_scale;
75  PN_stdfloat _final_y_scale;
76  PN_stdfloat _initial_z_scale;
77  PN_stdfloat _final_z_scale;
78 
79  bool _animate_x_ratio;
80  bool _animate_y_ratio;
81  bool _animate_z_ratio;
82 
83  // geomparticlerenderer takes advantage of the birth/death functions
84 
85  virtual void birth_particle(int index);
86  virtual void kill_particle(int index);
87 
88  virtual void init_geoms();
89  virtual void render(pvector< PT(PhysicsObject) >& po_vector,
90  int ttl_particles);
91 
92  virtual void resize_pool(int new_size);
93  void kill_nodes();
94 
95  static PStatCollector _render_collector;
96 };
97 
98 #include "geomParticleRenderer.I"
99 
100 #endif // GEOMPARTICLERENDERER_H
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
A body on which physics will be applied.
Definition: physicsObject.h:29
A lightweight class that represents a single element that may be timed and/or counted via stats...
Pure virtual particle renderer base class.
High level class for color interpolation.
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.