Show
Ignore:
Timestamp:
01/07/10 13:14:47 (4 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/include/osg/Image

    r10866 r10924  
    2020#include <osg/Vec4> 
    2121#include <osg/FrameStamp> 
     22#include <osg/StateAttribute> 
    2223 
    2324#include <string> 
     
    321322        /** Get the const PixelBufferObject.*/ 
    322323        const PixelBufferObject* getPixelBufferObject() const { return dynamic_cast<const PixelBufferObject*>(_bufferObject.get()); } 
    323         
     324 
     325        /** return whether the update(NodeVisitor* nv) should be required on each frame to enable proper working of osg::Image.*/ 
     326        virtual bool requiresUpdateCall() const { return false; } 
     327 
     328        /** update method for osg::Image subclasses that update themselves during the update traversal.*/ 
    324329        virtual void update(NodeVisitor* /*nv*/) {} 
     330 
     331        /** convience update callback class that can be attached to StateAttribute (such as Textures) to ensure 
     332          * that the Image::update(NodeVisitor*) method is called during the update traversal.  This callback 
     333          * is automatically attached when Image::requiresUpdateCall() is true (it's false by default.) 
     334          */ 
     335        struct OSG_EXPORT UpdateCallback : public osg::StateAttributeCallback 
     336        { 
     337            virtual void operator () (osg::StateAttribute* attr, osg::NodeVisitor* nv); 
     338        }; 
    325339 
    326340        /** method for sending pointer events to images that are acting as front ends to interactive surfaces such as a vnc or browser window.  Return true if handled. */