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