Show
Ignore:
Timestamp:
01/07/10 13:14:47 (5 years ago)
Author:
robert
Message:

Refactored the way that osg::Image/ImageSequence manages the update callback that needs to be attached to Textures to make it possible to use the Image::update() mechansim in other subclasses from osg::Image.
To enable the automatic attachment of the required update callback to call osg::Image::update(..) subclasses from osg::Image will
need to implement the osg::Image::requestUpdateCall() and return true, and implement the osg::Image::update(NodeVisitor?*) method to recieve the update call during the update traversal.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/Texture2D.cpp

    r10865 r10924  
    1414#include <osg/GLExtensions> 
    1515#include <osg/Texture2D> 
    16 #include <osg/ImageSequence> 
    1716#include <osg/State> 
    1817#include <osg/Notify> 
     
    111110    if (_image == image) return; 
    112111 
    113     if (dynamic_cast<osg::ImageSequence*>(_image.get())) 
     112    if (_image.valid() && _image->requiresUpdateCall()) 
    114113    { 
    115114        setUpdateCallback(0); 
     
    119118    _image = image; 
    120119    _modifiedCount.setAllElementsTo(0); 
    121      
    122     if (dynamic_cast<osg::ImageSequence*>(_image.get())) 
    123     { 
    124         setUpdateCallback(new ImageSequence::UpdateCallback()); 
     120 
     121    if (_image.valid() && _image->requiresUpdateCall()) 
     122    { 
     123        setUpdateCallback(new Image::UpdateCallback()); 
    125124        setDataVariance(osg::Object::DYNAMIC); 
    126125    }