| 1 | #include <osgParticle/RadialShooter> |
|---|
| 2 | #include <osgDB/ObjectWrapper> |
|---|
| 3 | #include <osgDB/InputStream> |
|---|
| 4 | #include <osgDB/OutputStream> |
|---|
| 5 | |
|---|
| 6 | #define RADIALSHOOTER_FLOAT_FUNCTION( PROP ) \ |
|---|
| 7 | static bool check##PROP( const osgParticle::RadialShooter& obj ) { return true; } \ |
|---|
| 8 | static bool read##PROP( osgDB::InputStream& is, osgParticle::RadialShooter& obj ) { \ |
|---|
| 9 | float min, max; is >> min >> max; \ |
|---|
| 10 | obj.set##PROP( min, max ); return true; \ |
|---|
| 11 | } \ |
|---|
| 12 | static bool write##PROP( osgDB::OutputStream& os, const osgParticle::RadialShooter& obj ) { \ |
|---|
| 13 | const osgParticle::rangef& range = obj.get##PROP(); \ |
|---|
| 14 | os << range.minimum << range.maximum << std::endl; \ |
|---|
| 15 | return true; \ |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | #define RADIALSHOOTER_VEC3_FUNCTION( PROP ) \ |
|---|
| 19 | static bool check##PROP( const osgParticle::RadialShooter& obj ) { return true; } \ |
|---|
| 20 | static bool read##PROP( osgDB::InputStream& is, osgParticle::RadialShooter& obj ) { \ |
|---|
| 21 | osg::Vec3d min, max; is >> min >> max; \ |
|---|
| 22 | obj.set##PROP( min, max ); return true; \ |
|---|
| 23 | } \ |
|---|
| 24 | static bool write##PROP( osgDB::OutputStream& os, const osgParticle::RadialShooter& obj ) { \ |
|---|
| 25 | const osgParticle::rangev3& range = obj.get##PROP(); \ |
|---|
| 26 | os << osg::Vec3d(range.minimum) << osg::Vec3d(range.maximum) << std::endl; \ |
|---|
| 27 | return true; \ |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | RADIALSHOOTER_FLOAT_FUNCTION( ThetaRange ) |
|---|
| 31 | RADIALSHOOTER_FLOAT_FUNCTION( PhiRange ) |
|---|
| 32 | RADIALSHOOTER_FLOAT_FUNCTION( InitialSpeedRange ) |
|---|
| 33 | RADIALSHOOTER_VEC3_FUNCTION( InitialRotationalSpeedRange ) |
|---|
| 34 | |
|---|
| 35 | REGISTER_OBJECT_WRAPPER( osgParticleRadialShooter, |
|---|
| 36 | new osgParticle::RadialShooter, |
|---|
| 37 | osgParticle::RadialShooter, |
|---|
| 38 | "osg::Object osgParticle::Shooter osgParticle::RadialShooter" ) |
|---|
| 39 | { |
|---|
| 40 | ADD_USER_SERIALIZER( ThetaRange ); |
|---|
| 41 | ADD_USER_SERIALIZER( PhiRange ); |
|---|
| 42 | ADD_USER_SERIALIZER( InitialSpeedRange ); |
|---|
| 43 | ADD_USER_SERIALIZER( InitialRotationalSpeedRange ); |
|---|
| 44 | } |
|---|