14#ifndef OSGPARTICLE_PRECIPITATIONEFFECT
15#define OSGPARTICLE_PRECIPITATIONEFFECT
35 virtual const char*
libraryName()
const {
return "osgParticle"; }
36 virtual const char*
className()
const {
return "PrecipitationEffect"; }
46 void rain(
float intensity);
49 void snow(
float intensity);
129 Cell(
int in_i,
int in_j,
int in_k):
130 i(in_i),
j(in_j),
k(in_k) {}
132 inline bool operator < (
const Cell& rhs)
const
134 if (
i<rhs.
i)
return true;
135 if (
i>rhs.
i)
return false;
136 if (
j<rhs.
j)
return true;
137 if (
j>rhs.
j)
return false;
138 if (
k<rhs.
k)
return true;
139 if (
k>rhs.
k)
return false;
164 inline bool operator () (
const CellMatrixMap::value_type* lhs,
const CellMatrixMap::value_type* rhs)
const
166 return (*lhs).second<(*rhs).second;
Vec3f Vec3
Definition Vec3:21
Matrixd Matrix
Definition Matrix:27
Vec4f Vec4
Definition Vec4:21
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
Pure virtual base class for drawable geometry.
Definition Drawable:89
Fog - encapsulates OpenGL fog state.
Definition Fog:53
Base class for all internal nodes in the scene graph.
Definition Node:72
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
A Polytope class for representing convex clipping volumes made up of a set of planes.
Definition Polytope:26
A PrimitiveFunctor is used (in conjunction with osg::Drawable::accept (PrimitiveFunctor&)) to get acc...
Definition PrimitiveSet:54
Definition PrimitiveSet:103
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Stores a set of modes and attributes which represent a set of OpenGL state.
Definition StateSet:46
void compileGLObjects(osg::RenderInfo &renderInfo) const
virtual void releaseGLObjects(osg::State *state=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
const osg::Vec4 & getParticleColor() const
Definition PrecipitationEffect:70
osg::ref_ptr< osg::Uniform > _particleColorUniform
Definition PrecipitationEffect:237
void setMaximumParticleDensity(float density)
Definition PrecipitationEffect:51
osg::ref_ptr< osg::Geometry > _pointGeometry
Definition PrecipitationEffect:251
virtual ~PrecipitationEffect()
Definition PrecipitationEffect:198
osg::Vec3 _inverse_dw
Definition PrecipitationEffect:262
virtual const char * className() const
return the name of the node's class type.
Definition PrecipitationEffect:36
float _period
Definition PrecipitationEffect:255
osg::ref_ptr< osg::Geometry > _lineGeometry
Definition PrecipitationEffect:248
float getParticleSpeed() const
Definition PrecipitationEffect:64
void setFarTransition(float farTransition)
Definition PrecipitationEffect:75
virtual const char * libraryName() const
return the name of the node's library.
Definition PrecipitationEffect:35
osg::ref_ptr< osg::Uniform > _inversePeriodUniform
Definition PrecipitationEffect:235
bool _useFarLineSegments
Definition PrecipitationEffect:232
osg::Vec3 _wind
Definition PrecipitationEffect:224
float _farTransition
Definition PrecipitationEffect:231
osg::ref_ptr< osg::Uniform > _particleSizeUniform
Definition PrecipitationEffect:236
osg::Vec3 _dv
Definition PrecipitationEffect:258
void setParticleSpeed(float particleSpeed)
Definition PrecipitationEffect:63
void setUseFarLineSegments(bool useFarLineSegments)
Definition PrecipitationEffect:78
virtual bool isSameKindAs(const osg::Object *obj) const
return true if this and obj are of the same kind of object.
Definition PrecipitationEffect:37
float getMaximumParticleDensity() const
Definition PrecipitationEffect:52
osg::Vec3 _inverse_du
Definition PrecipitationEffect:260
osg::ref_ptr< osg::Fog > _fog
Definition PrecipitationEffect:233
osg::StateSet * getPointStateSet()
Definition PrecipitationEffect:92
osg::Vec4 _particleColor
Definition PrecipitationEffect:227
void setParticleSize(float particleSize)
Definition PrecipitationEffect:66
osg::ref_ptr< osg::StateSet > _pointStateSet
Definition PrecipitationEffect:252
float _particleSize
Definition PrecipitationEffect:226
void setWind(const osg::Vec3 &wind)
Definition PrecipitationEffect:54
osg::Geometry * getLineGeometry()
Definition PrecipitationEffect:88
float getParticleSize() const
Definition PrecipitationEffect:67
float _particleSpeed
Definition PrecipitationEffect:225
osg::Vec3 _origin
Definition PrecipitationEffect:256
void rain(float intensity)
Set all the parameters to create an rain effect of specified intensity.
void setNearTransition(float nearTransition)
Definition PrecipitationEffect:72
double _previousFrameTime
Definition PrecipitationEffect:264
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
void setCellSize(const osg::Vec3 &cellSize)
Definition PrecipitationEffect:60
osg::ref_ptr< osg::StateSet > _quadStateSet
Definition PrecipitationEffect:246
float _nearTransition
Definition PrecipitationEffect:230
ViewDrawableMap _viewDrawableMap
Definition PrecipitationEffect:243
osg::Vec3 _cellSize
Definition PrecipitationEffect:229
osg::ref_ptr< osg::StateSet > _lineStateSet
Definition PrecipitationEffect:249
virtual void accept(osg::NodeVisitor &nv)
Visitor Pattern : calls the apply method of a NodeVisitor with this node's type.
Definition PrecipitationEffect:38
OpenThreads::Mutex _mutex
Definition PrecipitationEffect:242
void setPosition(const osg::Vec3 &position)
Definition PrecipitationEffect:57
float getFarTransition() const
Definition PrecipitationEffect:76
osg::StateSet * getLineStateSet()
Definition PrecipitationEffect:89
osg::Fog * getFog()
Definition PrecipitationEffect:82
osg::Geometry * getQuadGeometry()
Definition PrecipitationEffect:85
const osg::Fog * getFog() const
Definition PrecipitationEffect:83
osg::Vec3 _dw
Definition PrecipitationEffect:259
virtual void traverse(osg::NodeVisitor &nv)
Traverse downwards : calls children's accept method with NodeVisitor.
std::pair< osg::NodeVisitor *, osg::NodePath > ViewIdentifier
Definition PrecipitationEffect:239
osg::Geometry * getPointGeometry()
Definition PrecipitationEffect:91
bool build(const osg::Vec3 eyeLocal, int i, int j, int k, float startTime, PrecipitationDrawableSet &pds, osg::Polytope &frustum, osgUtil::CullVisitor *cv) const
osg::Vec3 _inverse_dv
Definition PrecipitationEffect:261
osg::Vec3 _du
Definition PrecipitationEffect:257
void setFog(osg::Fog *fog)
Definition PrecipitationEffect:81
const osg::Vec3 & getWind() const
Definition PrecipitationEffect:55
PrecipitationEffect(const PrecipitationEffect ©, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
osg::StateSet * getQuadStateSet()
Definition PrecipitationEffect:86
const osg::Vec3 & getCellSize() const
Definition PrecipitationEffect:61
float _maximumParticleDensity
Definition PrecipitationEffect:228
std::map< ViewIdentifier, PrecipitationDrawableSet > ViewDrawableMap
Definition PrecipitationEffect:240
const osg::Vec3 & getPosition() const
Definition PrecipitationEffect:58
float getNearTransition() const
Definition PrecipitationEffect:73
void setUpGeometries(unsigned int numParticles)
void setParticleColor(const osg::Vec4 &color)
Definition PrecipitationEffect:69
bool _dirty
Definition PrecipitationEffect:223
void snow(float intensity)
Set all the parameters to create an snow effect of specified intensity.
osg::ref_ptr< osg::Geometry > _quadGeometry
Definition PrecipitationEffect:245
bool getUseFarLineSegments() const
Definition PrecipitationEffect:79
void cull(PrecipitationDrawableSet &pds, osgUtil::CullVisitor *cv) const
void createGeometry(unsigned int numParticles, osg::Geometry *quad_geometry, osg::Geometry *line_geometry, osg::Geometry *point_geometry)
virtual bool supports(const osg::PrimitiveIndexFunctor &) const
Return true if the Drawable subclass supports accept(PrimitiveIndexFunctor&).
Definition PrecipitationEffect:106
CellMatrixMap _currentCellMatrixMap
Definition PrecipitationEffect:188
unsigned int _numberOfVertices
Definition PrecipitationEffect:192
bool getRequiresPreviousMatrix() const
Definition PrecipitationEffect:110
GLenum _drawType
Definition PrecipitationEffect:191
PrecipitationDrawable(const PrecipitationDrawable ©, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
CellMatrixMap _previousCellMatrixMap
Definition PrecipitationEffect:189
std::map< Cell, DepthMatrixStartTime > CellMatrixMap
Definition PrecipitationEffect:160
CellMatrixMap & getPreviousCellMatrixMap()
Definition PrecipitationEffect:172
void setNumberOfVertices(unsigned int numVertices)
Definition PrecipitationEffect:119
unsigned int getNumberOfVertices() const
Definition PrecipitationEffect:120
osg::Geometry * getGeometry()
Definition PrecipitationEffect:113
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
virtual bool supports(const osg::PrimitiveFunctor &) const
Return true if the Drawable subclass supports accept(PrimitiveFunctor&).
Definition PrecipitationEffect:104
void newFrame()
Definition PrecipitationEffect:174
const osg::Geometry * getGeometry() const
Definition PrecipitationEffect:114
virtual ~PrecipitationDrawable()
META_Object(osgParticle, PrecipitationDrawable)
GLenum getDrawType() const
Definition PrecipitationEffect:117
void setGeometry(osg::Geometry *geom)
Definition PrecipitationEffect:112
void setDrawType(GLenum type)
Definition PrecipitationEffect:116
virtual void accept(osg::PrimitiveIndexFunctor &) const
Accept a PrimitiveIndexFunctor and call its methods to tell it about the internal primitives that thi...
Definition PrecipitationEffect:107
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL draw...
bool _requiresPreviousMatrix
Definition PrecipitationEffect:184
osg::ref_ptr< osg::Geometry > _geometry
Definition PrecipitationEffect:186
virtual void accept(osg::PrimitiveFunctor &) const
Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Dra...
Definition PrecipitationEffect:105
virtual void releaseGLObjects(osg::State *state) const
If State is non-zero, this function releases OpenGL objects for the specified graphics context.
CellMatrixMap & getCurrentCellMatrixMap()
Definition PrecipitationEffect:171
void setRequiresPreviousMatrix(bool flag)
Definition PrecipitationEffect:109
int j
Definition PrecipitationEffect:144
int i
Definition PrecipitationEffect:143
Cell(int in_i, int in_j, int in_k)
Definition PrecipitationEffect:129
int k
Definition PrecipitationEffect:145
Definition PrecipitationEffect:149
float startTime
Definition PrecipitationEffect:156
osg::Matrix modelview
Definition PrecipitationEffect:157
float depth
Definition PrecipitationEffect:155
Definition PrecipitationEffect:163
Definition PrecipitationEffect:213
osg::ref_ptr< PrecipitationDrawable > _linePrecipitationDrawable
Definition PrecipitationEffect:215
osg::ref_ptr< PrecipitationDrawable > _pointPrecipitationDrawable
Definition PrecipitationEffect:216
osg::ref_ptr< PrecipitationDrawable > _quadPrecipitationDrawable
Definition PrecipitationEffect:214
Basic NodeVisitor implementation for rendering a scene.
Definition CullVisitor:49
#define OSGPARTICLE_EXPORT
Definition Export:40