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;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <osg/BoundingSphere>
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Image>
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/Object>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Vec4>
|
||||
@@ -108,6 +109,16 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::CompositeLayer)
|
||||
__unsigned_int__getNumLayers,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, requiresUpdateTraversal,
|
||||
Properties::VIRTUAL,
|
||||
__bool__requiresUpdateTraversal,
|
||||
"Specify whether ImageLayer requires update traversal. ",
|
||||
"");
|
||||
I_Method1(void, update, IN, osg::NodeVisitor &, x,
|
||||
Properties::VIRTUAL,
|
||||
__void__update__osg_NodeVisitor_R1,
|
||||
"Call update on the Layer. ",
|
||||
"");
|
||||
I_IndexedProperty(const std::string &, FileName,
|
||||
__C5_std_string_R1__getFileName__unsigned_int,
|
||||
__void__setFileName__unsigned_int__C5_std_string_R1,
|
||||
@@ -203,6 +214,16 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::ImageLayer)
|
||||
__void__translateMinToZero,
|
||||
"Compute the min color component of the image and then translate and pixels by this offset to make the new min component 0. ",
|
||||
"");
|
||||
I_Method0(bool, requiresUpdateTraversal,
|
||||
Properties::VIRTUAL,
|
||||
__bool__requiresUpdateTraversal,
|
||||
"Specify whether ImageLayer requires update traversal. ",
|
||||
"");
|
||||
I_Method1(void, update, IN, osg::NodeVisitor &, x,
|
||||
Properties::VIRTUAL,
|
||||
__void__update__osg_NodeVisitor_R1,
|
||||
"Call update on the Layer. ",
|
||||
"");
|
||||
I_Method0(void, dirty,
|
||||
Properties::VIRTUAL,
|
||||
__void__dirty,
|
||||
@@ -349,6 +370,16 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::Layer)
|
||||
__void__addProperty__Property_P1,
|
||||
"Add a property, automatically creating a CompositePorperty if one isn't already assigned. ",
|
||||
"");
|
||||
I_Method0(bool, requiresUpdateTraversal,
|
||||
Properties::VIRTUAL,
|
||||
__bool__requiresUpdateTraversal,
|
||||
"Specify whether ImageLayer requires update traversal. ",
|
||||
"");
|
||||
I_Method1(void, update, IN, osg::NodeVisitor &, x,
|
||||
Properties::VIRTUAL,
|
||||
__void__update__osg_NodeVisitor_R1,
|
||||
"Call update on the Layer. ",
|
||||
"");
|
||||
I_Method0(void, dirty,
|
||||
Properties::VIRTUAL,
|
||||
__void__dirty,
|
||||
|
||||
Reference in New Issue
Block a user