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

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

From Wang Rui, added osgParticle serializers

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