1
#include <osgVolume/Layer>
2
#include <osgDB/ObjectWrapper>
3
#include <osgDB/InputStream>
4
#include <osgDB/OutputStream>
6
static bool checkLayers( const osgVolume::CompositeLayer& layer )
8
return layer.getNumLayers()>0;
11
static bool readLayers( osgDB::InputStream& is, osgVolume::CompositeLayer& layer )
13
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
14
for ( unsigned int i=0; i<size; ++i )
16
osgVolume::Layer* child = dynamic_cast<osgVolume::Layer*>( is.readObject() );
17
if ( child ) layer.addLayer( child );
19
is >> osgDB::END_BRACKET;
23
static bool writeLayers( osgDB::OutputStream& os, const osgVolume::CompositeLayer& layer )
25
unsigned int size = layer.getNumLayers();
26
os << size << osgDB::BEGIN_BRACKET << std::endl;
27
for ( unsigned int i=0; i<size; ++i )
29
os << layer.getLayer(i);
31
os << osgDB::END_BRACKET << std::endl;
35
REGISTER_OBJECT_WRAPPER( osgVolume_CompositeLayer,
36
new osgVolume::CompositeLayer,
37
osgVolume::CompositeLayer,
38
"osg::Object osgVolume::Layer osgVolume::CompositeLayer" )
40
ADD_USER_SERIALIZER( Layers ); // _layers