OpenSceneGraph 3.6.5
Emitter
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13//osgParticle - Copyright (C) 2002 Marco Jez
14
15#ifndef OSGPARTICLE_EMITTER
16#define OSGPARTICLE_EMITTER 1
17
18#include <osgParticle/Export>
20#include <osgParticle/Particle>
21
22#include <osg/Object>
23#include <osg/Node>
24#include <osg/NodeVisitor>
25#include <osg/CopyOp>
26
27namespace osgParticle
28{
29
36 public:
39
40 virtual const char* libraryName() const { return "osgParticle"; }
41 virtual const char* className() const { return "Emitter"; }
42 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Emitter*>(obj) != 0; }
43 virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
44
46
49
50
52 inline const Particle& getParticleTemplate() const;
53
55 inline void setParticleTemplate(const Particle& p);
56
58 inline bool getUseDefaultTemplate() const;
59
64 inline void setUseDefaultTemplate(bool v);
65
66 protected:
67 virtual ~Emitter() {}
68 Emitter& operator=(const Emitter&) { return *this; }
69
70 inline void process(double dt);
71
72 virtual void emitParticles(double dt) = 0;
73
76
78 };
79
80 // INLINE FUNCTIONS
81
83 {
84 return _ptemp;
85 }
86
88 {
89 _ptemp = p;
90 _usedeftemp = false;
91 }
92
94 {
95 return _usedeftemp;
96 }
97
99 {
100 _usedeftemp = v;
101 }
102
103 inline void Emitter::process(double dt)
104 {
105 emitParticles(dt);
106 }
107
108
109}
110
111
112#endif
113
The osgParticle library is a NodeKit that extends the core scene graph to support particle effects.
Definition AccelOperator:27
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
virtual void apply(Drawable &drawable)
void pushOntoNodePath(Node *node)
Method called by osg::Node::accept() method before a call to the NodeVisitor::apply(....
Definition NodeVisitor:287
bool validNodeMask(const osg::Node &node) const
Method to called by Node and its subclass' Node::accept() method, if the result is true it is used to...
Definition NodeVisitor:221
void popFromNodePath()
Method called by osg::Node::accept() method after a call to NodeVisitor::apply(..).
Definition NodeVisitor:293
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
int _estimatedMaxNumOfParticles
Definition Emitter:77
virtual void accept(osg::NodeVisitor &nv)
Visitor Pattern : calls the apply method of a NodeVisitor with this node's type.
Definition Emitter:43
bool _usedeftemp
Definition Emitter:74
int getEstimatedMaxNumOfParticles() const
Definition Emitter:48
void setParticleTemplate(const Particle &p)
Set the particle template (particle is copied).
Definition Emitter:87
virtual ~Emitter()
Definition Emitter:67
virtual bool isSameKindAs(const osg::Object *obj) const
return true if this and obj are of the same kind of object.
Definition Emitter:42
virtual void emitParticles(double dt)=0
Emitter(const Emitter &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Particle _ptemp
Definition Emitter:75
const Particle & getParticleTemplate() const
Get the particle template.
Definition Emitter:82
void setParticleSystem(ParticleSystem *ps)
Set the destination particle system.
virtual const char * libraryName() const
return the name of the node's library.
Definition Emitter:40
void process(double dt)
Definition Emitter:103
Emitter & operator=(const Emitter &)
Definition Emitter:68
void setEstimatedMaxNumOfParticles(int num)
bool getUseDefaultTemplate() const
Return whether the particle system's default template should be used.
Definition Emitter:93
virtual const char * className() const
return the name of the node's class type.
Definition Emitter:41
void setUseDefaultTemplate(bool v)
Set whether the default particle template should be used.
Definition Emitter:98
Implementation of a particle.
Definition Particle:47
The heart of this class library; its purpose is to hold a set of particles and manage particle creati...
Definition ParticleSystem:54
#define OSGPARTICLE_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.