Panda3D
lineParticleRenderer.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 lineParticleRenderer.h
10  * @author darren
11  * @date 2000-10-06
12  */
13 
14 #ifndef LINEPARTICLERENDERER_H
15 #define LINEPARTICLERENDERER_H
16 
17 #include "baseParticle.h"
18 #include "baseParticleRenderer.h"
19 #include "pointerTo.h"
20 #include "pointerToArray.h"
21 #include "geom.h"
22 #include "geomVertexData.h"
23 #include "geomLines.h"
24 #include "pStatCollector.h"
25 
26 /**
27  * renders a line from last position to current position -- good for rain,
28  * sparks, etc.
29  */
30 
31 class EXPCL_PANDA_PARTICLESYSTEM LineParticleRenderer : public BaseParticleRenderer {
32 PUBLISHED:
35  explicit LineParticleRenderer(const LColor& head,
36  const LColor& tail,
37  ParticleRendererAlphaMode alpha_mode);
38 
39  virtual ~LineParticleRenderer();
40 
41 public:
42  virtual BaseParticleRenderer *make_copy();
43 
44 PUBLISHED:
45  INLINE void set_head_color(const LColor& c);
46  INLINE void set_tail_color(const LColor& c);
47 
48  INLINE const LColor& get_head_color() const;
49  INLINE const LColor& get_tail_color() const;
50 
51  INLINE void set_line_scale_factor(PN_stdfloat sf);
52  INLINE PN_stdfloat get_line_scale_factor() const;
53 
54  virtual void output(std::ostream &out) const;
55  virtual void write(std::ostream &out, int indent_level = 0) const;
56 
57 private:
58  LColor _head_color;
59  LColor _tail_color;
60 
61  PT(Geom) _line_primitive;
62  PT(GeomLines) _lines;
63  PT(GeomVertexData) _vdata;
64 
65  int _max_pool_size;
66 
67  LPoint3 _aabb_min;
68  LPoint3 _aabb_max;
69 
70  PN_stdfloat _line_scale_factor;
71 
72  virtual void birth_particle(int index);
73  virtual void kill_particle(int index);
74  virtual void init_geoms();
75  virtual void render(pvector< PT(PhysicsObject) >& po_vector,
76  int ttl_particles);
77  virtual void resize_pool(int new_size);
78 
79  static PStatCollector _render_collector;
80 };
81 
82 #include "lineParticleRenderer.I"
83 
84 #endif // LINEPARTICLERENDERER_H
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.
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:54
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a series of disconnected line segments.
Definition: geomLines.h:23
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
renders a line from last position to current position – good for rain, sparks, etc.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.