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

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

From Wang Rui, added osgParticle serializers

Line 
1#include <osgParticle/ParticleEffect>
2#include <osgDB/ObjectWrapper>
3#include <osgDB/InputStream>
4#include <osgDB/OutputStream>
5
6// _particleSystem
7static bool checkParticleSystem( const osgParticle::ParticleEffect& effect )
8{
9    return (!effect.getUseLocalParticleSystem()) && (effect.getParticleSystem()!=NULL);
10}
11
12static bool readParticleSystem( osgDB::InputStream& is, osgParticle::ParticleEffect& effect )
13{
14    is >> osgDB::BEGIN_BRACKET;
15    effect.setUseLocalParticleSystem( false );
16    effect.setParticleSystem( static_cast<osgParticle::ParticleSystem*>(is.readObject()) );
17    is >> osgDB::END_BRACKET;
18    return true;
19}
20
21static bool writeParticleSystem( osgDB::OutputStream& os, const osgParticle::ParticleEffect& effect )
22{
23    os << osgDB::BEGIN_BRACKET << std::endl;
24    os << effect.getParticleSystem();
25    os << osgDB::END_BRACKET << std::endl;
26    return true;
27}
28
29REGISTER_OBJECT_WRAPPER( osgParticleParticleEffect,
30                         /*new osgParticle::ParticleEffect*/NULL,
31                         osgParticle::ParticleEffect,
32                         "osg::Object osg::Node osg::Group osgParticle::ParticleEffect" )
33{
34    ADD_USER_SERIALIZER( ParticleSystem );  // _particleSystem
35    ADD_STRING_SERIALIZER( TextureFileName, "" );  // _textureFileName
36    ADD_VEC3_SERIALIZER( Position, osg::Vec3() );  // _position
37    ADD_FLOAT_SERIALIZER( Scale, 0.0f );  // _scale
38    ADD_FLOAT_SERIALIZER( Intensity, 0.0f );  // _intensity
39    ADD_DOUBLE_SERIALIZER( StartTime, 0.0 );  // _startTime
40    ADD_DOUBLE_SERIALIZER( EmitterDuration, 0.0 );  // _emitterDuration
41    ADD_VEC3_SERIALIZER( Wind, osg::Vec3() );  // _wind
42}
Note: See TracBrowser for help on using the browser.