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);
51 void setMaximumParticleDensity(
float density) {
if (_maximumParticleDensity==density)
return; _maximumParticleDensity = density; _dirty =
true;}
60 void setCellSize(
const osg::Vec3& cellSize) {
if (_cellSize==cellSize)
return; _cellSize = cellSize; _dirty =
true; }
63 void setParticleSpeed(
float particleSpeed) {
if (_particleSpeed==particleSpeed)
return; _particleSpeed = particleSpeed; _dirty =
true; }
66 void setParticleSize(
float particleSize) {
if (_particleSize==particleSize)
return; _particleSize = particleSize; _dirty =
true;}
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;
152 return depth < rhs.
depth;
164 inline bool operator () (
const CellMatrixMap::value_type* lhs,
const CellMatrixMap::value_type* rhs)
const
166 return (*lhs).second<(*rhs).second;
176 _previousCellMatrixMap.swap(_currentCellMatrixMap);
177 _currentCellMatrixMap.clear();
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
Definition PrecipitationEffect:96
virtual bool supports(const osg::PrimitiveIndexFunctor &) const
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)
virtual bool supports(const osg::PrimitiveFunctor &) const
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
Definition PrecipitationEffect:107
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
bool _requiresPreviousMatrix
Definition PrecipitationEffect:184
osg::ref_ptr< osg::Geometry > _geometry
Definition PrecipitationEffect:186
virtual void accept(osg::PrimitiveFunctor &) const
Definition PrecipitationEffect:105
virtual void releaseGLObjects(osg::State *state) const
CellMatrixMap & getCurrentCellMatrixMap()
Definition PrecipitationEffect:171
void setRequiresPreviousMatrix(bool flag)
Definition PrecipitationEffect:109
Definition PrecipitationEffect:29
void compileGLObjects(osg::RenderInfo &renderInfo) const
virtual void releaseGLObjects(osg::State *state=0) const
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
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
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
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)
void setNearTransition(float nearTransition)
Definition PrecipitationEffect:72
double _previousFrameTime
Definition PrecipitationEffect:264
virtual void resizeGLObjectBuffers(unsigned int maxSize)
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)
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)
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)
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)
Definition CullVisitor:49
@ SHALLOW_COPY
Definition CopyOp:47
Definition NodeVisitor:82
virtual void apply(Drawable &drawable)
void pushOntoNodePath(Node *node)
Definition NodeVisitor:287
bool validNodeMask(const osg::Node &node) const
Definition NodeVisitor:221
void popFromNodePath()
Definition NodeVisitor:293
Definition PrimitiveSet:54
Definition PrimitiveSet:103
Definition AccelOperator:27
#define OSGPARTICLE_EXPORT
Definition osgParticle/Export:40
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
Definition PrecipitationEffect:128
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