Introduced CMake option OSG_PROVIDE_READFILE option that defaults to ON, but when switched to OFF disables the building of the osgDB::read*File() methods,

forcing users to use osgDB::readRef*File() methods.  The later is preferable as it closes a potential threading bug when using paging databases in conjunction
with the osgDB::Registry Object Cache.  This threading bug occurs when one thread gets an object from the Cache via an osgDB::read*File() call where only
a pointer to the object is passed back, so taking a reference to the object is delayed till it gets reassigned to a ref_ptr<>, but at the same time another
thread calls a flush of the Object Cache deleting this object as it's referenceCount is now zero.  Using osgDB::readREf*File() makes sure the a ref_ptr<> is
passed back and the referenceCount never goes to zero.

To ensure the OSG builds when OSG_PROVIDE_READFILE is to OFF the many cases of osgDB::read*File() usage had to be replaced with a ref_ptr<> osgDB::readRef*File()
usage.  The avoid this change causing lots of other client code to be rewritten to handle the use of ref_ptr<> in place of C pointer I introduced a serious of
templte methods in various class to adapt ref_ptr<> to the underly C pointer to be passed to old OSG API's, example of this is found in include/osg/Group:

    bool addChild(Node* child); // old method which can only be used with a Node*

    tempalte<class T> bool addChild(const osg::ref_ptr<T>& child) { return addChild(child.get()); } // adapter template method

These changes together cover 149 modified files, so it's a large submission. This extent of changes are warrent to make use of the Object Cache
and multi-threaded loaded more robust.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15164 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-10-22 13:42:19 +00:00
parent 79fb9abbbf
commit dd996a3289
295 changed files with 2503 additions and 2172 deletions

View File

@@ -54,12 +54,12 @@ static osg::Camera::Attachment readBufferAttachment( osgDB::InputStream& is )
else if ( type==1 )
{
is >> is.PROPERTY("Image");
attachment._image = dynamic_cast<osg::Image*>( is.readObject() );
attachment._image = is.readObjectOfType<osg::Image>();
}
else if ( type==2 )
{
is >> is.PROPERTY("Texture");
attachment._texture = dynamic_cast<osg::Texture*>( is.readObject() );
attachment._texture = is.readObjectOfType<osg::Texture>();
is >> is.PROPERTY("Level") >> attachment._level;
is >> is.PROPERTY("Face") >> attachment._face;
is >> is.PROPERTY("MipMapGeneration") >> attachment._mipMapGeneration;

View File

@@ -13,7 +13,7 @@ static bool readChildren( osgDB::InputStream& is, osg::CompositeShape& shape )
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Shape* child = dynamic_cast<osg::Shape*>( is.readObject() );
osg::ref_ptr<osg::Shape> child = is.readObjectOfType<osg::Shape>();
if ( child ) shape.addChild( child );
}
is >> is.END_BRACKET;

View File

@@ -15,7 +15,7 @@ static bool readDrawables( osgDB::InputStream& is, osg::Geode& node )
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Drawable* drawable = dynamic_cast<osg::Drawable*>( is.readObject() );
osg::ref_ptr<osg::Drawable> drawable = is.readObjectOfType<osg::Drawable>();
if ( drawable )
{
node.addDrawable( drawable );

View File

@@ -31,17 +31,18 @@ static bool checkHeights( const osg::HeightField& shape )
static bool readHeights( osgDB::InputStream& is, osg::HeightField& shape )
{
osg::FloatArray* array = dynamic_cast<osg::FloatArray*>( is.readArray() );
if ( array )
osg::ref_ptr<osg::Array> array = is.readArray();
osg::FloatArray* farray = dynamic_cast<osg::FloatArray*>( array.get() );
if ( farray )
{
unsigned int numCols = shape.getNumColumns(), numRows = shape.getNumRows();
if ( array->size()<numRows*numCols ) return false;
if ( farray->size()<numRows*numCols ) return false;
unsigned int index = 0;
for ( unsigned int r=0; r<numRows; ++r )
{
for ( unsigned int c=0; c<numCols; ++c )
shape.setHeight( c, r, (*array)[index++] );
shape.setHeight( c, r, (*farray)[index++] );
}
}
return true;

View File

@@ -48,7 +48,7 @@ static bool readImages( osgDB::InputStream& is, osg::ImageSequence& image )
unsigned int images = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<images; ++i )
{
osg::Image* img = dynamic_cast<osg::Image*>( is.readObject() );
osg::ref_ptr<osg::Image> img = is.readImage();
if ( img ) image.addImage( img );
}
is >> is.END_BRACKET;

View File

@@ -14,7 +14,7 @@ static bool checkUserData( const osg::Object& obj )
static bool readUserData( osgDB::InputStream& is, osg::Object& obj )
{
is >> is.BEGIN_BRACKET;
osg::Object* object = is.readObject();
osg::ref_ptr<osg::Object> object = is.readObject();
if(object) obj.setUserData(object);
is >> is.END_BRACKET;
return true;

View File

@@ -102,7 +102,7 @@ static bool readChildren( osgDB::InputStream& is, osg::PagedLOD& node )
is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() );
osg::ref_ptr<osg::Node> child = is.readObjectOfType<osg::Node>();
if ( child ) node.addChild( child );
}
is >> is.END_BRACKET;

View File

@@ -58,7 +58,7 @@ static bool readShaders( osgDB::InputStream& is, osg::Program& attr )
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Shader* shader = dynamic_cast<osg::Shader*>( is.readObject() );
osg::ref_ptr<osg::Shader> shader = is.readObjectOfType<osg::Shader>();
if ( shader ) attr.addShader( shader );
}
is >> is.END_BRACKET;

View File

@@ -50,7 +50,7 @@ static bool readChildren( osgDB::InputStream& is, osg::ProxyNode& node )
is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() );
osg::ref_ptr<osg::Node> child = is.readObjectOfType<osg::Node>();
if ( child ) node.addChild( child );
}
is >> is.END_BRACKET;
@@ -117,7 +117,7 @@ struct ProxyNodeFinishedObjectReadCallback : public osgDB::FinishedObjectReadCal
{
osgDB::FilePathList& fpl = ((osgDB::ReaderWriter::Options*)is.getOptions())->getDatabasePathList();
fpl.push_front( fpl.empty() ? osgDB::getFilePath(proxyNode.getFileName(i)) : fpl.front()+'/'+ osgDB::getFilePath(proxyNode.getFileName(i)));
osg::Node* node = osgDB::readNodeFile(proxyNode.getFileName(i), is.getOptions());
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile(proxyNode.getFileName(i), is.getOptions());
fpl.pop_front();
if(node)
proxyNode.insertChild(i, node);

View File

@@ -46,7 +46,7 @@ static void readAttributes( osgDB::InputStream& is, osg::StateSet::AttributeList
is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::StateAttribute* sa = dynamic_cast<osg::StateAttribute*>( is.readObject() );
osg::ref_ptr<osg::StateAttribute> sa = is.readObjectOfType<osg::StateAttribute>();
is >> is.PROPERTY("Value");
int value = readValue( is );
if ( sa )
@@ -144,7 +144,7 @@ static bool readAttributeList( osgDB::InputStream& is, osg::StateSet& ss )
for ( osg::StateSet::AttributeList::iterator itr=attrs.begin();
itr!=attrs.end(); ++itr )
{
ss.setAttribute( itr->second.first.get(), itr->second.second );
ss.setAttribute( itr->second.first, itr->second.second );
}
return true;
}
@@ -211,7 +211,7 @@ static bool readTextureAttributeList( osgDB::InputStream& is, osg::StateSet& ss
for ( osg::StateSet::AttributeList::iterator itr=attrs.begin();
itr!=attrs.end(); ++itr )
{
ss.setTextureAttribute( i, itr->second.first.get(), itr->second.second );
ss.setTextureAttribute( i, itr->second.first, itr->second.second );
}
attrs.clear();
}
@@ -244,7 +244,7 @@ static bool readUniformList( osgDB::InputStream& is, osg::StateSet& ss )
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Uniform* uniform = dynamic_cast<osg::Uniform*>( is.readObject() );
osg::ref_ptr<osg::Uniform> uniform = is.readObjectOfType<osg::Uniform>();
is >> is.PROPERTY("Value");
int value = readValue( is );
if ( uniform )

View File

@@ -13,7 +13,7 @@ static bool readImages( osgDB::InputStream& is, osg::Texture2DArray& tex )
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::Image* image = is.readImage();
osg::ref_ptr<osg::Image> image = is.readImage();
if ( image ) tex.setImage( i, image );
}
is >> is.END_BRACKET;

View File

@@ -8,7 +8,8 @@
return shape.get##PROP()!=NULL; \
} \
static bool read##PROP(osgDB::InputStream& is, osg::TriangleMesh& shape) { \
shape.set##PROP( dynamic_cast<TYPE*>(is.readArray()) ); \
osg::ref_ptr<osg::Array> array = is.readArray(); \
shape.set##PROP( dynamic_cast<TYPE*>(array.get()) ); \
return true; \
} \
static bool write##PROP(osgDB::OutputStream& os, const osg::TriangleMesh& shape) { \

View File

@@ -13,17 +13,17 @@ static bool readElements( osgDB::InputStream& is, osg::Uniform& uniform )
bool hasArray; is >> hasArray;
if ( hasArray )
{
osg::Array* array = is.readArray();
osg::ref_ptr<osg::Array> array = is.readArray();
switch ( array->getType() )
{
case osg::Array::FloatArrayType:
uniform.setArray( static_cast<osg::FloatArray*>(array) ); break;
uniform.setArray( static_cast<osg::FloatArray*>(array.get()) ); break;
case osg::Array::DoubleArrayType:
uniform.setArray( static_cast<osg::DoubleArray*>(array) ); break;
uniform.setArray( static_cast<osg::DoubleArray*>(array.get()) ); break;
case osg::Array::IntArrayType:
uniform.setArray( static_cast<osg::IntArray*>(array) ); break;
uniform.setArray( static_cast<osg::IntArray*>(array.get()) ); break;
case osg::Array::UIntArrayType:
uniform.setArray( static_cast<osg::UIntArray*>(array) ); break;
uniform.setArray( static_cast<osg::UIntArray*>(array.get()) ); break;
default: break;
}
}

View File

@@ -12,7 +12,7 @@ static bool checkUDC_UserData( const osg::DefaultUserDataContainer& udc )
static bool readUDC_UserData( osgDB::InputStream& is, osg::DefaultUserDataContainer& udc )
{
is >> is.BEGIN_BRACKET;
osg::Object* object = is.readObject();
osg::ref_ptr<osg::Object> object = is.readObject();
if(object) udc.setUserData(object);
is >> is.END_BRACKET;
return true;
@@ -70,7 +70,7 @@ static bool readUDC_UserObjects( osgDB::InputStream& is, osg::DefaultUserDataCon
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for( unsigned int i=0; i<size; ++i )
{
osg::Object* read_object = is.readObject();
osg::ref_ptr<osg::Object> read_object = is.readObject();
if (read_object) udc.addUserObject( read_object );
}
is >> is.END_BRACKET;

View File

@@ -16,8 +16,8 @@ static bool readAnimations( osgDB::InputStream& is, osgAnimation::AnimationManag
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgAnimation::Animation* ani = dynamic_cast<osgAnimation::Animation*>( is.readObject() );
if ( ani ) manager.registerAnimation( ani );
osg::ref_ptr<osgAnimation::Animation> ani = is.readObjectOfType<osgAnimation::Animation>();
if ( ani ) manager.registerAnimation( ani.get() );
}
is >> is.END_BRACKET;
return true;

View File

@@ -15,8 +15,8 @@ static bool readMorphTargets( osgDB::InputStream& is, osgAnimation::MorphGeometr
{
float weight = 0.0f;
is >> is.PROPERTY("MorphTarget") >> weight;
osg::Geometry* target = dynamic_cast<osg::Geometry*>( is.readObject() );
if ( target ) geom.addMorphTarget( target, weight );
osg::ref_ptr<osg::Geometry> target = is.readObjectOfType<osg::Geometry>();
if ( target ) geom.addMorphTarget( target.get(), weight );
}
is >> is.END_BRACKET;
return true;

View File

@@ -17,9 +17,8 @@ static bool readStackedTransforms( osgDB::InputStream& is, osgAnimation::UpdateM
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgAnimation::StackedTransformElement* element =
dynamic_cast<osgAnimation::StackedTransformElement*>( is.readObject() );
if ( element ) transform.push_back( element );
osg::ref_ptr<osgAnimation::StackedTransformElement> element = is.readObjectOfType<osgAnimation::StackedTransformElement>();
if ( element ) transform.push_back( element.get() );
}
is >> is.END_BRACKET;
return true;

View File

@@ -13,7 +13,8 @@ static bool checkLightingMap( const osgFX::AnisotropicLighting& effect )
static bool readLightingMap( osgDB::InputStream& is, osgFX::AnisotropicLighting& effect )
{
std::string fileName; is.readWrappedString( fileName );
effect.setLightingMap( osgDB::readImageFile(fileName) );
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(fileName, is.getOptions());
effect.setLightingMap( image.get() );
return true;
}

View File

@@ -13,7 +13,7 @@ static bool readDraggers( osgDB::InputStream& is, osgManipulator::CompositeDragg
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgManipulator::Dragger* child = dynamic_cast<osgManipulator::Dragger*>( is.readObject() );
osg::ref_ptr<osgManipulator::Dragger> child = is.readObjectOfType<osgManipulator::Dragger>();
if ( child ) dragger.addDragger( child );
}
is >> is.END_BRACKET;

View File

@@ -18,8 +18,8 @@ static bool readTransformUpdating( osgDB::InputStream& is, osgManipulator::Dragg
std::string name; is >> name >> is.BEGIN_BRACKET;
if ( name=="DraggerTransformCallback" )
{
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>( is.readObject() );
if ( transform ) dragger.addTransformUpdating( transform );
osg::ref_ptr<osg::MatrixTransform> transform = is.readObjectOfType<osg::MatrixTransform>();
if ( transform ) dragger.addTransformUpdating( transform.get() );
}
is >> is.END_BRACKET;
}

View File

@@ -7,7 +7,7 @@
static bool check##PROP( const osgManipulator::Scale1DDragger& dragger ) \
{ return dragger.get##PROP()!=NULL; } \
static bool read##PROP( osgDB::InputStream& is, osgManipulator::Scale1DDragger& dragger ) { \
osg::Node* node = dynamic_cast<osg::Node*>( is.readObject() ); \
osg::ref_ptr<osg::Node> node = is.readObjectOfType<osg::Node>(); \
if ( node ) dragger.set##PROP( *node ); return true; \
} \
static bool write##PROP( osgDB::OutputStream& os, const osgManipulator::Scale1DDragger& dragger ) { \

View File

@@ -7,7 +7,7 @@
static bool check##PROP( const osgManipulator::Scale2DDragger& dragger ) \
{ return dragger.get##PROP()!=NULL; } \
static bool read##PROP( osgDB::InputStream& is, osgManipulator::Scale2DDragger& dragger ) { \
osg::Node* node = dynamic_cast<osg::Node*>( is.readObject() ); \
osg::ref_ptr<osg::Node> node = is.readObjectOfType<osg::Node>(); \
if ( node ) dragger.set##PROP( *node ); return true; \
} \
static bool write##PROP( osgDB::OutputStream& os, const osgManipulator::Scale2DDragger& dragger ) { \

View File

@@ -13,8 +13,8 @@ static bool readPlacers( osgDB::InputStream& is, osgParticle::CompositePlacer& c
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgParticle::Placer* p = dynamic_cast<osgParticle::Placer*>( is.readObject() );
if ( p ) cp.addPlacer( p );
osg::ref_ptr<osgParticle::Placer> p = is.readObjectOfType<osgParticle::Placer>();
if ( p ) cp.addPlacer( p.get() );
}
is >> is.END_BRACKET;
return true;

View File

@@ -13,8 +13,8 @@ static bool readOperators( osgDB::InputStream& is, osgParticle::ModularProgram&
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgParticle::Operator* op = dynamic_cast<osgParticle::Operator*>( is.readObject() );
if ( op ) prog.addOperator( op );
osg::ref_ptr<osgParticle::Operator> op = is.readObjectOfType<osgParticle::Operator>();
if ( op ) prog.addOperator( op.get() );
}
is >> is.END_BRACKET;
return true;

View File

@@ -35,21 +35,21 @@ bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p )
if ( hasInterpolator )
{
is >> is.BEGIN_BRACKET;
p.setSizeInterpolator( static_cast<osgParticle::Interpolator*>(is.readObject()) );
p.setAlphaInterpolator( is.readObjectOfType<osgParticle::Interpolator>() );
is >> is.END_BRACKET;
}
is >> is.PROPERTY("AlphaInterpolator") >> hasInterpolator;
if ( hasInterpolator )
{
is >> is.BEGIN_BRACKET;
p.setAlphaInterpolator( static_cast<osgParticle::Interpolator*>(is.readObject()) );
p.setAlphaInterpolator( is.readObjectOfType<osgParticle::Interpolator>() );
is >> is.END_BRACKET;
}
is >> is.PROPERTY("ColorInterpolator") >> hasInterpolator;
if ( hasInterpolator )
{
is >> is.BEGIN_BRACKET;
p.setColorInterpolator( static_cast<osgParticle::Interpolator*>(is.readObject()) );
p.setAlphaInterpolator( is.readObjectOfType<osgParticle::Interpolator>() );
is >> is.END_BRACKET;
}
@@ -73,7 +73,7 @@ bool readParticle( osgDB::InputStream& is, osgParticle::Particle& p )
if ( hasObject )
{
is >> is.BEGIN_BRACKET;
p.setDrawable( dynamic_cast<osg::Drawable*>(is.readObject()) );
p.setDrawable( is.readObjectOfType<osg::Drawable>() );
is >> is.END_BRACKET;
}

View File

@@ -13,7 +13,8 @@ static bool readParticleSystem( osgDB::InputStream& is, osgParticle::ParticleEff
{
is >> is.BEGIN_BRACKET;
effect.setUseLocalParticleSystem( false );
effect.setParticleSystem( static_cast<osgParticle::ParticleSystem*>(is.readObject()) );
osg::ref_ptr<osgParticle::ParticleSystem> ps = is.readObjectOfType<osgParticle::ParticleSystem>();
effect.setParticleSystem( ps.get() );
is >> is.END_BRACKET;
return true;
}

View File

@@ -13,8 +13,8 @@ static bool readParticleSystems( osgDB::InputStream& is, osgParticle::ParticleSy
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgParticle::ParticleSystem* ps = dynamic_cast<osgParticle::ParticleSystem*>( is.readObject() );
if ( ps ) updater.addParticleSystem( ps );
osg::ref_ptr<osgParticle::ParticleSystem> ps = is.readObjectOfType<osgParticle::ParticleSystem>();
if ( ps ) updater.addParticleSystem( ps.get() );
}
is >> is.END_BRACKET;
return true;

View File

@@ -26,14 +26,14 @@ static bool readLightPointList( osgDB::InputStream& is, osgSim::LightPointNode&
if ( hasObject )
{
is >> is.BEGIN_BRACKET;
pt._sector = dynamic_cast<osgSim::Sector*>( is.readObject() );
pt._sector = is.readObjectOfType<osgSim::Sector>();
is >> is.END_BRACKET;
}
hasObject = false; is >> is.PROPERTY("BlinkSequence") >> hasObject;
if ( hasObject )
{
is >> is.BEGIN_BRACKET;
pt._blinkSequence = dynamic_cast<osgSim::BlinkSequence*>( is.readObject() );
pt._blinkSequence = is.readObjectOfType<osgSim::BlinkSequence>();
is >> is.END_BRACKET;
}
is >> is.END_BRACKET;

View File

@@ -75,9 +75,8 @@ static bool checkScalarPrinter( const osgSim::ScalarBar& bar )
static bool readScalarPrinter( osgDB::InputStream& is, osgSim::ScalarBar& bar )
{
is >> is.BEGIN_BRACKET;
osgSim::ScalarBar::ScalarPrinter* sp =
dynamic_cast<osgSim::ScalarBar::ScalarPrinter*>( is.readObject() );
if ( sp ) bar.setScalarPrinter( sp );
osg::ref_ptr<osgSim::ScalarBar::ScalarPrinter> sp = is.readObjectOfType<osgSim::ScalarBar::ScalarPrinter>();
if ( sp ) bar.setScalarPrinter( sp.get() );
is >> is.END_BRACKET;
return true;
}

View File

@@ -17,7 +17,7 @@ static bool readLayers( osgDB::InputStream& is, osgTerrain::CompositeLayer& laye
is >> type;
if ( type=="Object" )
{
osgTerrain::Layer* child = dynamic_cast<osgTerrain::Layer*>( is.readObject() );
osg::ref_ptr<osgTerrain::Layer> child = is.readObjectOfType<osgTerrain::Layer>();
if ( child ) layer.addLayer( child );
}
else if ( type=="File" )

View File

@@ -36,7 +36,7 @@ static bool readColorLayers( osgDB::InputStream& is, osgTerrain::TerrainTile& ti
for ( unsigned int i=0; i<numValidLayers; ++i )
{
unsigned int layerNum=0; is >> is.PROPERTY("Layer") >> layerNum;
osgTerrain::Layer* layer = dynamic_cast<osgTerrain::Layer*>( is.readObject() );
osg::ref_ptr<osgTerrain::Layer> layer = is.readObjectOfType<osgTerrain::Layer>();
if ( layer ) tile.setColorLayer( layerNum, layer );
}
is >> is.END_BRACKET;

View File

@@ -12,7 +12,8 @@ static bool checkFont( const osgText::TextBase& text )
static bool readFont( osgDB::InputStream& is, osgText::TextBase& text )
{
std::string fontName; is.readWrappedString( fontName );
text.setFont( osgText::readFontFile(fontName) );
osg::ref_ptr<osgText::Font> font = osgText::readRefFontFile(fontName);
text.setFont( font );
return true;
}
@@ -77,11 +78,12 @@ static bool readText( osgDB::InputStream& is, osgText::TextBase& text )
}
else
{
osg::UIntArray* array = dynamic_cast<osg::UIntArray*>( is.readArray() );
if ( array )
osg::ref_ptr<osg::Array> array = is.readArray();
osg::UIntArray* uiarray = dynamic_cast<osg::UIntArray*>( array.get() );
if ( uiarray )
{
osgText::String string;
for ( osg::UIntArray::iterator itr=array->begin(); itr!=array->end(); ++itr )
for ( osg::UIntArray::iterator itr=uiarray->begin(); itr!=uiarray->end(); ++itr )
{
string.push_back( *itr );
}

View File

@@ -13,7 +13,7 @@ static bool readLayers( osgDB::InputStream& is, osgVolume::CompositeLayer& layer
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgVolume::Layer* child = dynamic_cast<osgVolume::Layer*>( is.readObject() );
osg::ref_ptr<osgVolume::Layer> child = is.readObjectOfType<osgVolume::Layer>();
if ( child ) layer.addLayer( child );
}
is >> is.END_BRACKET;

View File

@@ -13,7 +13,7 @@ static bool readProperties( osgDB::InputStream& is, osgVolume::CompositeProperty
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgVolume::Property* child = dynamic_cast<osgVolume::Property*>( is.readObject() );
osg::ref_ptr<osgVolume::Property> child = is.readObjectOfType<osgVolume::Property>();
if ( child ) prop.addProperty( child );
}
is >> is.END_BRACKET;

View File

@@ -13,8 +13,7 @@ static bool readLocatorCallbacks( osgDB::InputStream& is, osgVolume::Locator& lo
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osgVolume::Locator::LocatorCallback* cb =
dynamic_cast<osgVolume::Locator::LocatorCallback*>( is.readObject() );
osg::ref_ptr<osgVolume::Locator::LocatorCallback> cb = is.readObjectOfType<osgVolume::Locator::LocatorCallback>();
if ( cb ) locator.addCallback( cb );
}
is >> is.END_BRACKET;