~ubuntu-branches/debian/experimental/openscenegraph/experimental

« back to all changes in this revision

Viewing changes to OpenSceneGraph/src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Luaces
  • Date: 2011-01-29 11:36:29 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110129113629-qisrm2kdqlurc7t3
Tags: 2.9.11-1
* Removed bug-555869-ftbfs_with_binutils_gold.dpatch since upstream has
  already taken care of the issue.
* Removed bug-528229.dpatch since the pkgconfig files are now also split
  in upstream.
* Removed explicit dependency on GLU.
* Upstream no longer includes osgIntrospection (Closes: #592420).
* Disabled zip plugin as its implementation stores an embedded copy of
  zlib.
* Enabled Qt support. Thanks James Goppert.
* Enabled SVG and PDF plugins. Thanks James Goppert.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <osgVolume/Layer>
 
2
#include <osgDB/ObjectWrapper>
 
3
#include <osgDB/InputStream>
 
4
#include <osgDB/OutputStream>
 
5
 
 
6
static bool checkLayers( const osgVolume::CompositeLayer& layer )
 
7
{
 
8
    return layer.getNumLayers()>0;
 
9
}
 
10
 
 
11
static bool readLayers( osgDB::InputStream& is, osgVolume::CompositeLayer& layer )
 
12
{
 
13
    unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
 
14
    for ( unsigned int i=0; i<size; ++i )
 
15
    {
 
16
        osgVolume::Layer* child = dynamic_cast<osgVolume::Layer*>( is.readObject() );
 
17
        if ( child ) layer.addLayer( child );
 
18
    }
 
19
    is >> osgDB::END_BRACKET;
 
20
    return true;
 
21
}
 
22
 
 
23
static bool writeLayers( osgDB::OutputStream& os, const osgVolume::CompositeLayer& layer )
 
24
{
 
25
    unsigned int size = layer.getNumLayers();
 
26
    os << size << osgDB::BEGIN_BRACKET << std::endl;
 
27
    for ( unsigned int i=0; i<size; ++i )
 
28
    {
 
29
        os << layer.getLayer(i);
 
30
    }
 
31
    os << osgDB::END_BRACKET << std::endl;
 
32
    return true;
 
33
}
 
34
 
 
35
REGISTER_OBJECT_WRAPPER( osgVolume_CompositeLayer,
 
36
                         new osgVolume::CompositeLayer,
 
37
                         osgVolume::CompositeLayer,
 
38
                         "osg::Object osgVolume::Layer osgVolume::CompositeLayer" )
 
39
{
 
40
    ADD_USER_SERIALIZER( Layers );  // _layers
 
41
}