Panda3D
baseParticleRenderer.I
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 baseParticleRenderer.I
10  * @author charles
11  * @date 2000-06-20
12  */
13 
14 /**
15  * Query the geomnode pointer
16  */
18 get_render_node() const {
19  return _render_node;
20 }
21 
22 /**
23  * Query the geomnode pointer
24  */
27  return _render_node_path;
28 }
29 
30 /**
31 
32  */
33 INLINE void BaseParticleRenderer::
34 set_alpha_mode(BaseParticleRenderer::ParticleRendererAlphaMode am) {
35  update_alpha_mode(am);
36  init_geoms();
37 }
38 
39 /**
40 
41  */
42 INLINE BaseParticleRenderer::ParticleRendererAlphaMode BaseParticleRenderer::
43 get_alpha_mode() const {
44  return _alpha_mode;
45 }
46 
47 /**
48  * sets alpha for "user" alpha mode
49  */
50 INLINE void BaseParticleRenderer::
51 set_user_alpha(PN_stdfloat ua) {
52  _user_alpha = ua;
53 }
54 
55 /**
56  * gets alpha for "user" alpha mode
57  */
58 INLINE PN_stdfloat BaseParticleRenderer::
59 get_user_alpha() const {
60  return _user_alpha;
61 }
62 
63 /**
64  * sets the ColorBlendAttrib on the _render_node
65  */
66 INLINE void BaseParticleRenderer::
67 set_color_blend_mode(ColorBlendAttrib::Mode bm, ColorBlendAttrib::Operand oa, ColorBlendAttrib::Operand ob) {
68  CPT(RenderAttrib) ra;
69  if(bm == ColorBlendAttrib::M_add || bm == ColorBlendAttrib::M_subtract || bm == ColorBlendAttrib::M_inv_subtract) {
70  ra = ColorBlendAttrib::make(bm,oa,ob);
71  } else {
72  ra = ColorBlendAttrib::make(bm);
73  }
74 
75  _render_node->set_attrib(ra);
76  return;
77 }
78 
79 /**
80  * Returns the "ignore scale" flag. See set_ignore_scale().
81  */
82 INLINE bool BaseParticleRenderer::
84  return _ignore_scale;
85 }
86 
87 /**
88  * gets current alpha for a particle
89  */
90 INLINE PN_stdfloat BaseParticleRenderer::
91 get_cur_alpha(BaseParticle* bp) {
92  switch(_alpha_mode) {
93  case PR_ALPHA_OUT:
94  return 1.0f - bp->get_parameterized_age();
95 
96  case PR_ALPHA_IN:
97  return bp->get_parameterized_age();
98 
99  case PR_ALPHA_IN_OUT:
100  return 2.0 * std::min(bp->get_parameterized_age(),
101  1.0f - bp->get_parameterized_age());
102 
103  case PR_ALPHA_USER:
104  return _user_alpha;
105 
106  default:
107  return 1.0; // should not get here
108  }
109 }
GeomNode * get_render_node() const
Query the geomnode pointer.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:51
void set_color_blend_mode(ColorBlendAttrib::Mode bm, ColorBlendAttrib::Operand oa=ColorBlendAttrib::O_zero, ColorBlendAttrib::Operand ob=ColorBlendAttrib::O_zero)
sets the ColorBlendAttrib on the _render_node
void set_user_alpha(PN_stdfloat ua)
sets alpha for "user" alpha mode
bool get_ignore_scale() const
Returns the "ignore scale" flag.
PN_stdfloat get_user_alpha() const
gets alpha for "user" alpha mode
An individual, physically-modelable particle abstract base class.
Definition: baseParticle.h:23
NodePath get_render_node_path() const
Query the geomnode pointer.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
A node that holds Geom objects, renderable pieces of geometry.
Definition: geomNode.h:34