Panda3D
pointParticleRenderer.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 pointParticleRenderer.h
10  * @author charles
11  * @date 2000-06-20
12  */
13 
14 #ifndef POINTPARTICLERENDERER_H
15 #define POINTPARTICLERENDERER_H
16 
17 #include "baseParticleRenderer.h"
18 #include "baseParticle.h"
19 #include "renderModeAttrib.h"
20 #include "pointerTo.h"
21 #include "pointerToArray.h"
22 #include "luse.h"
23 #include "geom.h"
24 #include "geomVertexData.h"
25 #include "geomPoints.h"
26 #include "pStatCollector.h"
27 
28 /**
29  * Simple point/point particle renderer. Does NOT handle billboards- use
30  * BillboardParticleRenderer for that.
31  */
32 
33 class EXPCL_PANDA_PARTICLESYSTEM PointParticleRenderer : public BaseParticleRenderer {
34 PUBLISHED:
35  enum PointParticleBlendType {
36  PP_ONE_COLOR,
37  PP_BLEND_LIFE,
38  PP_BLEND_VEL
39  };
40 
42  explicit PointParticleRenderer(ParticleRendererAlphaMode ad = PR_ALPHA_NONE,
43  PN_stdfloat point_size = 1.0f,
44  PointParticleBlendType bt = PP_ONE_COLOR,
45  ParticleRendererBlendMethod bm = PP_NO_BLEND,
46  const LColor& sc = LColor(1.0f, 1.0f, 1.0f, 1.0f),
47  const LColor& ec = LColor(1.0f, 1.0f, 1.0f, 1.0f));
48 
49  virtual ~PointParticleRenderer();
50 
51 public:
52  virtual BaseParticleRenderer *make_copy();
53 
54 PUBLISHED:
55  INLINE void set_point_size(PN_stdfloat point_size);
56  INLINE void set_start_color(const LColor& sc);
57  INLINE void set_end_color(const LColor& ec);
58  INLINE void set_blend_type(PointParticleBlendType bt);
59  INLINE void set_blend_method(ParticleRendererBlendMethod bm);
60 
61  INLINE PN_stdfloat get_point_size() const;
62  INLINE const LColor& get_start_color() const;
63  INLINE const LColor& get_end_color() const;
64  INLINE PointParticleBlendType get_blend_type() const;
65  INLINE ParticleRendererBlendMethod get_blend_method() const;
66 
67  virtual void output(std::ostream &out) const;
68  virtual void write(std::ostream &out, int indent_level = 0) const;
69 
70 private:
71  LColor _start_color;
72  LColor _end_color;
73  PN_stdfloat _point_size;
74  CPT(RenderAttrib) _thick;
75 
76  PT(Geom) _point_primitive;
77  PT(GeomPoints) _points;
78  PT(GeomVertexData) _vdata;
79 
80  int _max_pool_size;
81 
82  PointParticleBlendType _blend_type;
83  ParticleRendererBlendMethod _blend_method;
84 
85  LPoint3 _aabb_min;
86  LPoint3 _aabb_max;
87 
88  LColor create_color(const BaseParticle *p);
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 "pointParticleRenderer.I"
101 
102 #endif // POINTPARTICLERENDERER_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:51
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Defines a series of disconnected points.
Definition: geomPoints.h:23
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>.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
Simple point/point particle renderer.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.