Show
Ignore:
Timestamp:
10/01/09 22:19:42 (5 years ago)
Author:
robert
Message:

Introduced new BufferObject? design + implementation in preperation of implementing a pool system for buffer objects

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osg/Image

    r9913 r10600  
    6262 
    6363/** Image class for encapsulating the storage texture image data. */ 
    64 class OSG_EXPORT Image : public Object 
     64class OSG_EXPORT Image : public BufferData 
    6565{ 
    6666 
     
    7777        virtual const char* libraryName() const { return "osg"; } 
    7878        virtual const char* className() const { return "Image"; } 
     79 
     80        virtual const GLvoid*   getDataPointer() const { return data(); } 
     81        virtual unsigned int    getTotalDataSize() const { return getTotalSizeInBytesIncludingMipmaps(); } 
    7982 
    8083        /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ 
     
    253256        */ 
    254257        void ensureValidSizeForTexturing(GLint maxTextureSize); 
    255        
    256         /** Dirty the image, which increments the modified count, to force osg::Texture to reload the image. */ 
    257         inline void dirty() { ++_modifiedCount; if (_bufferObject.valid()) _bufferObject->dirty(); }       
    258        
    259         /** Set the modified count value. Used by osg::Texture when using texture subloading. */ 
    260         inline void setModifiedCount(unsigned int value) { _modifiedCount=value; } 
    261  
    262         /** Get modified count value. Used by osg::Texture when using texture subloading. */ 
    263         inline unsigned int getModifiedCount() const { return _modifiedCount; } 
    264  
    265258 
    266259        static bool isPackedType(GLenum type); 
     
    317310 
    318311        /** Set the optional PixelBufferObject used to map the image memory efficiently to graphics memory. */  
    319         void setPixelBufferObject(PixelBufferObject* buffer) { _bufferObject = buffer; if (_bufferObject.valid()) _bufferObject->setImage(this); } 
    320  
    321         /** Get the PixelBufferObject.*/  
    322         PixelBufferObject* getPixelBufferObject() { return _bufferObject.get(); } 
    323  
    324         /** Get the const PixelBufferObject.*/  
    325         const PixelBufferObject* getPixelBufferObject() const { return _bufferObject.get(); } 
     312        void setPixelBufferObject(PixelBufferObject* buffer) { setBufferObject(buffer); } 
     313 
     314        /** Get the PixelBufferObject.*/ 
     315        PixelBufferObject* getPixelBufferObject() { return dynamic_cast<PixelBufferObject*>(_bufferObject.get()); } 
     316 
     317        /** Get the const PixelBufferObject.*/ 
     318        const PixelBufferObject* getPixelBufferObject() const { return dynamic_cast<const PixelBufferObject*>(_bufferObject.get()); } 
    326319        
    327         virtual void update(NodeVisitor* /*nv*/) {}         
     320        virtual void update(NodeVisitor* /*nv*/) {} 
    328321 
    329322        /** 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. */ 
     
    361354         
    362355        void setData(unsigned char* data,AllocationMode allocationMode); 
    363  
    364         unsigned int _modifiedCount; 
    365356 
    366357        MipmapDataType _mipmapData;