Panda3D
lineParticleRenderer.h
1 // Filename: lineParticleRenderer.h
2 // Created by: darren (06Oct00)
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 LINEPARTICLERENDERER_H
16 #define LINEPARTICLERENDERER_H
17 
18 #include "baseParticle.h"
19 #include "baseParticleRenderer.h"
20 #include "pointerTo.h"
21 #include "pointerToArray.h"
22 #include "geom.h"
23 #include "geomVertexData.h"
24 #include "geomLines.h"
25 #include "pStatCollector.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : LineParticleRenderer
29 // Description : renders a line from last position to current
30 // position -- good for rain, sparks, etc.
31 ////////////////////////////////////////////////////////////////////
32 
33 class EXPCL_PANDAPHYSICS LineParticleRenderer : public BaseParticleRenderer {
34 PUBLISHED:
37  LineParticleRenderer(const LColor& head,
38  const LColor& tail,
39  ParticleRendererAlphaMode alpha_mode);
40 
41  virtual ~LineParticleRenderer();
42 
43 public:
44  virtual BaseParticleRenderer *make_copy();
45 
46 PUBLISHED:
47  INLINE void set_head_color(const LColor& c);
48  INLINE void set_tail_color(const LColor& c);
49 
50  INLINE const LColor& get_head_color() const;
51  INLINE const LColor& get_tail_color() const;
52 
53  INLINE void set_line_scale_factor(PN_stdfloat sf);
54  INLINE PN_stdfloat get_line_scale_factor() const;
55 
56  virtual void output(ostream &out) const;
57  virtual void write(ostream &out, int indent_level = 0) const;
58 
59 private:
60  LColor _head_color;
61  LColor _tail_color;
62 
63  PT(Geom) _line_primitive;
64  PT(GeomLines) _lines;
65  PT(GeomVertexData) _vdata;
66 
67  int _max_pool_size;
68 
69  LPoint3 _aabb_min;
70  LPoint3 _aabb_max;
71 
72  PN_stdfloat _line_scale_factor;
73 
74  virtual void birth_particle(int index);
75  virtual void kill_particle(int index);
76  virtual void init_geoms();
77  virtual void render(pvector< PT(PhysicsObject) >& po_vector,
78  int ttl_particles);
79  virtual void resize_pool(int new_size);
80 
81  static PStatCollector _render_collector;
82 };
83 
84 #include "lineParticleRenderer.I"
85 
86 #endif // LINEPARTICLERENDERER_H
A body on which physics will be applied.
Definition: physicsObject.h:29
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
A lightweight class that represents a single element that may be timed and/or counted via stats...
Pure virtual particle renderer base class.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
Definition: geom.h:58
Defines a series of disconnected line segments.
Definition: geomLines.h:25
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
renders a line from last position to current position – good for rain, sparks, etc.
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>.