Ran script to remove trailing spaces and tabs

This commit is contained in:
Robert Osfield
2012-03-21 17:36:20 +00:00
parent 1e35f8975d
commit 14a563dc9f
1495 changed files with 21873 additions and 21873 deletions

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -37,24 +37,24 @@ namespace osgParticle
/// Get the acceleration vector.
inline const osg::Vec3& getAcceleration() const;
/// Set the acceleration vector.
inline void setAcceleration(const osg::Vec3& v);
/** Quickly set the acceleration vector to the gravity on earth (0, 0, -9.81).
The acceleration will be multiplied by the <CODE>scale</CODE> parameter.
*/
inline void setToGravity(float scale = 1);
/// Apply the acceleration to a particle. Do not call this method manually.
inline void operate(Particle* P, double dt);
/// Perform some initializations. Do not call this method manually.
inline void beginOperate(Program *prg);
protected:
virtual ~AccelOperator() {}
AccelOperator &operator=(const AccelOperator &) { return *this; }
AccelOperator &operator=(const AccelOperator &) { return *this; }
private:
osg::Vec3 _accel;
@@ -62,12 +62,12 @@ namespace osgParticle
};
// INLINE FUNCTIONS
inline AccelOperator::AccelOperator()
: Operator(), _accel(0, 0, 0)
{
}
inline AccelOperator::AccelOperator(const AccelOperator& copy, const osg::CopyOp& copyop)
: Operator(copy, copyop), _accel(copy._accel)
{
@@ -82,7 +82,7 @@ namespace osgParticle
{
_accel = v;
}
inline void AccelOperator::setToGravity(float scale)
{
_accel.set(0, 0, -9.80665f * scale);
@@ -92,7 +92,7 @@ namespace osgParticle
{
P->addVelocity(_xf_accel * dt);
}
inline void AccelOperator::beginOperate(Program *prg)
{
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) {

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -26,7 +26,7 @@
namespace osgParticle
{
/** An operator class that applies a constant angular acceleration to
/** An operator class that applies a constant angular acceleration to
* the particles.
*/
class AngularAccelOperator: public Operator {
@@ -38,19 +38,19 @@ namespace osgParticle
/// Get the angular acceleration vector.
inline const osg::Vec3& getAngularAcceleration() const;
/// Set the angular acceleration vector.
inline void setAngularAcceleration(const osg::Vec3& v);
/// Apply the angular acceleration to a particle. Do not call this method manually.
inline void operate(Particle* P, double dt);
/// Perform some initializations. Do not call this method manually.
inline void beginOperate(Program *prg);
protected:
virtual ~AngularAccelOperator() {}
AngularAccelOperator& operator=(const AngularAccelOperator& ) { return *this; }
AngularAccelOperator& operator=(const AngularAccelOperator& ) { return *this; }
private:
osg::Vec3 _angul_araccel;
@@ -58,12 +58,12 @@ namespace osgParticle
};
// INLINE FUNCTIONS
inline AngularAccelOperator::AngularAccelOperator()
: Operator(), _angul_araccel(0, 0, 0)
{
}
inline AngularAccelOperator::AngularAccelOperator(const AngularAccelOperator& copy, const osg::CopyOp& copyop)
: Operator(copy, copyop), _angul_araccel(copy._angul_araccel)
{
@@ -83,7 +83,7 @@ namespace osgParticle
{
P->addAngularVelocity(_xf_angul_araccel * dt);
}
inline void AngularAccelOperator::beginOperate(Program *prg)
{
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) {

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
@@ -30,44 +30,44 @@ class AngularDampingOperator : public Operator
public:
AngularDampingOperator() : Operator(), _cutoffLow(0.0f), _cutoffHigh(FLT_MAX)
{}
AngularDampingOperator( const AngularDampingOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY )
: Operator(copy, copyop), _damping(copy._damping),
_cutoffLow(copy._cutoffLow), _cutoffHigh(copy._cutoffHigh)
{}
META_Object( osgParticle, AngularDampingOperator );
/// Set the damping factors
void setDamping( float x, float y, float z ) { _damping.set(x, y, z); }
void setDamping( const osg::Vec3& damping ) { _damping = damping; }
/// Set the damping factors to one value
void setDamping( float x ) { _damping.set(x, x, x); }
/// Get the damping factors
void getDamping( float& x, float& y, float& z ) const
{ x = _damping.x(); y = _damping.y(); z = _damping.z(); }
const osg::Vec3& getDamping() const { return _damping; }
/// Set the velocity cutoff factors
void setCutoff( float low, float high ) { _cutoffLow = low; _cutoffHigh = high; }
void setCutoffLow( float low ) { _cutoffLow = low; }
void setCutoffHigh( float low ) { _cutoffHigh = low; }
/// Get the velocity cutoff factors
void getCutoff( float& low, float& high ) const { low = _cutoffLow; high = _cutoffHigh; }
float getCutoffLow() const { return _cutoffLow; }
float getCutoffHigh() const { return _cutoffHigh; }
/// Apply the acceleration to a particle. Do not call this method manually.
inline void operate( Particle* P, double dt );
protected:
virtual ~AngularDampingOperator() {}
AngularDampingOperator& operator=( const AngularDampingOperator& ) { return *this; }
osg::Vec3 _damping;
float _cutoffLow;
float _cutoffHigh;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
@@ -31,42 +31,42 @@ public:
BounceOperator()
: DomainOperator(), _friction(1.0f), _resilience(0.0f), _cutoff(0.0f)
{}
BounceOperator( const BounceOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY )
: DomainOperator(copy, copyop),
_friction(copy._friction), _resilience(copy._resilience), _cutoff(copy._cutoff)
{}
META_Object( osgParticle, BounceOperator );
/// Set the friction
void setFriction( float f ) { _friction = f; }
/// Get the friction
float getFriction() const { return _friction; }
/// Set the resilience
void setResilience( float r ) { _resilience = r; }
/// Get the velocity cutoff factor
float getResilience() const { return _resilience; }
/// Set the velocity cutoff factor
void setCutoff( float v ) { _cutoff = v; }
/// Get the velocity cutoff factor
float getCutoff() const { return _cutoff; }
protected:
virtual ~BounceOperator() {}
BounceOperator& operator=( const BounceOperator& ) { return *this; }
virtual void handleTriangle( const Domain& domain, Particle* P, double dt );
virtual void handleRectangle( const Domain& domain, Particle* P, double dt );
virtual void handlePlane( const Domain& domain, Particle* P, double dt );
virtual void handleSphere( const Domain& domain, Particle* P, double dt );
virtual void handleDisk( const Domain& domain, Particle* P, double dt );
float _friction;
float _resilience;
float _cutoff;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//Build by Zach Deedler
@@ -28,48 +28,48 @@ namespace osgParticle
{
/** A box-shaped particle placer.
This placer sets the initial position of incoming particle by choosing a random position
within the volume of a box; this placer is defined by four parameters: a <I>center point</I>,
which is inherited directly from <CODE>osgParticle::CenteredPlacer</CODE>, and three ranges of values
This placer sets the initial position of incoming particle by choosing a random position
within the volume of a box; this placer is defined by four parameters: a <I>center point</I>,
which is inherited directly from <CODE>osgParticle::CenteredPlacer</CODE>, and three ranges of values
for the valid <I>X</I>, <I>Y</I>, and <I>Z</I> coordinates.
*/
class BoxPlacer: public CenteredPlacer {
public:
inline BoxPlacer();
inline BoxPlacer(const BoxPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
/// Get the range of possible values along the X axis.
inline const rangef& getXRange() const;
/// Set the range of possible values along the X axis.
inline void setXRange(const rangef& r);
/// Set the range of possible values along the X axis.
inline void setXRange(float r1, float r2);
/// Get the range of possible values along the Y axis.
inline const rangef& getYRange() const;
inline const rangef& getYRange() const;
/// Set the range of possible values along the Y axis.
inline void setYRange(const rangef& r);
/// Set the range of possible values along the Y axis.
inline void setYRange(float r1, float r2);
inline void setYRange(float r1, float r2);
/// Get the range of possible values along the Z axis.
inline const rangef& getZRange() const;
inline const rangef& getZRange() const;
/// Set the range of possible values along the Z axis.
inline void setZRange(const rangef& r);
/// Set the range of possible values along the Z axis.
inline void setZRange(float r1, float r2);
inline void setZRange(float r1, float r2);
META_Object(osgParticle, BoxPlacer);
/// Place a particle. Do not call it manually.
inline void place(Particle* P) const;
/// return the volume of the box
inline float volume() const;
@@ -78,8 +78,8 @@ namespace osgParticle
protected:
virtual ~BoxPlacer() {}
BoxPlacer& operator=(const BoxPlacer&) { return *this; }
BoxPlacer& operator=(const BoxPlacer&) { return *this; }
private:
rangef _x_range;
rangef _y_range;
@@ -87,18 +87,18 @@ namespace osgParticle
};
// INLINE FUNCTIONS
inline BoxPlacer::BoxPlacer()
: CenteredPlacer(), _x_range(-1, 1), _y_range(-1, 1), _z_range(-1, 1)
{
}
inline BoxPlacer::BoxPlacer(const BoxPlacer& copy, const osg::CopyOp& copyop)
: CenteredPlacer(copy, copyop),
: CenteredPlacer(copy, copyop),
_x_range(copy._x_range), _y_range(copy._y_range), _z_range(copy._z_range)
{
}
inline const rangef& BoxPlacer::getXRange() const
{
return _x_range;
@@ -108,7 +108,7 @@ namespace osgParticle
{
_x_range = r;
}
inline void BoxPlacer::setXRange(float r1, float r2)
{
_x_range.minimum = r1;
@@ -119,12 +119,12 @@ namespace osgParticle
{
return _y_range;
}
inline void BoxPlacer::setYRange(const rangef& r)
{
_y_range = r;
}
inline void BoxPlacer::setYRange(float r1, float r2)
{
_y_range.minimum = r1;
@@ -140,7 +140,7 @@ namespace osgParticle
{
_z_range = r;
}
inline void BoxPlacer::setZRange(float r1, float r2)
{
_z_range.minimum = r1;
@@ -150,13 +150,13 @@ namespace osgParticle
inline void BoxPlacer::place(Particle* P) const
{
osg::Vec3 pos(
getCenter().x() + _x_range.get_random(),
getCenter().y() + _y_range.get_random(),
getCenter().x() + _x_range.get_random(),
getCenter().y() + _y_range.get_random(),
getCenter().z() + _z_range.get_random());
P->setPosition(pos);
}
inline float BoxPlacer::volume() const
{
return (_x_range.maximum - _x_range.minimum) *

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -30,49 +30,49 @@ namespace osgParticle
public:
inline CenteredPlacer();
inline CenteredPlacer(const CenteredPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual const char* libraryName() const { return "osgParticle"; }
virtual const char* className() const { return "CenteredPlacer"; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Placer* >(obj) != 0; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Placer* >(obj) != 0; }
/// Get the center point.
inline const osg::Vec3& getCenter() const;
/// Set the center point.
inline void setCenter(const osg::Vec3& v);
/// Set the center point.
inline void setCenter(float x, float y, float z);
protected:
virtual ~CenteredPlacer() {}
private:
osg::Vec3 center_;
};
// INLINE FUNCTIONS
inline CenteredPlacer::CenteredPlacer()
: Placer(), center_(0, 0, 0)
{
}
inline CenteredPlacer::CenteredPlacer(const CenteredPlacer& copy, const osg::CopyOp& copyop)
: Placer(copy, copyop), center_(copy.center_)
{
}
inline const osg::Vec3& CenteredPlacer::getCenter() const
{
return center_;
}
inline void CenteredPlacer::setCenter(const osg::Vec3& v)
{
center_ = v;
}
inline void CenteredPlacer::setCenter(float x, float y, float z)
{
center_.set(x, y, z);

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
@@ -27,46 +27,46 @@ class CompositePlacer : public Placer
{
public:
CompositePlacer() : Placer() {}
CompositePlacer( const CompositePlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY )
: Placer(copy, copyop), _placers(copy._placers) {}
META_Object( osgParticle, CompositePlacer );
// Set a child placer at specific index
void setPlacer( unsigned int i, Placer* p )
{
if (i<_placers.size()) _placers[i] = p;
else addPlacer(p);
}
/// Add a child placer
void addPlacer( Placer* p ) { _placers.push_back(p); }
/// Remove a child placer
void removePlacer( unsigned int i )
{ if (i<_placers.size()) _placers.erase(_placers.begin()+i); }
/// Get a child placer
Placer* getPlacer( unsigned int i ) { return _placers[i].get(); }
const Placer* getPlacer( unsigned int i ) const { return _placers[i].get(); }
/// Get number of placers
unsigned int getNumPlacers() const { return _placers.size(); }
/// Place a particle. Do not call it manually.
inline void place( Particle* P ) const;
/// return the volume of the box
inline float volume() const;
/// return the control position
inline osg::Vec3 getControlPosition() const;
protected:
virtual ~CompositePlacer() {}
CompositePlacer& operator=( const CompositePlacer& ) { return *this; }
typedef std::vector< osg::ref_ptr<Placer> > PlacerList;
PlacerList _placers;
};

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -19,57 +19,57 @@
namespace osgParticle
{
/** ConnectConnectedParticleSystem is a specialise ConnectedParticleSystem for effects
/** ConnectConnectedParticleSystem is a specialise ConnectedParticleSystem for effects
* like missle trails, where the individual particles are rendered as
* single ribbon.
* single ribbon.
*/
class OSGPARTICLE_EXPORT ConnectedParticleSystem: public osgParticle::ParticleSystem
{
public:
ConnectedParticleSystem();
ConnectedParticleSystem(const ConnectedParticleSystem& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Object(osgParticle, ConnectedParticleSystem);
/// Create a new particle from the specified template (or the default one if <CODE>ptemplate</CODE> is null).
virtual Particle* createParticle(const Particle* ptemplate);
/// Reuse the i-th particle.
virtual void reuseParticle(int i);
/// Draw the connected particles as either a line or a quad strip, depending upon viewing distance. .
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
///Get the (const) particle from where the line or quadstrip starts to be drawn
const osgParticle::Particle* getStartParticle() const
{
return (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0;
}
///Get the particle from where the line or quadstrip starts to be drawn
osgParticle::Particle* getStartParticle()
{
return (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0;
}
///Set the maximum numbers of particles to be skipped during the predraw filtering
void setMaxNumberOfParticlesToSkip(unsigned int maxNumberofParticlesToSkip){_maxNumberOfParticlesToSkip = maxNumberofParticlesToSkip;}
///Get the maximum numbers of particles to be skipped during the predraw filtering
unsigned int getMaxNumberOfParticlesToSkip(){ return _maxNumberOfParticlesToSkip;}
protected:
virtual ~ConnectedParticleSystem();
ConnectedParticleSystem& operator=(const ConnectedParticleSystem&) { return *this; }
int _lastParticleCreated;
unsigned int _maxNumberOfParticlesToSkip;
int _startParticle;
};

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -25,7 +25,7 @@ namespace osgParticle
class ConstantRateCounter: public Counter {
public:
ConstantRateCounter():
Counter(),
Counter(),
_minimumNumberOfParticlesToCreate(0),
_numberOfParticlesPerSecondToCreate(0),
_carryOver(0)
@@ -33,19 +33,19 @@ namespace osgParticle
}
ConstantRateCounter(const ConstantRateCounter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
Counter(copy, copyop),
Counter(copy, copyop),
_minimumNumberOfParticlesToCreate(copy._minimumNumberOfParticlesToCreate),
_numberOfParticlesPerSecondToCreate(copy._numberOfParticlesPerSecondToCreate),
_carryOver(copy._carryOver)
{
}
META_Object(osgParticle, ConstantRateCounter);
void setMinimumNumberOfParticlesToCreate(int minNumToCreate) { _minimumNumberOfParticlesToCreate = minNumToCreate; }
int getMinimumNumberOfParticlesToCreate() const { return _minimumNumberOfParticlesToCreate; }
void setNumberOfParticlesPerSecondToCreate(double numPerSecond) { _numberOfParticlesPerSecondToCreate = numPerSecond; }
double getNumberOfParticlesPerSecondToCreate() const { return _numberOfParticlesPerSecondToCreate; }
@@ -62,15 +62,15 @@ namespace osgParticle
}
return osg::maximum(_minimumNumberOfParticlesToCreate, i);
}
protected:
virtual ~ConstantRateCounter() {}
int _minimumNumberOfParticlesToCreate;
double _numberOfParticlesPerSecondToCreate;
mutable double _carryOver;
};
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -36,14 +36,14 @@ namespace osgParticle
~Counter() {}
Counter &operator=(const Counter &) { return *this; }
};
// INLINE FUNCTIONS
inline Counter::Counter()
: osg::Object()
{
}
inline Counter::Counter(const Counter& copy, const osg::CopyOp& copyop)
: osg::Object(copy, copyop)
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
@@ -30,44 +30,44 @@ class DampingOperator : public Operator
public:
DampingOperator() : Operator(), _cutoffLow(0.0f), _cutoffHigh(FLT_MAX)
{ _damping.set(1.0f, 1.0f, 1.0f); }
DampingOperator( const DampingOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY )
: Operator(copy, copyop), _damping(copy._damping),
_cutoffLow(copy._cutoffLow), _cutoffHigh(copy._cutoffHigh)
{}
META_Object( osgParticle, DampingOperator );
/// Set the damping factors
void setDamping( float x, float y, float z ) { _damping.set(x, y, z); }
void setDamping( const osg::Vec3& damping ) { _damping = damping; }
/// Set the damping factors to one value
void setDamping( float x ) { _damping.set(x, x, x); }
/// Get the damping factors
void getDamping( float& x, float& y, float& z ) const
{ x = _damping.x(); y = _damping.y(); z = _damping.z(); }
const osg::Vec3& getDamping() const { return _damping; }
/// Set the velocity cutoff factors
void setCutoff( float low, float high ) { _cutoffLow = low; _cutoffHigh = high; }
void setCutoffLow( float low ) { _cutoffLow = low; }
void setCutoffHigh( float low ) { _cutoffHigh = low; }
/// Get the velocity cutoff factors
void getCutoff( float& low, float& high ) const { low = _cutoffLow; high = _cutoffHigh; }
float getCutoffLow() const { return _cutoffLow; }
float getCutoffHigh() const { return _cutoffHigh; }
/// Apply the acceleration to a particle. Do not call this method manually.
inline void operate( Particle* P, double dt );
protected:
virtual ~DampingOperator() {}
DampingOperator& operator=( const DampingOperator& ) { return *this; }
osg::Vec3 _damping;
float _cutoffLow;
float _cutoffHigh;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
@@ -44,7 +44,7 @@ public:
BOX_DOMAIN,
DISK_DOMAIN
};
Domain( Type t ) : r1(0.0f), r2(0.0f), type(t) {}
osg::Plane plane;
osg::Vec3 v1;
@@ -56,70 +56,70 @@ public:
float r2;
Type type;
};
DomainOperator()
: Operator()
{}
DomainOperator( const DomainOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY )
: Operator(copy, copyop), _domains(copy._domains), _backupDomains(copy._backupDomains)
{}
META_Object( osgParticle, DomainOperator );
/// Add a point domain
inline void addPointDomain( const osg::Vec3& p );
/// Add a line segment domain
inline void addLineSegmentDomain( const osg::Vec3& v1, const osg::Vec3& v2 );
/// Add a triangle domain
inline void addTriangleDomain( const osg::Vec3& v1, const osg::Vec3& v2, const osg::Vec3& v3 );
/// Add a rectangle domain
inline void addRectangleDomain( const osg::Vec3& corner, const osg::Vec3& w, const osg::Vec3& h );
/// Add a plane domain
inline void addPlaneDomain( const osg::Plane& plane );
/// Add a sphere domain
inline void addSphereDomain( const osg::Vec3& c, float r );
/// Add a box domain
inline void addBoxDomain( const osg::Vec3& min, const osg::Vec3& max );
/// Add a disk domain
inline void addDiskDomain( const osg::Vec3& c, const osg::Vec3& n, float r1, float r2=0.0f );
/// Add a domain object directly, used by the .osg wrappers and serializers.
void addDomain( const Domain& domain ) { _domains.push_back(domain); }
/// Get a domain object directly, used by the .osg wrappers and serializers.
const Domain& getDomain( unsigned int i ) const { return _domains[i]; }
/// Remove a domain at specific index
void removeDomain( unsigned int i )
{ if (i<_domains.size()) _domains.erase(_domains.begin() + i); }
/// Remove all existing domains
void removeAllDomains() { _domains.clear(); }
/// Get number of domains
unsigned int getNumDomains() const { return _domains.size(); }
/// Apply the acceleration to a particle. Do not call this method manually.
void operate( Particle* P, double dt );
/// Perform some initializations. Do not call this method manually.
void beginOperate( Program* prg );
/// Perform some post-operations. Do not call this method manually.
void endOperate();
protected:
virtual ~DomainOperator() {}
DomainOperator& operator=( const DomainOperator& ) { return *this; }
virtual void handlePoint( const Domain& domain, Particle* P, double dt ) { ignore("Point"); }
virtual void handleLineSegment( const Domain& domain, Particle* P, double dt ) { ignore("LineSegment"); }
virtual void handleTriangle( const Domain& domain, Particle* P, double dt ) { ignore("Triangle"); }
@@ -128,10 +128,10 @@ protected:
virtual void handleSphere( const Domain& domain, Particle* P, double dt ) { ignore("Sphere"); }
virtual void handleBox( const Domain& domain, Particle* P, double dt ) { ignore("Box"); }
virtual void handleDisk( const Domain& domain, Particle* P, double dt ) { ignore("Disk"); }
inline void computeNewBasis( const osg::Vec3&, const osg::Vec3&, osg::Vec3&, osg::Vec3& );
inline void ignore( const std::string& func );
std::vector<Domain> _domains;
std::vector<Domain> _backupDomains;
};
@@ -217,7 +217,7 @@ inline void DomainOperator::computeNewBasis( const osg::Vec3& u, const osg::Vec3
float det = w.z()*u.x()*v.y() - w.z()*u.y()*v.x() - u.z()*w.x()*v.y() -
u.x()*v.z()*w.y() + v.z()*w.x()*u.y() + u.z()*v.x()*w.y();
det = 1.0f / det;
s1.set( v.y()*w.z() - v.z()*w.y(), v.z()*w.x() - v.x()*w.z(), v.x()*w.y() - v.y()*w.x() );
s1 = s1 * det;
s2.set( u.y()*w.z() - u.z()*w.y(), u.z()*w.x() - u.x()*w.z(), u.x()*w.y() - u.y()*w.x() );

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -41,16 +41,16 @@ namespace osgParticle
virtual const char* className() const { return "Emitter"; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Emitter*>(obj) != 0; }
virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
/// Get the particle template.
inline const Particle& getParticleTemplate() const;
/// Set the particle template (particle is copied).
inline void setParticleTemplate(const Particle& p);
/// Return whether the particle system's default template should be used.
inline bool getUseDefaultTemplate() const;
/** Set whether the default particle template should be used.
When this flag is true, the particle template is ignored, and the
particle system's default template is used instead.
@@ -60,11 +60,11 @@ namespace osgParticle
protected:
virtual ~Emitter() {}
Emitter& operator=(const Emitter&) { return *this; }
inline void process(double dt);
virtual void emitParticles(double dt) = 0;
bool _usedeftemp;
Particle _ptemp;
};

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -24,19 +24,19 @@ namespace osgParticle
class OSGPARTICLE_EXPORT ExplosionDebrisEffect : public ParticleEffect
{
public:
explicit ExplosionDebrisEffect(bool automaticSetup=true);
ExplosionDebrisEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f);
ExplosionDebrisEffect(const ExplosionDebrisEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,ExplosionDebrisEffect);
virtual void setDefaults();
virtual void setUpEmitterAndProgram();
virtual Emitter* getEmitter() { return _emitter.get(); }
virtual const Emitter* getEmitter() const { return _emitter.get(); }

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -24,15 +24,15 @@ namespace osgParticle
class OSGPARTICLE_EXPORT ExplosionEffect : public ParticleEffect
{
public:
explicit ExplosionEffect(bool automaticSetup=true);
ExplosionEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f);
ExplosionEffect(const ExplosionEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,ExplosionEffect);
virtual void setDefaults();
virtual void setUpEmitterAndProgram();
@@ -42,7 +42,7 @@ namespace osgParticle
virtual Program* getProgram() { return _program.get(); }
virtual const Program* getProgram() const { return _program.get(); }
protected:
virtual ~ExplosionEffect() {}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
@@ -34,55 +34,55 @@ public:
_magnitude(1.0f), _epsilon(1e-3), _sigma(1.0f),
_inexp(0.0f), _outexp(0.0f)
{}
ExplosionOperator( const ExplosionOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY )
: Operator(copy, copyop), _center(copy._center), _radius(copy._radius),
_magnitude(copy._magnitude), _epsilon(copy._epsilon), _sigma(copy._sigma),
_inexp(copy._inexp), _outexp(copy._outexp)
{}
META_Object( osgParticle, ExplosionOperator );
/// Set the center of shock wave
void setCenter( const osg::Vec3& c ) { _center = c; }
/// Get the center of shock wave
const osg::Vec3& getCenter() const { return _center; }
/// Set the radius of wave peak
void setRadius( float r ) { _radius = r; }
/// Get the radius of wave peak
float getRadius() const { return _radius; }
/// Set the acceleration scale
void setMagnitude( float mag ) { _magnitude = mag; }
/// Get the acceleration scale
float getMagnitude() const { return _magnitude; }
/// Set the acceleration epsilon
void setEpsilon( float eps ) { _epsilon = eps; }
/// Get the acceleration epsilon
float getEpsilon() const { return _epsilon; }
/// Set broadness of the strength of the wave
void setSigma( float s ) { _sigma = s; }
/// Get broadness of the strength of the wave
float getSigma() const { return _sigma; }
/// Apply the acceleration to a particle. Do not call this method manually.
inline void operate( Particle* P, double dt );
/// Perform some initializations. Do not call this method manually.
inline void beginOperate( Program* prg );
protected:
virtual ~ExplosionOperator() {}
ExplosionOperator& operator=( const ExplosionOperator& ) { return *this; }
osg::Vec3 _center;
osg::Vec3 _xf_center;
float _radius;
@@ -115,7 +115,7 @@ inline void ExplosionOperator::beginOperate( Program* prg )
{
_xf_center = _center;
}
float oneOverSigma = (_sigma!=0.0f ? (1.0f / _sigma) : 1.0f);
_inexp = -0.5f * oneOverSigma * oneOverSigma;
_outexp = oneOverSigma / sqrt(osg::PI * 2.0f);

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -39,7 +39,7 @@
#else
# define OSGPARTICLE_EXPORT
#endif
/**
\namespace osgParticle

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -24,17 +24,17 @@ namespace osgParticle
class OSGPARTICLE_EXPORT FireEffect : public ParticleEffect
{
public:
explicit FireEffect(bool automaticSetup=true);
FireEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f);
FireEffect(const FireEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,FireEffect);
virtual void setDefaults();
virtual void setUpEmitterAndProgram();
virtual Emitter* getEmitter() { return _emitter.get(); }
@@ -42,9 +42,9 @@ namespace osgParticle
virtual Program* getProgram() { return _program.get(); }
virtual const Program* getProgram() const { return _program.get(); }
protected:
virtual ~FireEffect() {}
osg::ref_ptr<ModularEmitter> _emitter;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -25,62 +25,62 @@
namespace osgParticle
{
class Particle;
class Particle;
/** An operator that simulates the friction of a fluid.
By using this operator you can let the particles move in a fluid of a given <I>density</I>
and <I>viscosity</I>. There are two functions to quickly setup the parameters for pure water
and air. You can decide whether to compute the forces using the particle's physical
and air. You can decide whether to compute the forces using the particle's physical
radius or another value, by calling the <CODE>setOverrideRadius()</CODE> method.
*/
class OSGPARTICLE_EXPORT FluidFrictionOperator: public Operator {
public:
FluidFrictionOperator();
FluidFrictionOperator(const FluidFrictionOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Object(osgParticle, FluidFrictionOperator);
/// Set the density of the fluid.
inline void setFluidDensity(float d);
/// Get the density of the fluid.
inline float getFluidDensity() const;
/// Set the viscosity of the fluid.
inline void setFluidViscosity(float v);
/// Get the viscosity of the fluid.
inline float getFluidViscosity() const;
/// Set the wind vector.
inline void setWind(const osg::Vec3& wind) { _wind = wind; }
/// Get the wind vector.
inline const osg::Vec3& getWind() const { return _wind; }
/// Set the overriden radius value (pass 0 if you want to use particle's radius).
inline void setOverrideRadius(float r);
/// Get the overriden radius value.
inline float getOverrideRadius() const;
inline float getOverrideRadius() const;
/// Set the fluid parameters as for air (20<32>C temperature).
inline void setFluidToAir();
/// Set the fluid parameters as for pure water (20<32>C temperature).
inline void setFluidToWater();
/// Apply the friction forces to a particle. Do not call this method manually.
void operate(Particle* P, double dt);
/// Perform some initializations. Do not call this method manually.
inline void beginOperate(Program* prg);
protected:
virtual ~FluidFrictionOperator() {}
FluidFrictionOperator &operator=(const FluidFrictionOperator &) { return *this; }
private:
float _coeff_A;
float _coeff_B;
@@ -90,9 +90,9 @@ namespace osgParticle
osg::Vec3 _wind;
Program* _current_program;
};
// INLINE FUNCTIONS
inline float FluidFrictionOperator::getFluidDensity() const
{
return _density;
@@ -102,7 +102,7 @@ namespace osgParticle
{
return _viscosity;
}
inline void FluidFrictionOperator::setFluidDensity(float d)
{
_density = d;
@@ -114,7 +114,7 @@ namespace osgParticle
_viscosity = v;
_coeff_A = 6 * osg::PI * _viscosity;
}
inline void FluidFrictionOperator::setFluidToAir()
{
setFluidViscosity(1.8e-5f);
@@ -126,17 +126,17 @@ namespace osgParticle
setFluidViscosity(1.002e-3f);
setFluidDensity(1.0f);
}
inline float FluidFrictionOperator::getOverrideRadius() const
{
return _ovr_rad;
}
inline void FluidFrictionOperator::setOverrideRadius(float r)
{
_ovr_rad = r;
}
inline void FluidFrictionOperator::beginOperate(Program* prg)
{
_current_program = prg;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -26,24 +26,24 @@ namespace osgParticle
{
/** A program class for performing operations on particles using a sequence of <I>operators</I>.
To use a <CODE>FluidProgram</CODE> you have to create some <CODE>Operator</CODE> objects and
To use a <CODE>FluidProgram</CODE> you have to create some <CODE>Operator</CODE> objects and
add them to the program.
All operators will be applied to each particle in the same order they've been added to the program.
*/
*/
class OSGPARTICLE_EXPORT FluidProgram: public Program {
public:
FluidProgram();
FluidProgram(const FluidProgram& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,FluidProgram);
/// Set the viscosity of the fluid.
inline void setFluidViscosity(float v)
{
_viscosity = v;
_viscosityCoefficient = 6 * osg::PI * _viscosity;
}
/// Get the viscosity of the fluid.
inline float getFluidViscosity() const { return _viscosity; }
@@ -56,17 +56,17 @@ namespace osgParticle
/// Get the density of the fluid.
inline float getFluidDensity() const { return _density; }
/// Set the wind vector.
inline void setWind(const osg::Vec3& wind) { _wind = wind; }
/// Get the wind vector.
inline const osg::Vec3& getWind() const { return _wind; }
/// Set the acceleration vector.
inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; }
/// Get the acceleration vector.
inline const osg::Vec3& getAcceleration() const { return _acceleration; }
@@ -82,7 +82,7 @@ namespace osgParticle
setFluidDensity(1.2929f);
setFluidViscosity(1.8e-5f);
}
/// Set the fluid parameters as for pure water (20<32>C temperature).
inline void setFluidToWater()
{
@@ -90,13 +90,13 @@ namespace osgParticle
setFluidDensity(1.0f);
setFluidViscosity(1.002e-3f);
}
protected:
virtual ~FluidProgram() {}
FluidProgram& operator=(const FluidProgram&) { return *this; }
virtual void execute(double dt);
osg::Vec3 _acceleration;
@@ -107,7 +107,7 @@ namespace osgParticle
float _viscosityCoefficient;
float _densityCoefficient;
};
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -34,57 +34,57 @@ namespace osgParticle
public:
inline ForceOperator();
inline ForceOperator(const ForceOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Object(osgParticle, ForceOperator);
/// Get the force vector.
inline const osg::Vec3& getForce() const;
/// Set the force vector.
inline void setForce(const osg::Vec3& f);
/// Apply the force to a particle. Do not call this method manually.
inline void operate(Particle* P, double dt);
/// Perform some initialization. Do not call this method manually.
inline void beginOperate(Program *prg);
protected:
virtual ~ForceOperator() {};
ForceOperator& operator=(const ForceOperator&) { return *this; }
ForceOperator& operator=(const ForceOperator&) { return *this; }
private:
osg::Vec3 _force;
osg::Vec3 _xf_force;
};
// INLINE FUNCTIONS
inline ForceOperator::ForceOperator()
: Operator(), _force(0, 0, 0)
{
{
}
inline ForceOperator::ForceOperator(const ForceOperator& copy, const osg::CopyOp& copyop)
: Operator(copy, copyop), _force(copy._force)
{
}
inline const osg::Vec3& ForceOperator::getForce() const
{
return _force;
}
inline void ForceOperator::setForce(const osg::Vec3& v)
{
_force = v;
}
inline void ForceOperator::operate(Particle* P, double dt)
{
P->addVelocity(_xf_force * (P->getMassInv() * dt));
}
inline void ForceOperator::beginOperate(Program *prg)
{
if (prg->getReferenceFrame() == ModularProgram::RELATIVE_RF) {

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -31,17 +31,17 @@ namespace osgParticle
public:
Interpolator()
: osg::Object() {}
Interpolator(const Interpolator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY)
: osg::Object(copy, copyop) {}
virtual const char* libraryName() const { return "osgParticle"; }
virtual const char* className() const { return "Interpolator"; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Interpolator* >(obj) != 0; }
/// Interpolate between floats. Must be overriden in descendant classes.
virtual float interpolate(float t, float y1, float y2) const = 0;
virtual float interpolate(float t, float y1, float y2) const = 0;
/// Interpolate between 2-dimensional vectors. Default behavior is to interpolate each component separately.
virtual osg::Vec2 interpolate(float t, const osg::Vec2& y1, const osg::Vec2& y2) const
{
@@ -60,7 +60,7 @@ namespace osgParticle
interpolate(t, y1.z(), y2.z())
);
}
/// Interpolate between 4-dimensional vectors. Default behavior is to interpolate each component separately.
virtual osg::Vec4 interpolate(float t, const osg::Vec4& y1, const osg::Vec4& y2) const
{
@@ -71,13 +71,13 @@ namespace osgParticle
interpolate(t, y1.w(), y2.w())
);
}
template<class ValueType>
ValueType interpolate(float t, const range<ValueType>& r) const
{
return interpolate(t, r.minimum, r.maximum);
}
protected:
virtual ~Interpolator() {}
};

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -31,17 +31,17 @@ namespace osgParticle
public:
LinearInterpolator()
: Interpolator() {}
LinearInterpolator(const LinearInterpolator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY)
: Interpolator(copy, copyop) {}
META_Object(osgParticle, LinearInterpolator);
virtual float interpolate(float t, float y1, float y2) const
{
return y1 + (y2 - y1) * t;
}
protected:
virtual ~LinearInterpolator() {}
};

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -36,8 +36,8 @@ namespace osgParticle
/** An emitter class that holds three objects to control the creation of particles.
These objects are a <I>counter</I>, a <I>placer</I> and a <I>shooter</I>.
The counter controls the number of particles to be emitted at each frame;
the placer must initialize the particle's position vector, while the shooter initializes
The counter controls the number of particles to be emitted at each frame;
the placer must initialize the particle's position vector, while the shooter initializes
its velocity vector.
You can use the predefined counter/placer/shooter classes, or you can create your own.
*/
@@ -45,18 +45,18 @@ namespace osgParticle
public:
ModularEmitter();
ModularEmitter(const ModularEmitter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,ModularEmitter);
/// Get the counter object.
inline Counter* getCounter();
/// Get the const Counter object.
inline const Counter* getCounter() const;
/// Set the Counter object.
inline void setCounter(Counter* c);
/// Get the ratio between number of particle to create in compensation for movement of the emitter
inline float getNumParticlesToCreateMovementCompensationRatio() const;
@@ -66,43 +66,43 @@ namespace osgParticle
/// Get the Placer object.
inline Placer* getPlacer();
/// Get the const Placer object.
/// Get the const Placer object.
inline const Placer* getPlacer() const;
/// Set the Placer object.
inline void setPlacer(Placer* p);
/// Get the Shooter object.
inline Shooter *getShooter();
/// Get the const Shooter object.
inline const Shooter *getShooter() const;
/// Set the Shooter object.
inline void setShooter(Shooter *s);
inline void setShooter(Shooter *s);
protected:
virtual ~ModularEmitter() {}
ModularEmitter &operator=(const ModularEmitter &) { return *this; }
virtual void emitParticles(double dt);
private:
float _numParticleToCreateMovementCompensationRatio;
osg::ref_ptr<Counter> _counter;
osg::ref_ptr<Placer> _placer;
osg::ref_ptr<Shooter> _shooter;
};
// INLINE FUNCTIONS
inline Counter* ModularEmitter::getCounter()
{
return _counter.get();
}
inline const Counter* ModularEmitter::getCounter() const
{
return _counter.get();
@@ -152,7 +152,7 @@ namespace osgParticle
{
_shooter = s;
}
}
#endif

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -28,46 +28,46 @@ namespace osgParticle
{
/** A program class for performing operations on particles using a sequence of <I>operators</I>.
To use a <CODE>ModularProgram</CODE> you have to create some <CODE>Operator</CODE> objects and
To use a <CODE>ModularProgram</CODE> you have to create some <CODE>Operator</CODE> objects and
add them to the program.
All operators will be applied to each particle in the same order they've been added to the program.
*/
*/
class OSGPARTICLE_EXPORT ModularProgram: public Program {
public:
ModularProgram();
ModularProgram(const ModularProgram& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,ModularProgram);
/// Get the number of operators.
inline int numOperators() const;
/// Add an operator to the list.
/// Add an operator to the list.
inline void addOperator(Operator* o);
/// Get a pointer to an operator in the list.
inline Operator* getOperator(int i);
/// Get a const pointer to an operator in the list.
inline const Operator* getOperator(int i) const;
/// Remove an operator from the list.
inline void removeOperator(int i);
inline void removeOperator(int i);
protected:
virtual ~ModularProgram() {}
ModularProgram& operator=(const ModularProgram&) { return *this; }
void execute(double dt);
private:
typedef std::vector<osg::ref_ptr<Operator> > Operator_vector;
Operator_vector _operators;
};
// INLINE FUNCTIONS
inline int ModularProgram::numOperators() const
{
return static_cast<int>(_operators.size());
@@ -92,7 +92,7 @@ namespace osgParticle
{
_operators.erase(_operators.begin()+i);
}
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -42,50 +42,50 @@ namespace osgParticle {
/// Get the number of vertices which define the segments.
inline int numVertices() const;
/// Get a vertex.
inline const osg::Vec3& getVertex(int i) const;
/// Set a vertex.
inline void setVertex(int i, const osg::Vec3& v);
/// Set a vertex.
inline void setVertex(int i, float x, float y, float z);
/// Add a vertex.
inline void addVertex(const osg::Vec3& v);
/// Add a vertex.
inline void addVertex(float x, float y, float z);
/// Remove a vertex.
inline void removeVertex(int i);
/// Place a partice. Called automatically by <CODE>ModularEmitter</CODE>, do not call this method manually.
void place(Particle* P) const;
/// return the length of the multi-segment
inline float volume() const;
/// return the control position
inline osg::Vec3 getControlPosition() const;
protected:
virtual ~MultiSegmentPlacer() {}
MultiSegmentPlacer& operator=(const MultiSegmentPlacer&) { return *this; }
MultiSegmentPlacer& operator=(const MultiSegmentPlacer&) { return *this; }
private:
typedef std::pair<osg::Vec3, float> Vertex_data;
typedef std::vector<Vertex_data> Vertex_vector;
Vertex_vector _vx;
float _total_length;
void recompute_length();
};
// INLINE FUNCTIONS
inline int MultiSegmentPlacer::numVertices() const
{
@@ -111,12 +111,12 @@ namespace osgParticle {
inline void MultiSegmentPlacer::addVertex(const osg::Vec3& v)
{
float l = 0;
float l = 0;
if (_vx.size() > 0) {
l = (v - _vx.back().first).length();
}
}
_total_length += l;
_vx.push_back(std::make_pair(v, _total_length));
_vx.push_back(std::make_pair(v, _total_length));
}
inline void MultiSegmentPlacer::addVertex(float x, float y, float z)
@@ -129,12 +129,12 @@ namespace osgParticle {
_vx.erase(_vx.begin()+i);
recompute_length();
}
inline float MultiSegmentPlacer::volume() const
{
return _total_length;
}
inline osg::Vec3 MultiSegmentPlacer::getControlPosition() const
{
return _vx.empty() ? osg::Vec3(0.0f,0.0f,0.0f) : _vx[0].first;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -27,12 +27,12 @@ namespace osgParticle
// forward declaration to avoid including the whole header file
class Particle;
/** An abstract base class used by <CODE>ModularProgram</CODE> to perform operations on particles before they are updated.
/** An abstract base class used by <CODE>ModularProgram</CODE> to perform operations on particles before they are updated.
To implement a new operator, derive from this class and override the <CODE>operate()</CODE> method.
You should also override the <CODE>beginOperate()</CODE> method to query the calling program for the reference frame
used, and initialize the right transformations if needed.
*/
class Operator: public osg::Object {
class Operator: public osg::Object {
public:
inline Operator();
inline Operator(const Operator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
@@ -40,13 +40,13 @@ namespace osgParticle
virtual const char* libraryName() const { return "osgParticle"; }
virtual const char* className() const { return "Operator"; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Operator* >(obj) != 0; }
/// Get whether this operator is enabled.
inline bool isEnabled() const;
/// Enable or disable this operator.
inline void setEnabled(bool v);
/** Do something on all emitted particles.
This method is called by <CODE>ModularProgram</CODE> objects to perform some operations
on the particles. By default, it will call the <CODE>operate()</CODE> method for each particle.
@@ -61,49 +61,49 @@ namespace osgParticle
if (P->isAlive() && isEnabled()) operate(P, dt);
}
}
/** Do something on a particle.
/** Do something on a particle.
You must override it in descendant classes. Common operations
consist of modifying the particle's velocity vector. The <CODE>dt</CODE> parameter is
the time elapsed from last operation.
the time elapsed from last operation.
*/
virtual void operate(Particle* P, double dt) = 0;
/** Do something before processing particles via the <CODE>operate()</CODE> method.
Overriding this method could be necessary to query the calling <CODE>Program</CODE> object
for the current reference frame. If the reference frame is RELATIVE_RF, then your
class should prepare itself to do all operations in local coordinates.
*/
virtual void beginOperate(Program *) {}
/// Do something after all particles have been processed.
virtual void endOperate() {}
protected:
virtual ~Operator() {}
Operator &operator=(const Operator &) { return *this; }
private:
bool _enabled;
bool _enabled;
};
// INLINE FUNCTIONS
inline Operator::Operator()
: osg::Object(), _enabled(true)
{
}
inline Operator::Operator(const Operator& copy, const osg::CopyOp& copyop)
: osg::Object(copy, copyop), _enabled(copy._enabled)
{
}
inline bool Operator::isEnabled() const
inline bool Operator::isEnabled() const
{
return _enabled;
}
inline void Operator::setEnabled(bool v)
{
_enabled = v;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
@@ -32,48 +32,48 @@ public:
OrbitOperator()
: Operator(), _magnitude(1.0f), _epsilon(1e-3), _maxRadius(FLT_MAX)
{}
OrbitOperator( const OrbitOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY )
: Operator(copy, copyop), _center(copy._center), _magnitude(copy._magnitude),
_epsilon(copy._epsilon), _maxRadius(copy._maxRadius)
{}
META_Object( osgParticle, OrbitOperator );
/// Set the center of orbit
void setCenter( const osg::Vec3& c ) { _center = c; }
/// Get the center of orbit
const osg::Vec3& getCenter() const { return _center; }
/// Set the acceleration scale
void setMagnitude( float mag ) { _magnitude = mag; }
/// Get the acceleration scale
float getMagnitude() const { return _magnitude; }
/// Set the acceleration epsilon
void setEpsilon( float eps ) { _epsilon = eps; }
/// Get the acceleration epsilon
float getEpsilon() const { return _epsilon; }
/// Set max radius between the center and the particle
void setMaxRadius( float max ) { _maxRadius = max; }
/// Get max radius between the center and the particle
float getMaxRadius() const { return _maxRadius; }
/// Apply the acceleration to a particle. Do not call this method manually.
inline void operate( Particle* P, double dt );
/// Perform some initializations. Do not call this method manually.
inline void beginOperate( Program* prg );
protected:
virtual ~OrbitOperator() {}
OrbitOperator& operator=( const OrbitOperator& ) { return *this; }
osg::Vec3 _center;
osg::Vec3 _xf_center;
float _magnitude;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -40,7 +40,7 @@ namespace osgParticle
Particles can either live forever (lifeTime < 0), or die after a specified
time (lifeTime >= 0). For each property which is defined as a range of values, a
"current" value will be evaluated at each frame by interpolating the <I>min</I>
and <I>max</I> values so that <I>curr_value = min</I> when <I>t == 0</I>, and
and <I>max</I> values so that <I>curr_value = min</I> when <I>t == 0</I>, and
<I>curr_value = max</I> when <I>t == lifeTime</I>.
You may customize the interpolator objects to achieve any kind of transition.
If you want the particle to live forever, set its lifetime to any value <= 0;
@@ -50,7 +50,7 @@ namespace osgParticle
class OSGPARTICLE_EXPORT Particle {
friend class ParticleSystem;
public:
enum
{
INVALID_INDEX = -1
@@ -65,42 +65,42 @@ namespace osgParticle
QUAD, // uses GL_QUADS as primitive
QUAD_TRIANGLESTRIP, // uses GL_TRI_angleSTRIP as primitive, but each particle needs a glBegin/glEnd pair
HEXAGON, // may save some filling time, but uses more triangles
LINE, // uses GL_LINES to draw line segments that point to the direction of motion
LINE, // uses GL_LINES to draw line segments that point to the direction of motion
USER // uses a user-defined drawable as primitive
};
Particle();
/// Get the shape of the particle.
inline Shape getShape() const;
/// Set the shape of the particle.
inline void setShape(Shape s);
/// Get whether the particle is still alive.
inline bool isAlive() const;
/// Get the life time of the particle (in seconds).
inline double getLifeTime() const;
/// Get the age of the particle (in seconds).
inline double getAge() const;
/// Get the minimum and maximum values for polygon size.
inline const rangef& getSizeRange() const;
/// Get the minimum and maximum values for alpha.
inline const rangef& getAlphaRange() const;
/// Get the minimum and maximum values for color.
inline const rangev4& getColorRange() const;
/// Get the interpolator for computing the size of polygons.
inline const Interpolator* getSizeInterpolator() const;
/// Get the interpolator for computing alpha values.
inline const Interpolator* getAlphaInterpolator() const;
/// Get the interpolator for computing color values.
inline const Interpolator* getColorInterpolator() const;
@@ -108,42 +108,42 @@ namespace osgParticle
For built-in operators to work correctly, lengths must be expressed in meters.
*/
inline float getRadius() const;
/** Get the mass of the particle.
For built-in operators to work correctly, remember that the mass is expressed in kg.
*/
inline float getMass() const;
/// Get <CODE>1 / getMass()</CODE>.
inline float getMassInv() const;
/// Get the position vector.
inline const osg::Vec3& getPosition() const;
/** Get the velocity vector.
For built-in operators to work correctly, remember that velocity components are expressed
in meters per second.
*/
inline const osg::Vec3& getVelocity() const;
inline const osg::Vec3& getVelocity() const;
/// Get the previous position (the position before last update).
inline const osg::Vec3& getPreviousPosition() const;
/// Get the angle vector.
inline const osg::Vec3& getAngle() const;
/// Get the rotational velocity vector.
inline const osg::Vec3& getAngularVelocity() const;
/// Get the previous angle vector.
inline const osg::Vec3& getPreviousAngle() const;
/// Get the current color
inline const osg::Vec4& getCurrentColor() const { return _current_color; }
/// Get the current alpha
inline float getCurrentAlpha() const { return _current_alpha; }
/// Get the s texture coordinate of the bottom left of the particle
inline float getSTexCoord() const { return _s_coord; }
@@ -152,37 +152,37 @@ namespace osgParticle
/// Get width of texture tile
inline int getTileS() const;
/// Get height of texture tile
inline int getTileT() const;
/// Get number of texture tiles
inline int getNumTiles() const { return _end_tile - _start_tile + 1; }
/** Kill the particle on next update
NOTE: after calling this function, the <CODE>isAlive()</CODE> method will still
NOTE: after calling this function, the <CODE>isAlive()</CODE> method will still
return true until the particle is updated again.
*/
inline void kill();
/// Set the life time of the particle.
inline void setLifeTime(double t);
/// Set the minimum and maximum values for polygon size.
inline void setSizeRange(const rangef& r);
/// Set the minimum and maximum values for alpha.
inline void setAlphaRange(const rangef& r);
/// Set the minimum and maximum values for color.
inline void setColorRange(const rangev4& r);
/// Set the interpolator for computing size values.
inline void setSizeInterpolator(Interpolator* ri);
/// Set the interpolator for computing alpha values.
/// Set the interpolator for computing alpha values.
inline void setAlphaInterpolator(Interpolator* ai);
/// Set the interpolator for computing color values.
inline void setColorInterpolator(Interpolator* ci);
@@ -190,24 +190,24 @@ namespace osgParticle
For built-in operators to work correctly, lengths must be expressed in meters.
*/
inline void setRadius(float r);
/** Set the mass of the particle.
For built-in operators to work correctly, remember that the mass is expressed in kg.
*/
inline void setMass(float m);
/// Set the position vector.
/// Set the position vector.
inline void setPosition(const osg::Vec3& p);
/** Set the velocity vector.
For built-in operators to work correctly, remember that velocity components are expressed
in meters per second.
*/
inline void setVelocity(const osg::Vec3& v);
/// Add a vector to the velocity vector.
inline void addVelocity(const osg::Vec3& dv);
/// Transform position and velocity vectors by a matrix.
inline void transformPositionVelocity(const osg::Matrix& xform);
@@ -216,19 +216,19 @@ namespace osgParticle
/// Set the angle vector.
inline void setAngle(const osg::Vec3& a);
/**
Set the angular velocity vector.
Set the angular velocity vector.
Components x, y and z are angles of rotation around the respective axis (in radians).
*/
inline void setAngularVelocity(const osg::Vec3& v);
/// Add a vector to the angular velocity vector.
inline void addAngularVelocity(const osg::Vec3& dv);
/// Transform angle and angularVelocity vectors by a matrix.
inline void transformAngleVelocity(const osg::Matrix& xform);
/** Update the particle (don't call this method manually).
This method is called automatically by <CODE>ParticleSystem::update()</CODE>; it
updates the graphical properties of the particle for the current time,
@@ -239,19 +239,19 @@ namespace osgParticle
/// Perform some pre-rendering tasks. Called automatically by particle systems.
inline void beginRender(osg::GLBeginEndAdapter* gl) const;
/// Render the particle. Called automatically by particle systems.
void render(osg::GLBeginEndAdapter* gl, const osg::Vec3& xpos, const osg::Vec3& px, const osg::Vec3& py, float scale = 1.0f) const;
/// Render the particle with user-defined drawable
void render(osg::RenderInfo& renderInfo, const osg::Vec3& xpos, const osg::Vec3& xrot) const;
/// Perform some post-rendering tasks. Called automatically by particle systems.
inline void endRender(osg::GLBeginEndAdapter* gl) const;
/// Get the current (interpolated) polygon size. Valid only after the first call to update().
inline float getCurrentSize() const;
/// Specify how the particle texture is tiled.
/// All tiles in the given range are sequentially displayed during the lifetime
/// of the particle. When no range is given, all tiles are displayed during the lifetime.
@@ -271,19 +271,19 @@ namespace osgParticle
/// Get the const next particle
inline int getNextParticle() const { return _nextParticle; }
/// Set the depth of the particle
inline void setDepth(double d) { _depth = d; }
/// Get the depth of the particle
inline double getDepth() const { return _depth; }
/// Set the user-defined particle drawable
inline void setDrawable(osg::Drawable* d) { _drawable = d; }
/// Get the user-defined particle drawable
inline osg::Drawable* getDrawable() const { return _drawable.get(); }
/// Sorting operator
bool operator<(const Particle &P) const { return _depth < P._depth; }
@@ -291,7 +291,7 @@ namespace osgParticle
void setUpTexCoordsAsPartOfConnectedParticleSystem(ParticleSystem* ps);
protected:
Shape _shape;
rangef _sr;
@@ -316,14 +316,14 @@ namespace osgParticle
osg::Vec3 _angle;
osg::Vec3 _angul_arvel;
double _t0;
double _t0;
float _alive;
float _current_size;
float _current_alpha;
osg::Vec3 _base_prop; // [0] _alive [1] _current_size [2] _current_alpha
osg::Vec4 _current_color;
float _s_tile;
float _t_tile;
int _start_tile;
@@ -331,14 +331,14 @@ namespace osgParticle
int _cur_tile;
float _s_coord;
float _t_coord;
// previous and next Particles are only used in ConnectedParticleSystems
int _previousParticle;
int _nextParticle;
// the depth of the particle is used only when sorting is enabled
double _depth;
// the particle drawable is used only when USER shape is enabled
osg::ref_ptr<osg::Drawable> _drawable;
};
@@ -364,17 +364,17 @@ namespace osgParticle
{
return _lifeTime;
}
inline double Particle::getAge() const
{
return _t0;
}
inline float Particle::getRadius() const
{
return _radius;
}
inline void Particle::setRadius(float r)
{
_radius = r;
@@ -419,7 +419,7 @@ namespace osgParticle
{
return _velocity;
}
inline const osg::Vec3& Particle::getPreviousPosition() const
{
return _prev_pos;
@@ -429,17 +429,17 @@ namespace osgParticle
{
return _angle;
}
inline const osg::Vec3& Particle::getAngularVelocity() const
{
return _angul_arvel;
}
inline const osg::Vec3& Particle::getPreviousAngle() const
{
return _prev_angle;
}
inline int Particle::getTileS() const
{
return (_s_tile>0.0f) ? static_cast<int>(1.0f / _s_tile) : 1;
@@ -449,7 +449,7 @@ namespace osgParticle
{
return (_t_tile>0.0f) ? static_cast<int>(1.0f / _t_tile) : 1;
}
inline void Particle::kill()
{
_mustdie = true;
@@ -510,7 +510,7 @@ namespace osgParticle
_position = xform.preMult(_position);
_velocity = osg::Matrix::transform3x3(_velocity, xform);
}
inline void Particle::transformPositionVelocity(const osg::Matrix& xform1, const osg::Matrix& xform2, float r)
{
osg::Vec3 position1 = xform1.preMult(_position);
@@ -521,50 +521,50 @@ namespace osgParticle
_position = position1*r + position2*one_minus_r;
_velocity = velocity1*r + velocity2*one_minus_r;
}
inline void Particle::setAngle(const osg::Vec3& a)
{
_angle = a;
}
inline void Particle::setAngularVelocity(const osg::Vec3& v)
{
_angul_arvel = v;
}
inline void Particle::addAngularVelocity(const osg::Vec3& dv)
{
_angul_arvel += dv;
}
inline void Particle::transformAngleVelocity(const osg::Matrix& xform)
{
// this should be optimized!
osg::Vec3 a1 = _angle + _angul_arvel;
_angle = xform.preMult(_angle);
a1 = xform.preMult(a1);
_angul_arvel = a1 - _angle;
}
inline float Particle::getMass() const
{
return _mass;
}
inline float Particle::getMassInv() const
{
return _massinv;
}
inline void Particle::setMass(float m)
{
_mass = m;
_massinv = 1 / m;
}
inline void Particle::beginRender(osg::GLBeginEndAdapter* gl) const
{
switch (_shape)
@@ -610,7 +610,7 @@ namespace osgParticle
{
_s_tile = (sTile>0) ? 1.0f / static_cast<float>(sTile) : 1.0f;
_t_tile = (tTile>0) ? 1.0f / static_cast<float>(tTile) : 1.0f;
if(startTile == -1)
{
_start_tile = 0;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -23,7 +23,7 @@ namespace osgParticle
class OSGPARTICLE_EXPORT ParticleEffect : public osg::Group
{
public:
explicit ParticleEffect(bool automaticSetup=true):
_automaticSetup(automaticSetup),
_useLocalParticleSystem(true),
@@ -33,7 +33,7 @@ namespace osgParticle
_emitterDuration(1.0),
_wind(0.0f,0.0f,0.0f)
{}
ParticleEffect(const ParticleEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
@@ -62,7 +62,7 @@ namespace osgParticle
void setIntensity(float intensity);
float getIntensity() const { return _intensity; }
void setStartTime(double startTime);
double getStartTime() const { return _startTime; }
@@ -75,7 +75,7 @@ namespace osgParticle
void setWind(const osg::Vec3& wind);
const osg::Vec3& getWind() const { return _wind; }
/// Get whether all particles are dead
/// Get whether all particles are dead
bool areAllParticlesDead() const { return _particleSystem.valid()?_particleSystem->areAllParticlesDead():true; }
virtual Emitter* getEmitter() = 0;
@@ -83,7 +83,7 @@ namespace osgParticle
virtual Program* getProgram() = 0;
virtual const Program* getProgram() const = 0;
void setParticleSystem(ParticleSystem* ps);
inline ParticleSystem* getParticleSystem() { return _particleSystem.get(); }
inline const ParticleSystem* getParticleSystem() const { return _particleSystem.get(); }
@@ -95,14 +95,14 @@ namespace osgParticle
virtual void buildEffect();
protected:
virtual ~ParticleEffect() {}
bool _automaticSetup;
osg::ref_ptr<ParticleSystem> _particleSystem;
bool _useLocalParticleSystem;
bool _useLocalParticleSystem;
std::string _textureFileName;
Particle _defaultParticleTemplate;
osg::Vec3 _position;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -37,117 +37,117 @@ namespace osgParticle
*/
class OSGPARTICLE_EXPORT ParticleProcessor: public osg::Node {
public:
enum ReferenceFrame {
RELATIVE_RF,
ABSOLUTE_RF
};
ParticleProcessor();
ParticleProcessor(const ParticleProcessor& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual const char* libraryName() const { return "osgParticle"; }
virtual const char* className() const { return "ParticleProcessor"; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const ParticleProcessor*>(obj) != 0; }
virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
/// Get the reference frame.
inline ReferenceFrame getReferenceFrame() const;
/// Set the reference frame.
inline void setReferenceFrame(ReferenceFrame rf);
/// Get whether this processor is enabled or not.
bool getEnabled() const { return _enabled; }
inline bool isEnabled() const;
/// Set whether this processor is enabled or not.
inline void setEnabled(bool v);
/// Get a pointer to the destination particle system.
inline ParticleSystem* getParticleSystem();
/// Get a const pointer to the destination particle system.
inline const ParticleSystem* getParticleSystem() const;
/// Set the destination particle system.
inline void setParticleSystem(ParticleSystem* ps);
/// Set the endless flag of this processor.
inline void setEndless(bool type);
/// Check whether this processor is endless.
bool getEndless() const { return _endless; }
inline bool isEndless() const;
/// Set the lifetime of this processor.
inline void setLifeTime(double t);
/// Get the lifetime of this processor.
inline double getLifeTime() const;
/// Set the start time of this processor.
inline void setStartTime(double t);
/// Get the start time of this processor.
inline double getStartTime() const;
/// Set the current time of this processor.
inline void setCurrentTime(double t);
/// Get the current time of this processor.
inline double getCurrentTime() const;
/// Set the reset time of this processor. A value of 0 disables reset.
inline void setResetTime(double t);
/// Get the reset time of this processor.
inline double getResetTime() const;
/**
Check whether the processor is alive with respect to start time and
life duration. Note that this method may return true even if the
life duration. Note that this method may return true even if the
processor has been disabled by calling setEnabled(false). To test
whether the processor is actually processing particles or not, you
should evaluate (isEnabled() && isAlive()).
*/
inline bool isAlive() const;
void traverse(osg::NodeVisitor& nv);
/// Get the current local-to-world transformation matrix (valid only during cull traversal).
inline const osg::Matrix& getLocalToWorldMatrix();
/// Get the current world-to-local transformation matrix (valid only during cull traversal).
inline const osg::Matrix& getWorldToLocalMatrix();
/// Get the previous local-to-world transformation matrix (valid only during cull traversal).
inline const osg::Matrix& getPreviousLocalToWorldMatrix();
/// Get the previous world-to-local transformation matrix (valid only during cull traversal).
inline const osg::Matrix& getPreviousWorldToLocalMatrix();
/// Transform a point from local to world coordinates (valid only during cull traversal).
inline osg::Vec3 transformLocalToWorld(const osg::Vec3& P);
/// Transform a vector from local to world coordinates, discarding translation (valid only during cull traversal).
inline osg::Vec3 rotateLocalToWorld(const osg::Vec3& P);
/// Transform a point from world to local coordinates (valid only during cull traversal).
inline osg::Vec3 transformWorldToLocal(const osg::Vec3& P);
/// Transform a vector from world to local coordinates, discarding translation (valid only during cull traversal).
inline osg::Vec3 rotateWorldToLocal(const osg::Vec3& P);
virtual osg::BoundingSphere computeBound() const;
virtual osg::BoundingSphere computeBound() const;
protected:
virtual ~ParticleProcessor() {}
ParticleProcessor& operator=(const ParticleProcessor&) { return *this; }
virtual void process(double dt) = 0;
private:
ReferenceFrame _rf;
bool _enabled;
@@ -162,36 +162,36 @@ namespace osgParticle
osg::Matrix _previous_ltw_matrix;
osg::Matrix _previous_wtl_matrix;
osg::NodeVisitor* _current_nodevisitor;
bool _endless;
double _lifeTime;
double _startTime;
double _currentTime;
double _resetTime;
//added- 1/17/06- bgandere@nps.edu
//added- 1/17/06- bgandere@nps.edu
//a var to keep from doing multiple updates
unsigned int _frameNumber;
};
// INLINE FUNCTIONS
inline ParticleProcessor::ReferenceFrame ParticleProcessor::getReferenceFrame() const
{
return _rf;
}
inline void ParticleProcessor::setReferenceFrame(ReferenceFrame rf)
{
_rf = rf;
}
inline bool ParticleProcessor::isEnabled() const
{
return _enabled;
}
inline void ParticleProcessor::setEnabled(bool v)
{
_enabled = v;
@@ -200,7 +200,7 @@ namespace osgParticle
_currentTime = 0;
}
}
inline ParticleSystem* ParticleProcessor::getParticleSystem()
{
return _ps.get();
@@ -210,17 +210,17 @@ namespace osgParticle
{
return _ps.get();
}
inline void ParticleProcessor::setParticleSystem(ParticleSystem* ps)
{
_ps = ps;
}
inline void ParticleProcessor::setEndless(bool type)
{
_endless = type;
}
inline bool ParticleProcessor::isEndless() const
{
return _endless;
@@ -230,17 +230,17 @@ namespace osgParticle
{
_lifeTime = t;
}
inline double ParticleProcessor::getLifeTime() const
{
return _lifeTime;
}
inline void ParticleProcessor::setStartTime(double t)
{
_startTime = t;
}
inline double ParticleProcessor::getStartTime() const
{
return _startTime;
@@ -249,23 +249,23 @@ namespace osgParticle
{
_currentTime = t;
}
inline double ParticleProcessor::getCurrentTime() const
{
return _currentTime;
}
inline void ParticleProcessor::setResetTime(double t)
{
_resetTime = t;
}
inline double ParticleProcessor::getResetTime() const
{
return _resetTime;
}
inline const osg::Matrix& ParticleProcessor::getLocalToWorldMatrix()
inline const osg::Matrix& ParticleProcessor::getLocalToWorldMatrix()
{
if (_need_ltw_matrix) {
_previous_ltw_matrix = _ltw_matrix;
@@ -280,7 +280,7 @@ namespace osgParticle
return _ltw_matrix;
}
inline const osg::Matrix& ParticleProcessor::getWorldToLocalMatrix()
inline const osg::Matrix& ParticleProcessor::getWorldToLocalMatrix()
{
if (_need_wtl_matrix) {
_previous_wtl_matrix = _wtl_matrix;
@@ -294,7 +294,7 @@ namespace osgParticle
}
return _wtl_matrix;
}
inline const osg::Matrix& ParticleProcessor::getPreviousLocalToWorldMatrix()
{
if (_need_ltw_matrix) getLocalToWorldMatrix();
@@ -311,7 +311,7 @@ namespace osgParticle
{
return getLocalToWorldMatrix().preMult(P);
}
inline osg::Vec3 ParticleProcessor::transformWorldToLocal(const osg::Vec3& P)
{
return getWorldToLocalMatrix().preMult(P);
@@ -319,16 +319,16 @@ namespace osgParticle
inline osg::Vec3 ParticleProcessor::rotateLocalToWorld(const osg::Vec3& P)
{
return getLocalToWorldMatrix().preMult(P) -
return getLocalToWorldMatrix().preMult(P) -
getLocalToWorldMatrix().preMult(osg::Vec3(0, 0, 0));
}
inline osg::Vec3 ParticleProcessor::rotateWorldToLocal(const osg::Vec3& P)
{
return getWorldToLocalMatrix().preMult(P) -
getWorldToLocalMatrix().preMult(osg::Vec3(0, 0, 0));
}
inline bool ParticleProcessor::isAlive() const
{
return _currentTime < (_lifeTime + _startTime);

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -53,7 +53,7 @@ namespace osgParticle
*/
class OSGPARTICLE_EXPORT ParticleSystem: public osg::Drawable {
public:
enum Alignment {
BILLBOARD,
FIXED
@@ -63,25 +63,25 @@ namespace osgParticle
ParticleSystem(const ParticleSystem& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Object(osgParticle, ParticleSystem);
/// Get the alignment type of particles.
inline Alignment getParticleAlignment() const;
/// Set the alignment type of particles.
inline void setParticleAlignment(Alignment a);
/// Get the X-axis alignment vector.
inline const osg::Vec3& getAlignVectorX() const;
/// Set the X-axis alignment vector.
inline void setAlignVectorX(const osg::Vec3& v);
/// Get the Y-axis alignment vector.
inline const osg::Vec3& getAlignVectorY() const;
/// Set the Y-axis alignment vector.
inline void setAlignVectorY(const osg::Vec3& v);
/// Set the alignment vectors.
inline void setAlignVectors(const osg::Vec3& X, const osg::Vec3& Y);
@@ -102,8 +102,8 @@ namespace osgParticle
/// Get the default bounding box
inline const osg::BoundingBox& getDefaultBoundingBox() const;
inline const osg::BoundingBox& getDefaultBoundingBox() const;
/** Set the default bounding box.
The default bounding box is used when a real bounding box cannot be computed, for example
because no particles has been updated yet.
@@ -112,7 +112,7 @@ namespace osgParticle
/// Return true if we use vertex arrays for rendering particles.
bool getUseVertexArray() const { return _useVertexArray; }
/** Set to use vertex arrays for rendering particles.
Lots of variables will be omitted: particles' shape, alive or not, visibility distance, and so on,
so the rendering result is not as good as we wish (although it's fast than using glBegin/glEnd).
@@ -120,19 +120,19 @@ namespace osgParticle
This method is called automatically by <CODE>setDefaultAttributesUsingShaders()</CODE>.
*/
void setUseVertexArray(bool v) { _useVertexArray = v; }
/// Return true if shaders are required.
bool getUseShaders() const { return _useShaders; }
/** Set to use GLSL shaders for rendering particles.
Particles' parameters will be used as shader attribute arrays, and necessary variables, including
the visibility distance, texture, etc, will be used and updated as uniforms.
*/
void setUseShaders(bool v) { _useShaders = v; _dirty_uniforms = true; }
/// Get the double pass rendering flag.
inline bool getDoublePassRendering() const;
/** Set the double pass rendering flag.
Double pass rendering avoids overdraw problems between particle systems
and other opaque objects. If you can render all the particle systems after
@@ -141,11 +141,11 @@ namespace osgParticle
system will fall into a transparent bin.
*/
inline void setDoublePassRendering(bool v);
/// Return true if the particle system is frozen.
bool getFrozen() const { return _frozen; }
inline bool isFrozen() const;
/** Set or reset the <I>frozen</I> state.
When the particle system is frozen, emitters and programs won't do anything on it.
*/
@@ -153,86 +153,86 @@ namespace osgParticle
/// Get the number of allocated particles (alive + dead).
inline int numParticles() const;
/// Get the number of dead particles.
inline int numDeadParticles() const;
/// Get whether all particles are dead
/// Get whether all particles are dead
inline bool areAllParticlesDead() const { return numDeadParticles()==numParticles(); }
/// Get a pointer to the i-th particle.
inline Particle* getParticle(int i);
/// Get a const pointer to the i-th particle.
inline const Particle* getParticle(int i) const;
/// Create a new particle from the specified template (or the default one if <CODE>ptemplate</CODE> is null).
inline virtual Particle* createParticle(const Particle* ptemplate);
/// Destroy the i-th particle.
inline virtual void destroyParticle(int i);
/// Reuse the i-th particle.
inline virtual void reuseParticle(int i) { _deadparts.push(&(_particles[i])); }
/// Get the last frame number.
inline unsigned int getLastFrameNumber() const;
/// Get the unique delta time for emitters and updaters to use
inline double& getDeltaTime( double currentTime );
/// Get a reference to the default particle template.
inline Particle& getDefaultParticleTemplate();
/// Get a const reference to the default particle template.
inline const Particle& getDefaultParticleTemplate() const;
/// Set the default particle template (particle is copied).
inline void setDefaultParticleTemplate(const Particle& p);
/// Get whether the particle system can freeze when culled
inline bool getFreezeOnCull() const;
/// Set whether the particle system can freeze when culled (default is true)
inline void setFreezeOnCull(bool v);
/** A useful method to set the most common <CODE>StateAttribute</CODE>'s in one call.
If <CODE>texturefile</CODE> is empty, then texturing is turned off.
*/
void setDefaultAttributes(const std::string& texturefile = "", bool emissive_particles = true, bool lighting = false, int texture_unit = 0);
/** A useful method to set the most common <CODE>StateAttribute</CODE> and use GLSL shaders to draw particles.
At present, when enabling shaders in the particle system, user-defined shapes will not be usable.
If <CODE>texturefile</CODE> is empty, then texturing is turned off.
*/
void setDefaultAttributesUsingShaders(const std::string& texturefile = "", bool emissive_particles = true, int texture_unit = 0);
/// (<B>EXPERIMENTAL</B>) Get the level of detail.
inline int getLevelOfDetail() const;
/** (<B>EXPERIMENTAL</B>) Set the level of detail. The total number of particles is divided by the detail value to
get the actual number of particles to be drawn. This value must be greater than zero.
*/
inline void setLevelOfDetail(int v);
enum SortMode
{
NO_SORT,
SORT_FRONT_TO_BACK,
SORT_BACK_TO_FRONT
};
/// Get the sort mode.
inline SortMode getSortMode() const;
/** Set the sort mode. It will force resorting the particle list by the Z direction of the view coordinates.
This can be used for the purpose of transparent rendering or <CODE>setVisibilityDistance()</CODE>.
*/
inline void setSortMode(SortMode mode);
/// Get the visibility distance.
inline double getVisibilityDistance() const;
/** Set the visibility distance which allows the particles to be rendered only when depth is inside the distance.
When using shaders, it can work well directly; otherwise the sort mode should also be set to pre-compute depth.
*/
@@ -244,7 +244,7 @@ namespace osgParticle
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
virtual osg::BoundingBox computeBound() const;
#ifdef OSGPARTICLE_USE_ReadWriteMutex
typedef OpenThreads::ReadWriteMutex ReadWriterMutex;
typedef OpenThreads::ScopedReadLock ScopedReadLock;
@@ -272,18 +272,18 @@ namespace osgParticle
Particle_vector _particles;
Death_stack _deadparts;
osg::BoundingBox _def_bbox;
Alignment _alignment;
osg::Vec3 _align_X_axis;
osg::Vec3 _align_Y_axis;
ParticleScaleReferenceFrame _particleScaleReferenceFrame;
bool _useVertexArray;
bool _useShaders;
bool _dirty_uniforms;
bool _doublepass;
bool _frozen;
@@ -297,36 +297,36 @@ namespace osgParticle
mutable unsigned int _last_frame;
mutable bool _dirty_dt;
bool _freeze_on_cull;
double _t0;
double _dt;
int _detail;
SortMode _sortMode;
double _visibilityDistance;
mutable int _draw_count;
mutable ReadWriterMutex _readWriteMutex;
};
// INLINE FUNCTIONS
inline ParticleSystem::Alignment ParticleSystem::getParticleAlignment() const
{
return _alignment;
}
inline void ParticleSystem::setParticleAlignment(Alignment a)
{
_alignment = a;
}
inline const osg::Vec3& ParticleSystem::getAlignVectorX() const
{
return _align_X_axis;
}
inline void ParticleSystem::setAlignVectorX(const osg::Vec3& v)
{
_align_X_axis = v;
@@ -336,12 +336,12 @@ namespace osgParticle
{
return _align_Y_axis;
}
inline void ParticleSystem::setAlignVectorY(const osg::Vec3& v)
{
_align_Y_axis = v;
}
inline void ParticleSystem::setAlignVectors(const osg::Vec3& X, const osg::Vec3& Y)
{
_align_X_axis = X;
@@ -352,17 +352,17 @@ namespace osgParticle
{
return _frozen;
}
inline void ParticleSystem::setFrozen(bool v)
{
_frozen = v;
}
inline const osg::BoundingBox& ParticleSystem::getDefaultBoundingBox() const
{
return _def_bbox;
}
inline void ParticleSystem::setDefaultBoundingBox(const osg::BoundingBox& bbox)
{
_def_bbox = bbox;
@@ -402,19 +402,19 @@ namespace osgParticle
{
_particles[i].kill();
}
inline unsigned int ParticleSystem::getLastFrameNumber() const
{
return _last_frame;
}
inline double& ParticleSystem::getDeltaTime( double currentTime )
{
if ( _dirty_dt )
{
_dt = currentTime - _t0;
if ( _dt<0.0 ) _dt = 0.0;
_t0 = currentTime;
_dirty_dt = false;
}
@@ -435,7 +435,7 @@ namespace osgParticle
if (p.y() + r > _bmax.y()) _bmax.y() = p.y() + r;
if (p.z() + r > _bmax.z()) _bmax.z() = p.z() + r;
}
if (!_bounds_computed)
if (!_bounds_computed)
_bounds_computed = true;
}
@@ -453,51 +453,51 @@ namespace osgParticle
{
_def_ptemp = p;
}
inline bool ParticleSystem::getFreezeOnCull() const
{
return _freeze_on_cull;
}
inline void ParticleSystem::setFreezeOnCull(bool v)
{
_freeze_on_cull = v;
}
inline int ParticleSystem::getLevelOfDetail() const
{
return _detail;
}
inline void ParticleSystem::setLevelOfDetail(int v)
{
if (v < 1) v = 1;
_detail = v;
}
inline ParticleSystem::SortMode ParticleSystem::getSortMode() const
{
return _sortMode;
}
inline void ParticleSystem::setSortMode(SortMode mode)
{
_sortMode = mode;
}
inline double ParticleSystem::getVisibilityDistance() const
{
return _visibilityDistance;
}
inline void ParticleSystem::setVisibilityDistance(double distance)
{
_visibilityDistance = distance;
if (_useShaders) _dirty_uniforms = true;
}
// I'm not sure this function should be inlined...
// I'm not sure this function should be inlined...
inline Particle* ParticleSystem::createParticle(const Particle* ptemplate)
{
// is there any dead particle?

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -40,9 +40,9 @@ namespace osgParticle
public:
ParticleSystemUpdater();
ParticleSystemUpdater(const ParticleSystemUpdater& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,ParticleSystemUpdater);
/// Add a particle system to the list.
virtual bool addParticleSystem(ParticleSystem* ps);
@@ -51,7 +51,7 @@ namespace osgParticle
/// Remove a particle system(s) from the list (by index).
virtual bool removeParticleSystem(unsigned int i, unsigned int numParticleSystemsToRemove=1);
/// Replace ParticleSystem with another ParticleSystem.
virtual bool replaceParticleSystem(ParticleSystem* origPS, ParticleSystem* newPS);
@@ -63,7 +63,7 @@ namespace osgParticle
/// Get a particle system from the list.
inline ParticleSystem* getParticleSystem(unsigned int i);
/// Get a particle system from the list.
inline const ParticleSystem* getParticleSystem(unsigned int i) const;
@@ -72,33 +72,33 @@ namespace osgParticle
/// get index number of ParticleSystem.
inline unsigned int getParticleSystemIndex( const ParticleSystem* ps ) const;
virtual void traverse(osg::NodeVisitor& nv);
virtual osg::BoundingSphere computeBound() const;
virtual osg::BoundingSphere computeBound() const;
protected:
virtual ~ParticleSystemUpdater() {}
ParticleSystemUpdater &operator=(const ParticleSystemUpdater &) { return *this; }
private:
typedef std::vector<osg::ref_ptr<ParticleSystem> > ParticleSystem_Vector;
ParticleSystem_Vector _psv;
double _t0;
//added 1/17/06- bgandere@nps.edu
//a var to keep from doing multiple updates per frame
unsigned int _frameNumber;
};
// INLINE FUNCTIONS
inline unsigned int ParticleSystemUpdater::getNumParticleSystems() const
{
return static_cast<int>(_psv.size());
}
inline ParticleSystem* ParticleSystemUpdater::getParticleSystem(unsigned int i)
{
return _psv[i].get();

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -39,7 +39,7 @@ namespace osgParticle
/// Place a particle. Must be implemented in descendant classes.
virtual void place(Particle* P) const = 0;
/// Volume of the placer. Can be implemented in descendant classes.
virtual float volume() const { return 1.0f; }
@@ -50,14 +50,14 @@ namespace osgParticle
~Placer() {}
Placer& operator=(const Placer& ) { return *this; }
};
// INLINE FUNCTIONS
inline Placer::Placer()
: osg::Object()
{
}
inline Placer::Placer(const Placer& copy, const osg::CopyOp& copyop)
: osg::Object(copy, copyop)
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -34,8 +34,8 @@ namespace osgParticle
inline PointPlacer(const PointPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Object(osgParticle, PointPlacer);
/** Place a particle.
/** Place a particle.
This method is called automatically by <CODE>ModularEmitter</CODE> and should not be called
manually.
*/
@@ -46,16 +46,16 @@ namespace osgParticle
protected:
virtual ~PointPlacer() {}
PointPlacer& operator=(const PointPlacer&) { return *this; }
PointPlacer& operator=(const PointPlacer&) { return *this; }
};
// INLINE FUNCTIONS
inline PointPlacer::PointPlacer()
: CenteredPlacer()
{
}
inline PointPlacer::PointPlacer(const PointPlacer& copy, const osg::CopyOp& copyop)
: CenteredPlacer(copy, copyop)
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -28,7 +28,7 @@ namespace osgParticle
class OSGPARTICLE_EXPORT PrecipitationEffect : public osg::Node
{
public:
PrecipitationEffect();
PrecipitationEffect(const PrecipitationEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
@@ -38,54 +38,54 @@ namespace osgParticle
virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
virtual void traverse(osg::NodeVisitor& nv);
/** Set all the parameters to create an rain effect of specified intensity.*/
void rain(float intensity);
/** Set all the parameters to create an snow effect of specified intensity.*/
void snow(float intensity);
void setMaximumParticleDensity(float density) { if (_maximumParticleDensity==density) return; _maximumParticleDensity = density; _dirty = true;}
float getMaximumParticleDensity() const { return _maximumParticleDensity; }
void setWind(const osg::Vec3& wind) { _wind = wind; }
const osg::Vec3& getWind() const { return _wind; }
void setPosition(const osg::Vec3& position) { _origin = position; }
const osg::Vec3& getPosition() const { return _origin; }
void setCellSize(const osg::Vec3& cellSize) { if (_cellSize==cellSize) return; _cellSize = cellSize; _dirty = true; }
const osg::Vec3& getCellSize() const { return _cellSize; }
void setParticleSpeed(float particleSpeed) { if (_particleSpeed==particleSpeed) return; _particleSpeed = particleSpeed; _dirty = true; }
float getParticleSpeed() const { return _particleSpeed; }
void setParticleSize(float particleSize) { if (_particleSize==particleSize) return; _particleSize = particleSize; _dirty = true;}
float getParticleSize() const { return _particleSize; }
void setParticleColor(const osg::Vec4& color) { if (_particleColor==color) return; _particleColor = color; _dirty = true;}
const osg::Vec4& getParticleColor() const { return _particleColor; }
void setNearTransition(float nearTransition) { _nearTransition = nearTransition; }
float getNearTransition() const { return _nearTransition; }
void setFarTransition(float farTransition) { _farTransition = farTransition; }
float getFarTransition() const { return _farTransition; }
void setUseFarLineSegments(bool useFarLineSegments) { _useFarLineSegments = useFarLineSegments; }
bool getUseFarLineSegments() const { return _useFarLineSegments; }
void setFog(osg::Fog* fog) { _fog = fog; }
osg::Fog* getFog() { return _fog.get(); }
const osg::Fog* getFog() const { return _fog.get(); }
osg::Geometry* getQuadGeometry() { return _quadGeometry.get(); }
osg::StateSet* getQuadStateSet() { return _quadStateSet.get(); }
osg::Geometry* getLineGeometry() { return _lineGeometry.get(); }
osg::StateSet* getLineStateSet() { return _lineStateSet.get(); }
osg::Geometry* getPointGeometry() { return _pointGeometry.get(); }
osg::StateSet* getPointStateSet() { return _pointStateSet.get(); }
@@ -110,10 +110,10 @@ namespace osgParticle
void setGeometry(osg::Geometry* geom) { _geometry = geom; }
osg::Geometry* getGeometry() { return _geometry.get(); }
const osg::Geometry* getGeometry() const { return _geometry.get(); }
void setDrawType(GLenum type) { _drawType = type; }
GLenum getDrawType() const { return _drawType; }
void setNumberOfVertices(unsigned int numVertices) { _numberOfVertices = numVertices; }
unsigned int getNumberOfVertices() const { return _numberOfVertices; }
@@ -139,14 +139,14 @@ namespace osgParticle
int j;
int k;
};
struct DepthMatrixStartTime
{
inline bool operator < (const DepthMatrixStartTime& rhs) const
{
return depth < rhs.depth;
}
float depth;
float startTime;
osg::Matrix modelview;
@@ -154,11 +154,11 @@ namespace osgParticle
typedef std::map< Cell, DepthMatrixStartTime > CellMatrixMap;
struct LessFunctor
struct LessFunctor
{
inline bool operator () (const CellMatrixMap::value_type* lhs,const CellMatrixMap::value_type* rhs) const
{
return (*lhs).second<(*rhs).second;
return (*lhs).second<(*rhs).second;
}
};
@@ -182,25 +182,25 @@ namespace osgParticle
mutable CellMatrixMap _currentCellMatrixMap;
mutable CellMatrixMap _previousCellMatrixMap;
GLenum _drawType;
unsigned int _numberOfVertices;
};
protected:
virtual ~PrecipitationEffect() {}
void compileGLObjects(osg::RenderInfo& renderInfo) const;
void update();
void createGeometry(unsigned int numParticles,
osg::Geometry* quad_geometry,
void createGeometry(unsigned int numParticles,
osg::Geometry* quad_geometry,
osg::Geometry* line_geometry,
osg::Geometry* point_geometry);
void setUpGeometries(unsigned int numParticles);
@@ -210,7 +210,7 @@ namespace osgParticle
osg::ref_ptr<PrecipitationDrawable> _linePrecipitationDrawable;
osg::ref_ptr<PrecipitationDrawable> _pointPrecipitationDrawable;
};
void cull(PrecipitationDrawableSet& pds, osgUtil::CullVisitor* cv) const;
bool build(const osg::Vec3 eyeLocal, int i, int j, int k, float startTime, PrecipitationDrawableSet& pds, osg::Polytope& frustum, osgUtil::CullVisitor* cv) const;
@@ -236,7 +236,7 @@ namespace osgParticle
OpenThreads::Mutex _mutex;
ViewDrawableMap _viewDrawableMap;
osg::ref_ptr<osg::Geometry> _quadGeometry;
osg::ref_ptr<osg::StateSet> _quadStateSet;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -26,10 +26,10 @@
namespace osgParticle
{
/** An abstract <CODE>ParticleProcessor</CODE> descendant for modifying particles "on the fly"
/** An abstract <CODE>ParticleProcessor</CODE> descendant for modifying particles "on the fly"
during the cull traversal.
Descendants of this class must implement the <CODE>execute()</CODE> method, which should iterate
through all particles in the linked particle system and modify them somehow
Descendants of this class must implement the <CODE>execute()</CODE> method, which should iterate
through all particles in the linked particle system and modify them somehow
(usually updating their velocity vector).
*/
class OSGPARTICLE_EXPORT Program: public ParticleProcessor
@@ -49,7 +49,7 @@ namespace osgParticle
/// Implementation of <CODE>ParticleProcessor::process()</CODE>. Do not call this method by yourself.
inline void process(double dt);
/// Execute the program on the particle system. Must be overriden in descendant classes.
virtual void execute(double dt) = 0;
@@ -62,7 +62,7 @@ namespace osgParticle
{
execute(dt);
}
}
#endif

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -42,37 +42,37 @@ namespace osgParticle
/// Get the range of possible values for <B>theta</B> angle.
inline const rangef& getThetaRange() const;
/// Set the range of possible values for <B>theta</B> angle.
inline void setThetaRange(const rangef& r);
/// Set the range of possible values for <B>theta</B> angle.
inline void setThetaRange(float r1, float r2);
/// Get the range of possible values for <B>phi</B> angle.
inline const rangef& getPhiRange() const;
/// Set the range of possible values for <B>phi</B> angle.
inline void setPhiRange(const rangef& r);
/// Set the range of possible values for <B>phi</B> angle.
inline void setPhiRange(float r1, float r2);
/// Get the range of possible values for initial speed of particles.
inline const rangef& getInitialSpeedRange() const;
inline const rangef& getInitialSpeedRange() const;
/// Set the range of possible values for initial speed of particles.
inline void setInitialSpeedRange(const rangef& r);
/// Set the range of possible values for initial speed of particles.
inline void setInitialSpeedRange(float r1, float r2);
/// Get the range of possible values for initial rotational speed of particles.
inline const rangev3& getInitialRotationalSpeedRange() const;
inline const rangev3& getInitialRotationalSpeedRange() const;
/// Set the range of possible values for initial rotational speed of particles.
inline void setInitialRotationalSpeedRange(const rangev3& r);
/// Set the range of possible values for initial rotational speed of particles.
inline void setInitialRotationalSpeedRange(const osg::Vec3& r1, const osg::Vec3& r2);
@@ -93,23 +93,23 @@ namespace osgParticle
// INLINE FUNCTIONS
inline RadialShooter::RadialShooter()
: Shooter(),
_theta_range(0, 0.5f*osg::PI_4),
_phi_range(0, 2*osg::PI),
: Shooter(),
_theta_range(0, 0.5f*osg::PI_4),
_phi_range(0, 2*osg::PI),
_speed_range(10, 10),
_rot_speed_range(osg::Vec3(0,0,0), osg::Vec3(0,0,0))
{
}
inline RadialShooter::RadialShooter(const RadialShooter& copy, const osg::CopyOp& copyop)
: Shooter(copy, copyop),
_theta_range(copy._theta_range),
_phi_range(copy._phi_range),
: Shooter(copy, copyop),
_theta_range(copy._theta_range),
_phi_range(copy._phi_range),
_speed_range(copy._speed_range),
_rot_speed_range(copy._rot_speed_range)
{
}
inline const rangef& RadialShooter::getThetaRange() const
{
return _theta_range;
@@ -180,13 +180,13 @@ namespace osgParticle
float phi = _phi_range.get_random();
float speed = _speed_range.get_random();
osg::Vec3 rot_speed = _rot_speed_range.get_random();
P->setVelocity(osg::Vec3(
speed * sinf(theta) * cosf(phi),
speed * sinf(theta) * sinf(phi),
speed * cosf(theta)
));
P->setAngularVelocity(rot_speed);
}

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -27,30 +27,30 @@ namespace osgParticle
public:
inline RandomRateCounter();
inline RandomRateCounter(const RandomRateCounter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Object(osgParticle, RandomRateCounter);
/// Return the number of particles to be created in this frame
inline int numParticlesToCreate(double dt) const;
protected:
virtual ~RandomRateCounter() {}
mutable float _np;
};
// INLINE FUNCTIONS
inline RandomRateCounter::RandomRateCounter()
: VariableRateCounter(), _np(0)
{
}
inline RandomRateCounter::RandomRateCounter(const RandomRateCounter& copy, const osg::CopyOp& copyop)
: VariableRateCounter(copy, copyop), _np(copy._np)
{
}
inline int RandomRateCounter::numParticlesToCreate(double dt) const
{
// compute the number of new particles, clamping it to 1 second of particles at the maximum rate

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -28,66 +28,66 @@ namespace osgParticle
{
/** A sector-shaped particle placer.
This placer sets the initial position of incoming particle by choosing a random position
within a circular sector; this sector is defined by three parameters: a <I>center point</I>,
which is inherited directly from <CODE>osgParticle::CenteredPlacer</CODE>, a range of values
for <I>radius</I>, and a range of values for the <I>central angle</I> (sometimes called <B>phi</B>).
This placer sets the initial position of incoming particle by choosing a random position
within a circular sector; this sector is defined by three parameters: a <I>center point</I>,
which is inherited directly from <CODE>osgParticle::CenteredPlacer</CODE>, a range of values
for <I>radius</I>, and a range of values for the <I>central angle</I> (sometimes called <B>phi</B>).
*/
class SectorPlacer: public CenteredPlacer {
public:
inline SectorPlacer();
inline SectorPlacer(const SectorPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
/// Get the range of possible values for radius.
inline const rangef& getRadiusRange() const;
/// Set the range of possible values for radius.
inline void setRadiusRange(const rangef& r);
/// Set the range of possible values for radius.
inline void setRadiusRange(float r1, float r2);
/// Get the range of possible values for the central angle.
inline const rangef& getPhiRange() const;
inline const rangef& getPhiRange() const;
/// Set the range of possible values for the central angle.
inline void setPhiRange(const rangef& r);
/// Set the range of possible values for the central angle.
inline void setPhiRange(float r1, float r2);
inline void setPhiRange(float r1, float r2);
META_Object(osgParticle, SectorPlacer);
/// Place a particle. Do not call it manually.
inline void place(Particle* P) const;
/// return the area of the sector
inline float volume() const;
/// return the control position
inline osg::Vec3 getControlPosition() const;
protected:
virtual ~SectorPlacer() {}
SectorPlacer& operator=(const SectorPlacer&) { return *this; }
SectorPlacer& operator=(const SectorPlacer&) { return *this; }
private:
rangef _rad_range;
rangef _phi_range;
};
// INLINE FUNCTIONS
inline SectorPlacer::SectorPlacer()
: CenteredPlacer(), _rad_range(0, 1), _phi_range(0, osg::PI*2)
{
}
inline SectorPlacer::SectorPlacer(const SectorPlacer& copy, const osg::CopyOp& copyop)
: CenteredPlacer(copy, copyop), _rad_range(copy._rad_range), _phi_range(copy._phi_range)
{
}
inline const rangef& SectorPlacer::getRadiusRange() const
{
return _rad_range;
@@ -102,18 +102,18 @@ namespace osgParticle
{
_rad_range = r;
}
inline void SectorPlacer::setRadiusRange(float r1, float r2)
{
_rad_range.minimum = r1;
_rad_range.maximum = r2;
}
inline void SectorPlacer::setPhiRange(const rangef& r)
{
_phi_range = r;
}
inline void SectorPlacer::setPhiRange(float r1, float r2)
{
_phi_range.minimum = r1;
@@ -124,15 +124,15 @@ namespace osgParticle
{
float rad = _rad_range.get_random_sqrtf();
float phi = _phi_range.get_random();
osg::Vec3 pos(
getCenter().x() + rad * cosf(phi),
getCenter().y() + rad * sinf(phi),
getCenter().x() + rad * cosf(phi),
getCenter().y() + rad * sinf(phi),
getCenter().z());
P->setPosition(pos);
}
inline float SectorPlacer::volume() const
{
return 0.5f * (_phi_range.maximum - _phi_range.minimum) *

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -38,37 +38,37 @@ namespace osgParticle {
/// get vertex <B>A</B>.
inline const osg::Vec3& getVertexA() const;
/// Set vertex <B>A</B> of the segment as a vector.
inline void setVertexA(const osg::Vec3& v);
/// Set vertex <B>A</B> of the segment as three floats.
inline void setVertexA(float x, float y, float z);
/// get vertex <B>B</B>.
inline const osg::Vec3& getVertexB() const;
/// Set vertex <B>B</B> of the segment as a vector.
inline void setVertexB(const osg::Vec3& v);
/// Set vertex <B>B</B> of the segment as three floats.
inline void setVertexB(float x, float y, float z);
/// Set both vertices.
inline void setSegment(const osg::Vec3& A, const osg::Vec3& B);
/// Place a particle. This method is called by <CODE>ModularEmitter</CODE>, do not call it manually.
inline void place(Particle* P) const;
/// return the length of the segment
inline float volume() const;
/// return the control position
inline osg::Vec3 getControlPosition() const;
protected:
virtual ~SegmentPlacer() {}
SegmentPlacer& operator=(const SegmentPlacer&) { return *this; }
SegmentPlacer& operator=(const SegmentPlacer&) { return *this; }
private:
osg::Vec3 _vertexA;
@@ -76,12 +76,12 @@ namespace osgParticle {
};
// INLINE FUNCTIONS
inline SegmentPlacer::SegmentPlacer()
: Placer(), _vertexA(-1, 0, 0), _vertexB(1, 0, 0)
{
}
inline SegmentPlacer::SegmentPlacer(const SegmentPlacer& copy, const osg::CopyOp& copyop)
: Placer(copy, copyop), _vertexA(copy._vertexA), _vertexB(copy._vertexB)
{
@@ -107,22 +107,22 @@ namespace osgParticle {
{
P->setPosition(rangev3(_vertexA, _vertexB).get_random());
}
inline float SegmentPlacer::volume() const
{
return (_vertexB - _vertexA).length();
}
inline void SegmentPlacer::setVertexA(const osg::Vec3& v)
{
_vertexA = v;
}
inline void SegmentPlacer::setVertexA(float x, float y, float z)
{
_vertexA.set(x, y, z);
}
inline void SegmentPlacer::setVertexB(const osg::Vec3& v)
{
_vertexB = v;
@@ -131,8 +131,8 @@ namespace osgParticle {
inline void SegmentPlacer::setVertexB(float x, float y, float z)
{
_vertexB.set(x, y, z);
}
}
inline osg::Vec3 SegmentPlacer::getControlPosition() const
{
return (_vertexA+_vertexB)*0.5f;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -23,7 +23,7 @@ namespace osgParticle
class Particle;
/** An abstract base class used by ModularEmitter to "shoot" the particles after they have been placed.
/** An abstract base class used by ModularEmitter to "shoot" the particles after they have been placed.
Descendants of this class must override the <CODE>shoot()</CODE> method.
*/
class Shooter: public osg::Object
@@ -46,14 +46,14 @@ namespace osgParticle
virtual ~Shooter() {}
Shooter &operator=(const Shooter &) { return *this; }
};
// INLINE FUNCTIONS
inline Shooter::Shooter()
: osg::Object()
{
}
inline Shooter::Shooter(const Shooter& copy, const osg::CopyOp& copyop)
: osg::Object(copy, copyop)
{

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
@@ -30,36 +30,36 @@ class OSGPARTICLE_EXPORT SinkOperator : public DomainOperator
public:
enum SinkTarget { SINK_POSITION, SINK_VELOCITY, SINK_ANGULAR_VELOCITY };
enum SinkStrategy { SINK_INSIDE, SINK_OUTSIDE };
SinkOperator()
: DomainOperator(), _sinkTarget(SINK_POSITION), _sinkStrategy(SINK_INSIDE)
{}
SinkOperator( const SinkOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY )
: DomainOperator(copy, copyop), _sinkTarget(copy._sinkTarget), _sinkStrategy(copy._sinkStrategy)
{}
META_Object( osgParticle, SinkOperator );
/// Set the sink strategy
void setSinkTarget( SinkTarget so ) { _sinkTarget = so; }
/// Get the sink strategy
SinkTarget getSinkTarget() const { return _sinkTarget; }
/// Set the sink strategy
void setSinkStrategy( SinkStrategy ss ) { _sinkStrategy = ss; }
/// Get the sink strategy
SinkStrategy getSinkStrategy() const { return _sinkStrategy; }
/// Perform some initializations. Do not call this method manually.
void beginOperate( Program* prg );
protected:
virtual ~SinkOperator() {}
SinkOperator& operator=( const SinkOperator& ) { return *this; }
virtual void handlePoint( const Domain& domain, Particle* P, double dt );
virtual void handleLineSegment( const Domain& domain, Particle* P, double dt );
virtual void handleTriangle( const Domain& domain, Particle* P, double dt );
@@ -68,10 +68,10 @@ protected:
virtual void handleSphere( const Domain& domain, Particle* P, double dt );
virtual void handleBox( const Domain& domain, Particle* P, double dt );
virtual void handleDisk( const Domain& domain, Particle* P, double dt );
inline const osg::Vec3& getValue( Particle* P );
inline void kill( Particle* P, bool insideDomain );
SinkTarget _sinkTarget;
SinkStrategy _sinkStrategy;
};

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -24,15 +24,15 @@ namespace osgParticle
class OSGPARTICLE_EXPORT SmokeEffect : public ParticleEffect
{
public:
explicit SmokeEffect(bool automaticSetup=true);
SmokeEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f);
SmokeEffect(const SmokeEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,SmokeEffect);
virtual void setDefaults();
virtual void setUpEmitterAndProgram();
@@ -42,11 +42,11 @@ namespace osgParticle
virtual Program* getProgram() { return _program.get(); }
virtual const Program* getProgram() const { return _program.get(); }
protected:
virtual ~SmokeEffect() {}
osg::ref_ptr<ModularEmitter> _emitter;
osg::ref_ptr<FluidProgram> _program;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -24,15 +24,15 @@ namespace osgParticle
class OSGPARTICLE_EXPORT SmokeTrailEffect : public ParticleEffect
{
public:
explicit SmokeTrailEffect(bool automaticSetup=true);
SmokeTrailEffect(const osg::Vec3& position, float scale=1.0f, float intensity=1.0f);
SmokeTrailEffect(const SmokeTrailEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Node(osgParticle,SmokeTrailEffect);
virtual void setDefaults();
virtual void setUpEmitterAndProgram();
@@ -42,11 +42,11 @@ namespace osgParticle
virtual Program* getProgram() { return _program.get(); }
virtual const Program* getProgram() const { return _program.get(); }
protected:
virtual ~SmokeTrailEffect() {}
osg::ref_ptr<ModularEmitter> _emitter;
osg::ref_ptr<FluidProgram> _program;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -28,39 +28,39 @@ namespace osgParticle
public:
inline VariableRateCounter();
inline VariableRateCounter(const VariableRateCounter& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual const char* libraryName() const { return "osgParticle"; }
virtual const char* className() const { return "VariableRateCounter"; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const VariableRateCounter *>(obj) != 0; }
inline const rangef& getRateRange() const;
inline void setRateRange(const rangef& r);
inline void setRateRange(float minrange, float maxrange);
protected:
virtual ~VariableRateCounter() {}
private:
rangef _rate_range;
};
// INLINE FUNCTIONS
inline VariableRateCounter::VariableRateCounter()
: Counter(), _rate_range(1, 1)
{
}
inline VariableRateCounter::VariableRateCounter(const VariableRateCounter& copy, const osg::CopyOp& copyop)
: Counter(copy, copyop), _rate_range(copy._rate_range)
{
}
inline const rangef &VariableRateCounter::getRateRange() const
{
return _rate_range;
}
inline void VariableRateCounter::setRateRange(const rangef& r)
{
_rate_range = r;

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
@@ -30,23 +30,23 @@ namespace osgParticle
/**
A simple struct template useful to store ranges of values as min/max pairs.
This struct template helps storing min/max ranges for values of any kind; class <CODE>ValueType</CODE> is
the type of values to be stored, and it must support operations <CODE>ValueType + ValueType</CODE>, <CODE>ValueType - ValueType</CODE>,
the type of values to be stored, and it must support operations <CODE>ValueType + ValueType</CODE>, <CODE>ValueType - ValueType</CODE>,
and <CODE>ValueType * float</CODE>, otherwise the <CODE>geValueTyperandom()</CODE> method will not compile.
This struct could be extended to customize the random number generator (now it uses only
This struct could be extended to customize the random number generator (now it uses only
<CODE>std::rand()</CODE>).
*/
template<class ValueType> struct range
{
/// Lower bound.
ValueType minimum;
/// Higher bound.
ValueType maximum;
/// Construct the object by calling default constructors for min and max.
range() : minimum(ValueType()), maximum(ValueType()) {}
/// Construct and initialize min and max directly.
range(const ValueType& mn, const ValueType& mx) : minimum(mn), maximum(mx) {}
@@ -64,7 +64,7 @@ namespace osgParticle
{
return minimum + (maximum - minimum) * sqrtf( static_cast<float>(rand()) / static_cast<float>(RAND_MAX) );
}
ValueType mid() const
{
return (minimum+maximum)*0.5f;
@@ -74,13 +74,13 @@ namespace osgParticle
/// Range of floats.
typedef range<float> rangef;
/// Range of osg::Vec2s.
typedef range<osg::Vec2> rangev2;
/// Range of osg::Vec3s.
typedef range<osg::Vec3> rangev3;
/// Range of osg::Vec4s.
typedef range<osg::Vec4> rangev4;