root/OpenSceneGraph/trunk/src/osgWrappers/serializers/osgParticle/SectorPlacer.cpp @ 11020

Revision 11020, 1.1 kB (checked in by robert, 5 years ago)

From Wang Rui, added osgParticle serializers

Line 
1#include <osgParticle/SectorPlacer>
2#include <osgDB/ObjectWrapper>
3#include <osgDB/InputStream>
4#include <osgDB/OutputStream>
5
6#define SECTORPLACER_FUNCTION( PROP ) \
7    static bool check##PROP( const osgParticle::SectorPlacer& obj ) { return true; } \
8    static bool read##PROP( osgDB::InputStream& is, osgParticle::SectorPlacer& 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::SectorPlacer& obj ) { \
13        const osgParticle::rangef& range = obj.get##PROP(); \
14        os << range.minimum << range.maximum << std::endl; \
15        return true; \
16    }
17
18SECTORPLACER_FUNCTION( RadiusRange )
19SECTORPLACER_FUNCTION( PhiRange )
20
21REGISTER_OBJECT_WRAPPER( osgParticleSectorPlacer,
22                         new osgParticle::SectorPlacer,
23                         osgParticle::SectorPlacer,
24                         "osg::Object osgParticle::Placer osgParticle::CenteredPlacer osgParticle::SectorPlacer" )
25{
26    ADD_USER_SERIALIZER( RadiusRange );  // _rad_range
27    ADD_USER_SERIALIZER( PhiRange );  // _phi_range
28}
Note: See TracBrowser for help on using the browser.