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

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

From Wang Rui, added osgParticle serializers

Line 
1#include <osgParticle/Emitter>
2#include <osgDB/ObjectWrapper>
3#include <osgDB/InputStream>
4#include <osgDB/OutputStream>
5
6extern bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p );
7extern bool writeParticle( osgDB::OutputStream& os, const osgParticle::Particle& p );
8
9static bool checkParticleTemplate( const osgParticle::Emitter& emitter )
10{
11    return !emitter.getUseDefaultTemplate();
12}
13
14static bool readParticleTemplate( osgDB::InputStream& is, osgParticle::Emitter& emitter )
15{
16    osgParticle::Particle p;
17    readParticle( is, p );
18    emitter.setParticleTemplate( p );
19    return true;
20}
21
22static bool writeParticleTemplate( osgDB::OutputStream& os, const osgParticle::Emitter& emitter )
23{
24    const osgParticle::Particle& p = emitter.getParticleTemplate();
25    writeParticle( os, p );
26    return true;
27}
28
29REGISTER_OBJECT_WRAPPER( osgParticleEmitter,
30                         /*new osgParticle::Emitter*/NULL,
31                         osgParticle::Emitter,
32                         "osg::Object osg::Node osgParticle::ParticleProcessor osgParticle::Emitter" )
33{
34    ADD_BOOL_SERIALIZER( UseDefaultTemplate, true );  // _usedeftemp
35    ADD_USER_SERIALIZER( ParticleTemplate );  // _ptemp
36}
Note: See TracBrowser for help on using the browser.