Merged fixes to osgVolume's handling of ImageSequence animated volumes, merge command:
svn merge -r 9746:9747 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches/OpenSceneGraph-2.8
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <osgVolume/Layer>
|
||||
|
||||
#include <osg/ImageUtils>
|
||||
#include <osg/ImageStream>
|
||||
#include <osg/Endian>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
@@ -166,6 +167,16 @@ void ImageLayer::translateMinToZero()
|
||||
}
|
||||
}
|
||||
|
||||
bool ImageLayer::requiresUpdateTraversal() const
|
||||
{
|
||||
return dynamic_cast<osg::ImageStream*>(_image.get())!=0;
|
||||
}
|
||||
|
||||
void ImageLayer::update(osg::NodeVisitor& nv)
|
||||
{
|
||||
if (_image.valid()) _image->update(&nv);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CompositeLayer
|
||||
@@ -185,6 +196,30 @@ void CompositeLayer::clear()
|
||||
_layers.clear();
|
||||
}
|
||||
|
||||
bool CompositeLayer::requiresUpdateTraversal() const
|
||||
{
|
||||
for(Layers::const_iterator itr = _layers.begin();
|
||||
itr != _layers.end();
|
||||
++itr)
|
||||
{
|
||||
if (itr->layer->requiresUpdateTraversal()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CompositeLayer::update(osg::NodeVisitor& nv)
|
||||
{
|
||||
for(Layers::const_iterator itr = _layers.begin();
|
||||
itr != _layers.end();
|
||||
++itr)
|
||||
{
|
||||
itr->layer->update(nv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// createNormalMapTexture
|
||||
|
||||
@@ -49,6 +49,8 @@ VolumeTile::VolumeTile():
|
||||
_hasBeenTraversal(false)
|
||||
{
|
||||
setThreadSafeRefUnref(true);
|
||||
|
||||
setNumChildrenRequiringUpdateTraversal(1);
|
||||
}
|
||||
|
||||
VolumeTile::VolumeTile(const VolumeTile& volumeTile,const osg::CopyOp& copyop):
|
||||
@@ -58,6 +60,8 @@ VolumeTile::VolumeTile(const VolumeTile& volumeTile,const osg::CopyOp& copyop):
|
||||
_hasBeenTraversal(false),
|
||||
_layer(volumeTile._layer)
|
||||
{
|
||||
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
|
||||
|
||||
if (volumeTile.getVolumeTechnique())
|
||||
{
|
||||
setVolumeTechnique(osg::clone(volumeTile.getVolumeTechnique()));
|
||||
@@ -117,6 +121,12 @@ void VolumeTile::traverse(osg::NodeVisitor& nv)
|
||||
|
||||
_hasBeenTraversal = true;
|
||||
}
|
||||
|
||||
if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR &&
|
||||
_layer->requiresUpdateTraversal())
|
||||
{
|
||||
_layer->update(nv);
|
||||
}
|
||||
|
||||
if (_volumeTechnique.valid())
|
||||
{
|
||||
@@ -138,6 +148,11 @@ void VolumeTile::init()
|
||||
}
|
||||
}
|
||||
|
||||
void VolumeTile::setLayer(Layer* layer)
|
||||
{
|
||||
_layer = layer;
|
||||
}
|
||||
|
||||
void VolumeTile::setVolumeTechnique(VolumeTechnique* volumeTechnique)
|
||||
{
|
||||
if (_volumeTechnique == volumeTechnique) return;
|
||||
|
||||
Reference in New Issue
Block a user