Panda3D
sparkleParticleRenderer.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 sparkleParticleRenderer.h
10  * @author charles
11  * @date 2000-06-27
12  */
13 
14 #ifndef SPARKLEPARTICLERENDERER_H
15 #define SPARKLEPARTICLERENDERER_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 enum SparkleParticleLifeScale {
27  SP_NO_SCALE,
28  SP_SCALE
29 };
30 
31 /**
32  * pretty sparkly things.
33  */
34 class EXPCL_PANDA_PARTICLESYSTEM SparkleParticleRenderer : public BaseParticleRenderer {
35 PUBLISHED:
36  enum SparkleParticleLifeScale {
37  SP_NO_SCALE,
38  SP_SCALE
39  };
40 
43  explicit SparkleParticleRenderer(const LColor& center,
44  const LColor& edge,
45  PN_stdfloat birth_radius,
46  PN_stdfloat death_radius,
47  SparkleParticleLifeScale life_scale,
48  ParticleRendererAlphaMode alpha_mode);
49 
50  virtual ~SparkleParticleRenderer();
51 
52 public:
53  virtual BaseParticleRenderer *make_copy();
54 
55 PUBLISHED:
56  INLINE void set_center_color(const LColor& c);
57  INLINE void set_edge_color(const LColor& c);
58  INLINE void set_birth_radius(PN_stdfloat radius);
59  INLINE void set_death_radius(PN_stdfloat radius);
60  INLINE void set_life_scale(SparkleParticleLifeScale);
61 
62  INLINE const LColor& get_center_color() const;
63  INLINE const LColor& get_edge_color() const;
64  INLINE PN_stdfloat get_birth_radius() const;
65  INLINE PN_stdfloat get_death_radius() const;
66  INLINE SparkleParticleLifeScale get_life_scale() const;
67 
68  virtual void output(std::ostream &out) const;
69  virtual void write(std::ostream &out, int indent_level = 0) const;
70 
71 private:
72  LColor _center_color;
73  LColor _edge_color;
74 
75  PN_stdfloat _birth_radius;
76  PN_stdfloat _death_radius;
77 
78  PT(Geom) _line_primitive;
79  PT(GeomLines) _lines;
80  PT(GeomVertexData) _vdata;
81 
82  int _max_pool_size;
83 
84  SparkleParticleLifeScale _life_scale;
85  LPoint3 _aabb_min;
86  LPoint3 _aabb_max;
87 
88  INLINE PN_stdfloat get_radius(BaseParticle *bp);
89 
90  virtual void birth_particle(int index);
91  virtual void kill_particle(int index);
92  virtual void init_geoms();
93  virtual void render(pvector< PT(PhysicsObject) >& po_vector,
94  int ttl_particles);
95  virtual void resize_pool(int new_size);
96 
97  static PStatCollector _render_collector;
98 };
99 
100 #include "sparkleParticleRenderer.I"
101 
102 #endif // SPARKLEPARTICLERENDERER_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>.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
pretty sparkly things.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An individual, physically-modelable particle abstract base class.
Definition: baseParticle.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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.