From db275d7c26e3652b714d117a50dc63442febc901 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 28 Jan 2010 08:53:48 +0000 Subject: [PATCH] From Wang Rui, added osgParticle serializers --- .../serializers/osgParticle/AccelOperator.cpp | 12 ++ .../osgParticle/AngularAccelOperator.cpp | 12 ++ .../serializers/osgParticle/BoxPlacer.cpp | 30 +++++ .../serializers/osgParticle/CMakeLists.txt | 7 ++ .../osgParticle/CenteredPlacer.cpp | 12 ++ .../osgParticle/ConnectedParticleSystem.cpp | 11 ++ .../osgParticle/ConstantRateCounter.cpp | 13 +++ .../serializers/osgParticle/Counter.cpp | 11 ++ .../serializers/osgParticle/Emitter.cpp | 36 ++++++ .../osgParticle/ExplosionDebrisEffect.cpp | 11 ++ .../osgParticle/ExplosionEffect.cpp | 11 ++ .../serializers/osgParticle/FireEffect.cpp | 11 ++ .../osgParticle/FluidFrictionOperator.cpp | 15 +++ .../serializers/osgParticle/FluidProgram.cpp | 15 +++ .../serializers/osgParticle/ForceOperator.cpp | 12 ++ .../serializers/osgParticle/Interpolator.cpp | 11 ++ .../osgParticle/LinearInterpolator.cpp | 11 ++ .../osgParticle/ModularEmitter.cpp | 14 +++ .../osgParticle/ModularProgram.cpp | 41 +++++++ .../osgParticle/MultiSegmentPlacer.cpp | 42 +++++++ .../serializers/osgParticle/Operator.cpp | 11 ++ .../serializers/osgParticle/Particle.cpp | 107 ++++++++++++++++++ .../osgParticle/ParticleEffect.cpp | 42 +++++++ .../osgParticle/ParticleProcessor.cpp | 23 ++++ .../osgParticle/ParticleSystem.cpp | 82 ++++++++++++++ .../osgParticle/ParticleSystemUpdater.cpp | 41 +++++++ .../serializers/osgParticle/Placer.cpp | 11 ++ .../serializers/osgParticle/PointPlacer.cpp | 11 ++ .../osgParticle/PrecipitationEffect.cpp | 21 ++++ .../serializers/osgParticle/Program.cpp | 11 ++ .../serializers/osgParticle/RadialShooter.cpp | 44 +++++++ .../osgParticle/RandomRateCounter.cpp | 11 ++ .../serializers/osgParticle/SectorPlacer.cpp | 28 +++++ .../serializers/osgParticle/SegmentPlacer.cpp | 13 +++ .../serializers/osgParticle/Shooter.cpp | 11 ++ .../serializers/osgParticle/SmokeEffect.cpp | 11 ++ .../osgParticle/SmokeTrailEffect.cpp | 11 ++ .../osgParticle/VariableRateCounter.cpp | 28 +++++ 38 files changed, 855 insertions(+) create mode 100644 src/osgWrappers/serializers/osgParticle/AccelOperator.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/AngularAccelOperator.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/BoxPlacer.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/CMakeLists.txt create mode 100644 src/osgWrappers/serializers/osgParticle/CenteredPlacer.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ConnectedParticleSystem.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ConstantRateCounter.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/Counter.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/Emitter.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ExplosionDebrisEffect.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ExplosionEffect.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/FireEffect.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/FluidFrictionOperator.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/FluidProgram.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ForceOperator.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/Interpolator.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/LinearInterpolator.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ModularEmitter.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ModularProgram.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/MultiSegmentPlacer.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/Operator.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/Particle.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ParticleEffect.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ParticleProcessor.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/ParticleSystemUpdater.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/Placer.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/PointPlacer.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/PrecipitationEffect.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/Program.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/RadialShooter.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/RandomRateCounter.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/SectorPlacer.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/SegmentPlacer.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/Shooter.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/SmokeEffect.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/SmokeTrailEffect.cpp create mode 100644 src/osgWrappers/serializers/osgParticle/VariableRateCounter.cpp diff --git a/src/osgWrappers/serializers/osgParticle/AccelOperator.cpp b/src/osgWrappers/serializers/osgParticle/AccelOperator.cpp new file mode 100644 index 000000000..91aa6d2ae --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/AccelOperator.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleAccelOperator, + new osgParticle::AccelOperator, + osgParticle::AccelOperator, + "osg::Object osgParticle::Operator osgParticle::AccelOperator" ) +{ + ADD_VEC3_SERIALIZER( Acceleration, osg::Vec3() ); // _accel +} diff --git a/src/osgWrappers/serializers/osgParticle/AngularAccelOperator.cpp b/src/osgWrappers/serializers/osgParticle/AngularAccelOperator.cpp new file mode 100644 index 000000000..0c5b0d586 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/AngularAccelOperator.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleAngularAccelOperator, + new osgParticle::AngularAccelOperator, + osgParticle::AngularAccelOperator, + "osg::Object osgParticle::Operator osgParticle::AngularAccelOperator" ) +{ + ADD_VEC3_SERIALIZER( AngularAcceleration, osg::Vec3() ); // _angul_araccel +} diff --git a/src/osgWrappers/serializers/osgParticle/BoxPlacer.cpp b/src/osgWrappers/serializers/osgParticle/BoxPlacer.cpp new file mode 100644 index 000000000..b33098c0c --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/BoxPlacer.cpp @@ -0,0 +1,30 @@ +#include +#include +#include +#include + +#define BOXPLACER_FUNCTION( PROP ) \ + static bool check##PROP( const osgParticle::BoxPlacer& obj ) { return true; } \ + static bool read##PROP( osgDB::InputStream& is, osgParticle::BoxPlacer& obj ) { \ + float min, max; is >> min >> max; \ + obj.set##PROP( min, max ); return true; \ + } \ + static bool write##PROP( osgDB::OutputStream& os, const osgParticle::BoxPlacer& obj ) { \ + const osgParticle::rangef& range = obj.get##PROP(); \ + os << range.minimum << range.maximum << std::endl; \ + return true; \ + } + +BOXPLACER_FUNCTION( XRange ) +BOXPLACER_FUNCTION( YRange ) +BOXPLACER_FUNCTION( ZRange ) + +REGISTER_OBJECT_WRAPPER( osgParticleBoxPlacer, + new osgParticle::BoxPlacer, + osgParticle::BoxPlacer, + "osg::Object osgParticle::Placer osgParticle::CenteredPlacer osgParticle::BoxPlacer" ) +{ + ADD_USER_SERIALIZER( XRange ); // _x_range + ADD_USER_SERIALIZER( YRange ); // _y_range + ADD_USER_SERIALIZER( ZRange ); // _z_range +} diff --git a/src/osgWrappers/serializers/osgParticle/CMakeLists.txt b/src/osgWrappers/serializers/osgParticle/CMakeLists.txt new file mode 100644 index 000000000..da911147b --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/CMakeLists.txt @@ -0,0 +1,7 @@ +FILE(GLOB TARGET_SRC *.cpp) +FILE(GLOB TARGET_H *.h) + +SET(TARGET_ADDED_LIBRARIES osgParticle ) + +#### end var setup ### +SETUP_PLUGIN(osgparticle) diff --git a/src/osgWrappers/serializers/osgParticle/CenteredPlacer.cpp b/src/osgWrappers/serializers/osgParticle/CenteredPlacer.cpp new file mode 100644 index 000000000..6b1ce6b28 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/CenteredPlacer.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleCenteredPlacer, + /*new osgParticle::CenteredPlacer*/NULL, + osgParticle::CenteredPlacer, + "osg::Object osgParticle::Placer osgParticle::CenteredPlacer" ) +{ + ADD_VEC3_SERIALIZER( Center, osg::Vec3() ); // center_ +} diff --git a/src/osgWrappers/serializers/osgParticle/ConnectedParticleSystem.cpp b/src/osgWrappers/serializers/osgParticle/ConnectedParticleSystem.cpp new file mode 100644 index 000000000..22bc579b2 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ConnectedParticleSystem.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleConnectedParticleSystem, + new osgParticle::ConnectedParticleSystem, + osgParticle::ConnectedParticleSystem, + "osg::Object osg::Drawable osgParticle::ParticleSystem osgParticle::ConnectedParticleSystem" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/ConstantRateCounter.cpp b/src/osgWrappers/serializers/osgParticle/ConstantRateCounter.cpp new file mode 100644 index 000000000..785547648 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ConstantRateCounter.cpp @@ -0,0 +1,13 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleConstantRateCounter, + new osgParticle::ConstantRateCounter, + osgParticle::ConstantRateCounter, + "osg::Object osgParticle::Counter osgParticle::ConstantRateCounter" ) +{ + ADD_INT_SERIALIZER( MinimumNumberOfParticlesToCreate, 0 ); // _minimumNumberOfParticlesToCreate + ADD_DOUBLE_SERIALIZER( NumberOfParticlesPerSecondToCreate, 0.0 ); // _numberOfParticlesPerSecondToCreate +} diff --git a/src/osgWrappers/serializers/osgParticle/Counter.cpp b/src/osgWrappers/serializers/osgParticle/Counter.cpp new file mode 100644 index 000000000..49c390dfb --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/Counter.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleCounter, + /*new osgParticle::Counter*/NULL, + osgParticle::Counter, + "osg::Object osgParticle::Counter" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/Emitter.cpp b/src/osgWrappers/serializers/osgParticle/Emitter.cpp new file mode 100644 index 000000000..e028d9892 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/Emitter.cpp @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +extern bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ); +extern bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p ); + +static bool checkParticleTemplate( const osgParticle::Emitter& emitter ) +{ + return !emitter.getUseDefaultTemplate(); +} + +static bool readParticleTemplate( osgDB::InputStream& is, osgParticle::Emitter& emitter ) +{ + osgParticle::Particle p; + readParticle( is, p ); + emitter.setParticleTemplate( p ); + return true; +} + +static bool writeParticleTemplate( osgDB::OutputStream& os, const osgParticle::Emitter& emitter ) +{ + const osgParticle::Particle& p = emitter.getParticleTemplate(); + writeParticle( os, p ); + return true; +} + +REGISTER_OBJECT_WRAPPER( osgParticleEmitter, + /*new osgParticle::Emitter*/NULL, + osgParticle::Emitter, + "osg::Object osg::Node osgParticle::ParticleProcessor osgParticle::Emitter" ) +{ + ADD_BOOL_SERIALIZER( UseDefaultTemplate, true ); // _usedeftemp + ADD_USER_SERIALIZER( ParticleTemplate ); // _ptemp +} diff --git a/src/osgWrappers/serializers/osgParticle/ExplosionDebrisEffect.cpp b/src/osgWrappers/serializers/osgParticle/ExplosionDebrisEffect.cpp new file mode 100644 index 000000000..55a99ca9c --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ExplosionDebrisEffect.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleExplosionDebrisEffect, + new osgParticle::ExplosionDebrisEffect, + osgParticle::ExplosionDebrisEffect, + "osg::Object osg::Node osg::Group osgParticle::ParticleEffect osgParticle::ExplosionDebrisEffect" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/ExplosionEffect.cpp b/src/osgWrappers/serializers/osgParticle/ExplosionEffect.cpp new file mode 100644 index 000000000..b76e7fee2 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ExplosionEffect.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleExplosionEffect, + new osgParticle::ExplosionEffect, + osgParticle::ExplosionEffect, + "osg::Object osg::Node osg::Group osgParticle::ParticleEffect osgParticle::ExplosionEffect" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/FireEffect.cpp b/src/osgWrappers/serializers/osgParticle/FireEffect.cpp new file mode 100644 index 000000000..752a6d9c5 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/FireEffect.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleFireEffect, + new osgParticle::FireEffect, + osgParticle::FireEffect, + "osg::Object osg::Node osg::Group osgParticle::ParticleEffect osgParticle::FireEffect" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/FluidFrictionOperator.cpp b/src/osgWrappers/serializers/osgParticle/FluidFrictionOperator.cpp new file mode 100644 index 000000000..e2916f4be --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/FluidFrictionOperator.cpp @@ -0,0 +1,15 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleFluidFrictionOperator, + new osgParticle::FluidFrictionOperator, + osgParticle::FluidFrictionOperator, + "osg::Object osgParticle::Operator osgParticle::FluidFrictionOperator" ) +{ + ADD_FLOAT_SERIALIZER( FluidDensity, 0.0f ); // _density + ADD_FLOAT_SERIALIZER( FluidDensity, 0.0f ); // _viscosity + ADD_VEC3_SERIALIZER( Wind, osg::Vec3() ); // _wind + ADD_FLOAT_SERIALIZER( OverrideRadius, 0.0f ); // _ovr_rad +} diff --git a/src/osgWrappers/serializers/osgParticle/FluidProgram.cpp b/src/osgWrappers/serializers/osgParticle/FluidProgram.cpp new file mode 100644 index 000000000..e06ce7e04 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/FluidProgram.cpp @@ -0,0 +1,15 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleFluidProgram, + new osgParticle::FluidProgram, + osgParticle::FluidProgram, + "osg::Object osg::Node osgParticle::ParticleProcessor osgParticle::Program osgParticle::FluidProgram" ) +{ + ADD_VEC3_SERIALIZER( Acceleration, osg::Vec3() ); // _acceleration + ADD_FLOAT_SERIALIZER( FluidViscosity, 0.0f ); // _viscosity + ADD_FLOAT_SERIALIZER( FluidDensity, 0.0f ); // _density + ADD_VEC3_SERIALIZER( Wind, osg::Vec3() ); // _wind +} diff --git a/src/osgWrappers/serializers/osgParticle/ForceOperator.cpp b/src/osgWrappers/serializers/osgParticle/ForceOperator.cpp new file mode 100644 index 000000000..62844168e --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ForceOperator.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleForceOperator, + new osgParticle::ForceOperator, + osgParticle::ForceOperator, + "osg::Object osgParticle::Operator osgParticle::ForceOperator" ) +{ + ADD_VEC3_SERIALIZER( Force, osg::Vec3() ); // _force +} diff --git a/src/osgWrappers/serializers/osgParticle/Interpolator.cpp b/src/osgWrappers/serializers/osgParticle/Interpolator.cpp new file mode 100644 index 000000000..09f5f9c25 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/Interpolator.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleInterpolator, + /*new osgParticle::Interpolator*/NULL, + osgParticle::Interpolator, + "osg::Object osgParticle::Interpolator" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/LinearInterpolator.cpp b/src/osgWrappers/serializers/osgParticle/LinearInterpolator.cpp new file mode 100644 index 000000000..b202e059f --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/LinearInterpolator.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleLinearInterpolator, + new osgParticle::LinearInterpolator, + osgParticle::LinearInterpolator, + "osg::Object osgParticle::Interpolator osgParticle::LinearInterpolator" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/ModularEmitter.cpp b/src/osgWrappers/serializers/osgParticle/ModularEmitter.cpp new file mode 100644 index 000000000..521ef13d3 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ModularEmitter.cpp @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleModularEmitter, + new osgParticle::ModularEmitter, + osgParticle::ModularEmitter, + "osg::Object osg::Node osgParticle::ParticleProcessor osgParticle::Emitter osgParticle::ModularEmitter" ) +{ + ADD_OBJECT_SERIALIZER( Counter, osgParticle::Counter, NULL ); // _counter + ADD_OBJECT_SERIALIZER( Placer, osgParticle::Placer, NULL ); // _placer + ADD_OBJECT_SERIALIZER( Shooter, osgParticle::Shooter, NULL ); // _shooter +} diff --git a/src/osgWrappers/serializers/osgParticle/ModularProgram.cpp b/src/osgWrappers/serializers/osgParticle/ModularProgram.cpp new file mode 100644 index 000000000..87afe01ca --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ModularProgram.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include + +static bool checkOperators( const osgParticle::ModularProgram& prog ) +{ + return prog.numOperators()>0; +} + +static bool readOperators( osgDB::InputStream& is, osgParticle::ModularProgram& prog ) +{ + unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + for ( unsigned int i=0; i( is.readObject() ); + if ( op ) prog.addOperator( op ); + } + is >> osgDB::END_BRACKET; + return true; +} + +static bool writeOperators( osgDB::OutputStream& os, const osgParticle::ModularProgram& prog ) +{ + unsigned int size = prog.numOperators(); + os << size << osgDB::BEGIN_BRACKET << std::endl; + for ( unsigned int i=0; i +#include +#include +#include + +static bool checkVertices( const osgParticle::MultiSegmentPlacer& placer ) +{ + return placer.numVertices()>0; +} + +static bool readVertices( osgDB::InputStream& is, osgParticle::MultiSegmentPlacer& placer ) +{ + unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + for ( unsigned int i=0; i> vec; + placer.addVertex( vec ); + } + is >> osgDB::END_BRACKET; + return true; +} + +static bool writeVertices( osgDB::OutputStream& os, const osgParticle::MultiSegmentPlacer& placer ) +{ + unsigned int size = placer.numVertices(); + os << size << osgDB::BEGIN_BRACKET << std::endl; + for ( unsigned int i=0; i +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleOperator, + /*new osgParticle::Operator*/NULL, + osgParticle::Operator, + "osg::Object osgParticle::Operator" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/Particle.cpp b/src/osgWrappers/serializers/osgParticle/Particle.cpp new file mode 100644 index 000000000..e23cb5319 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/Particle.cpp @@ -0,0 +1,107 @@ +#include +#include +#include +#include + +BEGIN_USER_TABLE( Shape, osgParticle::Particle ); + ADD_USER_VALUE( POINT ); + ADD_USER_VALUE( QUAD ); + ADD_USER_VALUE( QUAD_TRIANGLESTRIP ); + ADD_USER_VALUE( HEXAGON ); + ADD_USER_VALUE( LINE ); +END_USER_TABLE() + +USER_READ_FUNC( Shape, readShapeValue ) +USER_WRITE_FUNC( Shape, writeShapeValue ) + +bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ) +{ + is >> osgDB::BEGIN_BRACKET; + + is >> osgDB::PROPERTY("Shape"); + p.setShape( static_cast(readShapeValue(is)) ); + + double lifeTime; is >> osgDB::PROPERTY("LifeTime") >> lifeTime; + p.setLifeTime( lifeTime ); + + float min, max; osg::Vec4d minV, maxV; + is >> osgDB::PROPERTY("SizeRange") >> min >> max; p.setSizeRange( osgParticle::rangef(min, max) ); + is >> osgDB::PROPERTY("AlphaRange") >> min >> max; p.setAlphaRange( osgParticle::rangef(min, max) ); + is >> osgDB::PROPERTY("ColorRange") >> minV >> maxV; p.setColorRange( osgParticle::rangev4(minV, maxV) ); + + bool hasInterpolator = false; + is >> osgDB::PROPERTY("SizeInterpolator") >> hasInterpolator; + if ( hasInterpolator ) + { + is >> osgDB::BEGIN_BRACKET; + p.setSizeInterpolator( static_cast(is.readObject()) ); + is >> osgDB::END_BRACKET; + } + is >> osgDB::PROPERTY("AlphaInterpolator") >> hasInterpolator; + if ( hasInterpolator ) + { + is >> osgDB::BEGIN_BRACKET; + p.setAlphaInterpolator( static_cast(is.readObject()) ); + is >> osgDB::END_BRACKET; + } + is >> osgDB::PROPERTY("ColorInterpolator") >> hasInterpolator; + if ( hasInterpolator ) + { + is >> osgDB::BEGIN_BRACKET; + p.setColorInterpolator( static_cast(is.readObject()) ); + is >> osgDB::END_BRACKET; + } + + float radius; is >> osgDB::PROPERTY("Radius") >> radius; + float mass; is >> osgDB::PROPERTY("Mass") >> mass; + osg::Vec3d pos; is >> osgDB::PROPERTY("Position") >> pos; + osg::Vec3d vel; is >> osgDB::PROPERTY("Velocity") >> vel; + osg::Vec3d angle; is >> osgDB::PROPERTY("Angle") >> angle; + osg::Vec3d angleV; is >> osgDB::PROPERTY("AngularVelocity") >> angleV; + int s, t, num; is >> osgDB::PROPERTY("TextureTile") >> s >> t >> num; + + p.setRadius( radius ); + p.setMass( mass ); + p.setPosition( pos ); + p.setVelocity( vel ); + p.setAngle( angle ); + p.setAngularVelocity( angleV ); + p.setTextureTile( s, t, num ); + + is >> osgDB::END_BRACKET; + return true; +} + +bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p ) +{ + os << osgDB::BEGIN_BRACKET << std::endl; + + os << osgDB::PROPERTY("Shape"); writeShapeValue( os, (int)p.getShape() ); os << std::endl; + + os << osgDB::PROPERTY("LifeTime") << p.getLifeTime() << std::endl; + os << osgDB::PROPERTY("SizeRange") << p.getSizeRange().minimum << p.getSizeRange().maximum << std::endl; + os << osgDB::PROPERTY("AlphaRange") << p.getAlphaRange().minimum << p.getAlphaRange().maximum << std::endl; + os << osgDB::PROPERTY("ColorRange") << osg::Vec4d(p.getColorRange().minimum) + << osg::Vec4d(p.getColorRange().maximum) << std::endl; + + os << osgDB::PROPERTY("SizeInterpolator") << (p.getSizeInterpolator()!=NULL); + if ( p.getSizeInterpolator()!=NULL ) + os << osgDB::BEGIN_BRACKET << std::endl << p.getSizeInterpolator() << osgDB::END_BRACKET << std::endl; + os << osgDB::PROPERTY("AlphaInterpolator") << (p.getAlphaInterpolator()!=NULL); + if ( p.getAlphaInterpolator()!=NULL ) + os << osgDB::BEGIN_BRACKET << std::endl << p.getAlphaInterpolator() << osgDB::END_BRACKET << std::endl; + os << osgDB::PROPERTY("ColorInterpolator") << (p.getColorInterpolator()!=NULL); + if ( p.getColorInterpolator()!=NULL ) + os << osgDB::BEGIN_BRACKET << std::endl << p.getColorInterpolator() << osgDB::END_BRACKET << std::endl; + + os << osgDB::PROPERTY("Radius") << p.getRadius() << std::endl; + os << osgDB::PROPERTY("Mass") << p.getMass() << std::endl; + os << osgDB::PROPERTY("Position") << osg::Vec3d(p.getPosition()) << std::endl; + os << osgDB::PROPERTY("Velocity") << osg::Vec3d(p.getVelocity()) << std::endl; + os << osgDB::PROPERTY("Angle") << osg::Vec3d(p.getAngle()) << std::endl; + os << osgDB::PROPERTY("AngularVelocity") << osg::Vec3d(p.getAngularVelocity()) << std::endl; + os << osgDB::PROPERTY("TextureTile") << p.getTileS() << p.getTileT() << p.getNumTiles() << std::endl; + + os << osgDB::END_BRACKET << std::endl; + return true; +} diff --git a/src/osgWrappers/serializers/osgParticle/ParticleEffect.cpp b/src/osgWrappers/serializers/osgParticle/ParticleEffect.cpp new file mode 100644 index 000000000..d8e735fe8 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ParticleEffect.cpp @@ -0,0 +1,42 @@ +#include +#include +#include +#include + +// _particleSystem +static bool checkParticleSystem( const osgParticle::ParticleEffect& effect ) +{ + return (!effect.getUseLocalParticleSystem()) && (effect.getParticleSystem()!=NULL); +} + +static bool readParticleSystem( osgDB::InputStream& is, osgParticle::ParticleEffect& effect ) +{ + is >> osgDB::BEGIN_BRACKET; + effect.setUseLocalParticleSystem( false ); + effect.setParticleSystem( static_cast(is.readObject()) ); + is >> osgDB::END_BRACKET; + return true; +} + +static bool writeParticleSystem( osgDB::OutputStream& os, const osgParticle::ParticleEffect& effect ) +{ + os << osgDB::BEGIN_BRACKET << std::endl; + os << effect.getParticleSystem(); + os << osgDB::END_BRACKET << std::endl; + return true; +} + +REGISTER_OBJECT_WRAPPER( osgParticleParticleEffect, + /*new osgParticle::ParticleEffect*/NULL, + osgParticle::ParticleEffect, + "osg::Object osg::Node osg::Group osgParticle::ParticleEffect" ) +{ + ADD_USER_SERIALIZER( ParticleSystem ); // _particleSystem + ADD_STRING_SERIALIZER( TextureFileName, "" ); // _textureFileName + ADD_VEC3_SERIALIZER( Position, osg::Vec3() ); // _position + ADD_FLOAT_SERIALIZER( Scale, 0.0f ); // _scale + ADD_FLOAT_SERIALIZER( Intensity, 0.0f ); // _intensity + ADD_DOUBLE_SERIALIZER( StartTime, 0.0 ); // _startTime + ADD_DOUBLE_SERIALIZER( EmitterDuration, 0.0 ); // _emitterDuration + ADD_VEC3_SERIALIZER( Wind, osg::Vec3() ); // _wind +} diff --git a/src/osgWrappers/serializers/osgParticle/ParticleProcessor.cpp b/src/osgWrappers/serializers/osgParticle/ParticleProcessor.cpp new file mode 100644 index 000000000..748791ada --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ParticleProcessor.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleParticleProcessor, + /*new osgParticle::ParticleProcessor*/NULL, + osgParticle::ParticleProcessor, + "osg::Object osg::Node osgParticle::ParticleProcessor" ) +{ + BEGIN_ENUM_SERIALIZER( ReferenceFrame, RELATIVE_RF ); + ADD_ENUM_VALUE( RELATIVE_RF ); + ADD_ENUM_VALUE( ABSOLUTE_RF ); + END_ENUM_SERIALIZER(); // _rf + + ADD_BOOL_SERIALIZER( Enabled, true ); // _enabled + ADD_OBJECT_SERIALIZER( ParticleSystem, osgParticle::ParticleSystem, NULL ); // _ps + ADD_BOOL_SERIALIZER( Endless, true ); // _endless + ADD_DOUBLE_SERIALIZER( LifeTime, 0.0 ); // _lifeTime + ADD_DOUBLE_SERIALIZER( StartTime, 0.0 ); // _startTime + ADD_DOUBLE_SERIALIZER( CurrentTime, 0.0 ); // _currentTime + ADD_DOUBLE_SERIALIZER( ResetTime, 0.0 ); // _resetTime +} diff --git a/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp b/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp new file mode 100644 index 000000000..6560b8bb4 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ParticleSystem.cpp @@ -0,0 +1,82 @@ +#include +#include +#include +#include + +extern bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p ); +extern bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p ); + +// _def_bbox +static bool checkDefaultBoundingBox( const osgParticle::ParticleSystem& ps ) +{ + return ps.getDefaultBoundingBox().valid(); +} + +static bool readDefaultBoundingBox( osgDB::InputStream& is, osgParticle::ParticleSystem& ps ) +{ + osg::Vec3d min, max; + is >> osgDB::BEGIN_BRACKET; + is >> osgDB::PROPERTY("Minimum") >> min; + is >> osgDB::PROPERTY("Maximum") >> max; + is >> osgDB::END_BRACKET; + ps.setDefaultBoundingBox( osg::BoundingBox(min, max) ); + return true; +} + +static bool writeDefaultBoundingBox( osgDB::OutputStream& os, const osgParticle::ParticleSystem& ps ) +{ + const osg::BoundingBox& bb = ps.getDefaultBoundingBox(); + os << osgDB::BEGIN_BRACKET << std::endl; + os << osgDB::PROPERTY("Minimum") << osg::Vec3d(bb._min) << std::endl; + os << osgDB::PROPERTY("Maximum") << osg::Vec3d(bb._max) << std::endl; + os << osgDB::END_BRACKET; + os << std::endl; + return true; +} + +// _defaultParticleTemplate +static bool checkDefaultParticleTemplate( const osgParticle::ParticleSystem& ps ) +{ + return true; +} + +static bool readDefaultParticleTemplate( osgDB::InputStream& is, osgParticle::ParticleSystem& ps ) +{ + osgParticle::Particle p; + readParticle( is, p ); + ps.setDefaultParticleTemplate( p ); + return true; +} + +static bool writeDefaultParticleTemplate( osgDB::OutputStream& os, const osgParticle::ParticleSystem& ps ) +{ + const osgParticle::Particle& p = ps.getDefaultParticleTemplate(); + writeParticle( os, p ); + return true; +} + +REGISTER_OBJECT_WRAPPER( osgParticleParticleSystem, + new osgParticle::ParticleSystem, + osgParticle::ParticleSystem, + "osg::Object osg::Drawable osgParticle::ParticleSystem" ) +{ + ADD_USER_SERIALIZER( DefaultBoundingBox ); // _def_bbox + + BEGIN_ENUM_SERIALIZER2( ParticleAlignment, osgParticle::ParticleSystem::Alignment, BILLBOARD ); + ADD_ENUM_VALUE( BILLBOARD ); + ADD_ENUM_VALUE( FIXED ); + END_ENUM_SERIALIZER(); // _alignment + + ADD_VEC3_SERIALIZER( AlignVectorX, osg::Vec3() ); // _align_X_axis + ADD_VEC3_SERIALIZER( AlignVectorY, osg::Vec3() ); // _align_Y_axis + + BEGIN_ENUM_SERIALIZER( ParticleScaleReferenceFrame, WORLD_COORDINATES ); + ADD_ENUM_VALUE( LOCAL_COORDINATES ); + ADD_ENUM_VALUE( WORLD_COORDINATES ); + END_ENUM_SERIALIZER(); // _particleScaleReferenceFrame + + ADD_BOOL_SERIALIZER( DoublePassRendering, false ); // _doublepass + ADD_BOOL_SERIALIZER( Frozen, false ); // _frozen + ADD_USER_SERIALIZER( DefaultParticleTemplate ); // _def_ptemp + ADD_BOOL_SERIALIZER( FreezeOnCull, false ); // _freeze_on_cull +} diff --git a/src/osgWrappers/serializers/osgParticle/ParticleSystemUpdater.cpp b/src/osgWrappers/serializers/osgParticle/ParticleSystemUpdater.cpp new file mode 100644 index 000000000..14c42295b --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/ParticleSystemUpdater.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include + +static bool checkParticleSystems( const osgParticle::ParticleSystemUpdater& updater ) +{ + return updater.getNumParticleSystems()>0; +} + +static bool readParticleSystems( osgDB::InputStream& is, osgParticle::ParticleSystemUpdater& updater ) +{ + unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; + for ( unsigned int i=0; i( is.readObject() ); + if ( ps ) updater.addParticleSystem( ps ); + } + is >> osgDB::END_BRACKET; + return true; +} + +static bool writeParticleSystems( osgDB::OutputStream& os, const osgParticle::ParticleSystemUpdater& updater ) +{ + unsigned int size = updater.getNumParticleSystems(); + os << size << osgDB::BEGIN_BRACKET << std::endl; + for ( unsigned int i=0; i +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticlePlacer, + /*new osgParticle::Placer*/NULL, + osgParticle::Placer, + "osg::Object osgParticle::Placer" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/PointPlacer.cpp b/src/osgWrappers/serializers/osgParticle/PointPlacer.cpp new file mode 100644 index 000000000..4eb698ec4 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/PointPlacer.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticlePointPlacer, + new osgParticle::PointPlacer, + osgParticle::PointPlacer, + "osg::Object osgParticle::Placer osgParticle::CenteredPlacer osgParticle::PointPlacer" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/PrecipitationEffect.cpp b/src/osgWrappers/serializers/osgParticle/PrecipitationEffect.cpp new file mode 100644 index 000000000..7c7cd033f --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/PrecipitationEffect.cpp @@ -0,0 +1,21 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticlePrecipitationEffect, + new osgParticle::PrecipitationEffect, + osgParticle::PrecipitationEffect, + "osg::Object osg::Node osgParticle::PrecipitationEffect" ) +{ + ADD_VEC3_SERIALIZER( Wind, osg::Vec3() ); // _wind + ADD_FLOAT_SERIALIZER( ParticleSpeed, 0.0f ); // _particleSpeed + ADD_FLOAT_SERIALIZER( ParticleSize, 0.0f ); // _particleSize + ADD_VEC4_SERIALIZER( ParticleColor, osg::Vec4() ); // _particleColor + ADD_FLOAT_SERIALIZER( MaximumParticleDensity, 0.0f ); // _maximumParticleDensity + ADD_VEC3_SERIALIZER( CellSize, osg::Vec3() ); // _cellSize + ADD_FLOAT_SERIALIZER( NearTransition, 0.0f ); // _nearTransition + ADD_FLOAT_SERIALIZER( FarTransition, 0.0f ); // _farTransition + ADD_BOOL_SERIALIZER( UseFarLineSegments, false ); // _useFarLineSegments + ADD_OBJECT_SERIALIZER( Fog, osg::Fog, NULL ); // _fog +} diff --git a/src/osgWrappers/serializers/osgParticle/Program.cpp b/src/osgWrappers/serializers/osgParticle/Program.cpp new file mode 100644 index 000000000..f65ea1726 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/Program.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleProgram, + /*new osgParticle::Program*/NULL, + osgParticle::Program, + "osg::Object osg::Node osgParticle::ParticleProcessor osgParticle::Program" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/RadialShooter.cpp b/src/osgWrappers/serializers/osgParticle/RadialShooter.cpp new file mode 100644 index 000000000..1fea11399 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/RadialShooter.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +#define RADIALSHOOTER_FLOAT_FUNCTION( PROP ) \ + static bool check##PROP( const osgParticle::RadialShooter& obj ) { return true; } \ + static bool read##PROP( osgDB::InputStream& is, osgParticle::RadialShooter& obj ) { \ + float min, max; is >> min >> max; \ + obj.set##PROP( min, max ); return true; \ + } \ + static bool write##PROP( osgDB::OutputStream& os, const osgParticle::RadialShooter& obj ) { \ + const osgParticle::rangef& range = obj.get##PROP(); \ + os << range.minimum << range.maximum << std::endl; \ + return true; \ + } + +#define RADIALSHOOTER_VEC3_FUNCTION( PROP ) \ + static bool check##PROP( const osgParticle::RadialShooter& obj ) { return true; } \ + static bool read##PROP( osgDB::InputStream& is, osgParticle::RadialShooter& obj ) { \ + osg::Vec3d min, max; is >> min >> max; \ + obj.set##PROP( min, max ); return true; \ + } \ + static bool write##PROP( osgDB::OutputStream& os, const osgParticle::RadialShooter& obj ) { \ + const osgParticle::rangev3& range = obj.get##PROP(); \ + os << osg::Vec3d(range.minimum) << osg::Vec3d(range.maximum) << std::endl; \ + return true; \ + } + +RADIALSHOOTER_FLOAT_FUNCTION( ThetaRange ) +RADIALSHOOTER_FLOAT_FUNCTION( PhiRange ) +RADIALSHOOTER_FLOAT_FUNCTION( InitialSpeedRange ) +RADIALSHOOTER_VEC3_FUNCTION( InitialRotationalSpeedRange ) + +REGISTER_OBJECT_WRAPPER( osgParticleRadialShooter, + new osgParticle::RadialShooter, + osgParticle::RadialShooter, + "osg::Object osgParticle::Shooter osgParticle::RadialShooter" ) +{ + ADD_USER_SERIALIZER( ThetaRange ); // _theta_range + ADD_USER_SERIALIZER( PhiRange ); // _phi_range + ADD_USER_SERIALIZER( InitialSpeedRange ); // _speed_range + ADD_USER_SERIALIZER( InitialRotationalSpeedRange ); // _rot_speed_range +} diff --git a/src/osgWrappers/serializers/osgParticle/RandomRateCounter.cpp b/src/osgWrappers/serializers/osgParticle/RandomRateCounter.cpp new file mode 100644 index 000000000..73d0b1c2a --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/RandomRateCounter.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleRandomRateCounter, + new osgParticle::RandomRateCounter, + osgParticle::RandomRateCounter, + "osg::Object osgParticle::Counter osgParticle::VariableRateCounter osgParticle::RandomRateCounter" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/SectorPlacer.cpp b/src/osgWrappers/serializers/osgParticle/SectorPlacer.cpp new file mode 100644 index 000000000..4ae8aff1f --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/SectorPlacer.cpp @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +#define SECTORPLACER_FUNCTION( PROP ) \ + static bool check##PROP( const osgParticle::SectorPlacer& obj ) { return true; } \ + static bool read##PROP( osgDB::InputStream& is, osgParticle::SectorPlacer& obj ) { \ + float min, max; is >> min >> max; \ + obj.set##PROP( min, max ); return true; \ + } \ + static bool write##PROP( osgDB::OutputStream& os, const osgParticle::SectorPlacer& obj ) { \ + const osgParticle::rangef& range = obj.get##PROP(); \ + os << range.minimum << range.maximum << std::endl; \ + return true; \ + } + +SECTORPLACER_FUNCTION( RadiusRange ) +SECTORPLACER_FUNCTION( PhiRange ) + +REGISTER_OBJECT_WRAPPER( osgParticleSectorPlacer, + new osgParticle::SectorPlacer, + osgParticle::SectorPlacer, + "osg::Object osgParticle::Placer osgParticle::CenteredPlacer osgParticle::SectorPlacer" ) +{ + ADD_USER_SERIALIZER( RadiusRange ); // _rad_range + ADD_USER_SERIALIZER( PhiRange ); // _phi_range +} diff --git a/src/osgWrappers/serializers/osgParticle/SegmentPlacer.cpp b/src/osgWrappers/serializers/osgParticle/SegmentPlacer.cpp new file mode 100644 index 000000000..a1340b256 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/SegmentPlacer.cpp @@ -0,0 +1,13 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleSegmentPlacer, + new osgParticle::SegmentPlacer, + osgParticle::SegmentPlacer, + "osg::Object osgParticle::Placer osgParticle::SegmentPlacer" ) +{ + ADD_VEC3_SERIALIZER( VertexA, osg::Vec3() ); // _vertexA + ADD_VEC3_SERIALIZER( VertexB, osg::Vec3() ); // _vertexB +} diff --git a/src/osgWrappers/serializers/osgParticle/Shooter.cpp b/src/osgWrappers/serializers/osgParticle/Shooter.cpp new file mode 100644 index 000000000..fe3de5aaa --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/Shooter.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleShooter, + /*new osgParticle::Shooter*/NULL, + osgParticle::Shooter, + "osg::Object osgParticle::Shooter" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/SmokeEffect.cpp b/src/osgWrappers/serializers/osgParticle/SmokeEffect.cpp new file mode 100644 index 000000000..68b8ed145 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/SmokeEffect.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleSmokeEffect, + new osgParticle::SmokeEffect, + osgParticle::SmokeEffect, + "osg::Object osg::Node osg::Group osgParticle::ParticleEffect osgParticle::SmokeEffect" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/SmokeTrailEffect.cpp b/src/osgWrappers/serializers/osgParticle/SmokeTrailEffect.cpp new file mode 100644 index 000000000..b8fd0fe09 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/SmokeTrailEffect.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgParticleSmokeTrailEffect, + new osgParticle::SmokeTrailEffect, + osgParticle::SmokeTrailEffect, + "osg::Object osg::Node osg::Group osgParticle::ParticleEffect osgParticle::SmokeTrailEffect" ) +{ +} diff --git a/src/osgWrappers/serializers/osgParticle/VariableRateCounter.cpp b/src/osgWrappers/serializers/osgParticle/VariableRateCounter.cpp new file mode 100644 index 000000000..e1e74e238 --- /dev/null +++ b/src/osgWrappers/serializers/osgParticle/VariableRateCounter.cpp @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +static bool checkRateRange( const osgParticle::VariableRateCounter& obj ) +{ return true; } + +static bool readRateRange( osgDB::InputStream& is, osgParticle::VariableRateCounter& obj ) +{ + float min, max; is >> min >> max; + obj.setRateRange( min, max ); return true; +} + +static bool writeRateRange( osgDB::OutputStream& os, const osgParticle::VariableRateCounter& obj ) +{ + const osgParticle::rangef& range = obj.getRateRange(); + os << range.minimum << range.maximum << std::endl; + return true; +} + +REGISTER_OBJECT_WRAPPER( osgParticleVariableRateCounter, + /*new osgParticle::VariableRateCounter*/NULL, + osgParticle::VariableRateCounter, + "osg::Object osgParticle::Counter osgParticle::VariableRateCounter" ) +{ + ADD_USER_SERIALIZER( RateRange ); // _rate_range +}