Panda3D
 All Classes Functions Variables Enumerations
pointParticleRenderer.h
1 // Filename: pointParticleRenderer.h
2 // Created by: charles (20Jun00)
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 POINTPARTICLERENDERER_H
16 #define POINTPARTICLERENDERER_H
17 
18 #include "baseParticleRenderer.h"
19 #include "baseParticle.h"
20 #include "renderModeAttrib.h"
21 #include "pointerTo.h"
22 #include "pointerToArray.h"
23 #include "luse.h"
24 #include "geom.h"
25 #include "geomVertexData.h"
26 #include "geomPoints.h"
27 #include "pStatCollector.h"
28 
29 ////////////////////////////////////////////////////////////////////
30 // Class : PointParticleRenderer
31 // Description : Simple point/point particle renderer. Does NOT
32 // handle billboards- use BillboardParticleRenderer
33 // for that.
34 ////////////////////////////////////////////////////////////////////
35 
36 class EXPCL_PANDAPHYSICS PointParticleRenderer : public BaseParticleRenderer {
37 PUBLISHED:
38  enum PointParticleBlendType {
39  PP_ONE_COLOR,
40  PP_BLEND_LIFE,
41  PP_BLEND_VEL
42  };
43 
45  PointParticleRenderer(ParticleRendererAlphaMode ad = PR_ALPHA_NONE,
46  PN_stdfloat point_size = 1.0f,
47  PointParticleBlendType bt = PP_ONE_COLOR,
48  ParticleRendererBlendMethod bm = PP_NO_BLEND,
49  const LColor& sc = LColor(1.0f, 1.0f, 1.0f, 1.0f),
50  const LColor& ec = LColor(1.0f, 1.0f, 1.0f, 1.0f));
51 
52  virtual ~PointParticleRenderer();
53 
54 public:
55  virtual BaseParticleRenderer *make_copy();
56 
57 PUBLISHED:
58  INLINE void set_point_size(PN_stdfloat point_size);
59  INLINE void set_start_color(const LColor& sc);
60  INLINE void set_end_color(const LColor& ec);
61  INLINE void set_blend_type(PointParticleBlendType bt);
62  INLINE void set_blend_method(ParticleRendererBlendMethod bm);
63 
64  INLINE PN_stdfloat get_point_size() const;
65  INLINE const LColor& get_start_color() const;
66  INLINE const LColor& get_end_color() const;
67  INLINE PointParticleBlendType get_blend_type() const;
68  INLINE ParticleRendererBlendMethod get_blend_method() const;
69 
70  virtual void output(ostream &out) const;
71  virtual void write(ostream &out, int indent_level = 0) const;
72 
73 private:
74  LColor _start_color;
75  LColor _end_color;
76  PN_stdfloat _point_size;
77  CPT(RenderAttrib) _thick;
78 
79  PT(Geom) _point_primitive;
80  PT(GeomPoints) _points;
81  PT(GeomVertexData) _vdata;
82 
83  int _max_pool_size;
84 
85  PointParticleBlendType _blend_type;
86  ParticleRendererBlendMethod _blend_method;
87 
88  LPoint3 _aabb_min;
89  LPoint3 _aabb_max;
90 
91  LColor create_color(const BaseParticle *p);
92 
93  virtual void birth_particle(int index);
94  virtual void kill_particle(int index);
95  virtual void init_geoms();
96  virtual void render(pvector< PT(PhysicsObject) >& po_vector,
97  int ttl_particles);
98  virtual void resize_pool(int new_size);
99 
100  static PStatCollector _render_collector;
101 };
102 
103 #include "pointParticleRenderer.I"
104 
105 #endif // POINTPARTICLERENDERER_H
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:60
Defines a series of disconnected points.
Definition: geomPoints.h:25
virtual void output(ostream &out) const
Write a string representation of this instance to &lt;out&gt;.
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
Simple point/point particle renderer.
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
An individual, physically-modelable particle abstract base class.
Definition: baseParticle.h:26
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to &lt;out&gt;.