15 #include "pandabase.h" 17 #include "baseParticleRenderer.h" 18 #include "transparencyAttrib.h" 19 #include "colorAttrib.h" 20 #include "compassEffect.h" 27 BaseParticleRenderer::
28 BaseParticleRenderer(ParticleRendererAlphaMode alpha_mode) :
29 _alpha_mode(PR_NOT_INITIALIZED_YET) {
30 _render_node =
new GeomNode(
"BaseParticleRenderer render node");
31 _render_node_path =
NodePath(_render_node);
34 _ignore_scale =
false;
36 update_alpha_mode(alpha_mode);
44 BaseParticleRenderer::
46 _alpha_mode(PR_ALPHA_NONE) {
47 _render_node =
new GeomNode(
"BaseParticleRenderer render node");
48 _render_node_path =
NodePath(_render_node);
50 _user_alpha = copy._user_alpha;
53 update_alpha_mode(copy._alpha_mode);
80 _ignore_scale = ignore_scale;
83 _render_node->set_effect(CompassEffect::make(
NodePath(), CompassEffect::P_scale));
85 _render_node->clear_effect(CompassEffect::get_class_type());
98 out<<
"BaseParticleRenderer";
109 write(ostream &out,
int indent)
const {
111 out.width(indent); out<<
""; out<<
"BaseParticleRenderer:\n";
112 out.width(indent+2); out<<
""; out<<
"_render_node "<<_render_node_path<<
"\n";
113 out.width(indent+2); out<<
""; out<<
"_user_alpha "<<_user_alpha<<
"\n";
123 void BaseParticleRenderer::
124 update_alpha_mode(ParticleRendererAlphaMode am) {
125 if (_alpha_mode == am)
128 if ((am == PR_ALPHA_NONE) && (_alpha_mode != PR_ALPHA_NONE))
130 else if ((am != PR_ALPHA_NONE) && (_alpha_mode == PR_ALPHA_NONE))
142 void BaseParticleRenderer::
144 _render_state = RenderState::make(TransparencyAttrib::make(TransparencyAttrib::M_alpha),
145 ColorAttrib::make_vertex());
153 void BaseParticleRenderer::
155 _render_state = RenderState::make(TransparencyAttrib::make(TransparencyAttrib::M_none),
156 ColorAttrib::make_vertex());
virtual ~BaseParticleRenderer()
Destructor.
Pure virtual particle renderer base class.
void set_ignore_scale(bool ignore_scale)
Sets the "ignore scale" flag.
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
A node that holds Geom objects, renderable pieces of geometry.