From c6b293dbcf9843f689e08eb6c526f292036ece65 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 21 Jun 2010 14:42:18 +0000 Subject: [PATCH] Implement support for compound name only entries in CompositeLayer --- .../serializers/osgTerrain/CompositeLayer.cpp | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/osgWrappers/serializers/osgTerrain/CompositeLayer.cpp b/src/osgWrappers/serializers/osgTerrain/CompositeLayer.cpp index c817c9f9a..4f0caff3c 100644 --- a/src/osgWrappers/serializers/osgTerrain/CompositeLayer.cpp +++ b/src/osgWrappers/serializers/osgTerrain/CompositeLayer.cpp @@ -13,8 +13,19 @@ static bool readLayers( osgDB::InputStream& is, osgTerrain::CompositeLayer& laye unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; for ( unsigned int i=0; i( is.readObject() ); - if ( child ) layer.addLayer( child ); + std::string type; + is >> type; + if ( type=="Object" ) + { + osgTerrain::Layer* child = dynamic_cast( is.readObject() ); + if ( child ) layer.addLayer( child ); + } + else if ( type=="File" ) + { + std::string compoundname; + is.readWrappedString( compoundname ); + layer.addLayer( compoundname ); + } } is >> osgDB::END_BRACKET; return true; @@ -26,7 +37,18 @@ static bool writeLayers( osgDB::OutputStream& os, const osgTerrain::CompositeLay os << size << osgDB::BEGIN_BRACKET << std::endl; for ( unsigned int i=0; i