Introduced new BufferObject design + implementation in preperation of implementing a pool system for buffer objects
This commit is contained in:
@@ -61,7 +61,7 @@ namespace osg {
|
||||
class NodeVisitor;
|
||||
|
||||
/** Image class for encapsulating the storage texture image data. */
|
||||
class OSG_EXPORT Image : public Object
|
||||
class OSG_EXPORT Image : public BufferData
|
||||
{
|
||||
|
||||
public :
|
||||
@@ -77,6 +77,9 @@ class OSG_EXPORT Image : public Object
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "Image"; }
|
||||
|
||||
virtual const GLvoid* getDataPointer() const { return data(); }
|
||||
virtual unsigned int getTotalDataSize() const { return getTotalSizeInBytesIncludingMipmaps(); }
|
||||
|
||||
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
|
||||
virtual int compare(const Image& rhs) const;
|
||||
|
||||
@@ -252,16 +255,6 @@ class OSG_EXPORT Image : public Object
|
||||
* the host machine.
|
||||
*/
|
||||
void ensureValidSizeForTexturing(GLint maxTextureSize);
|
||||
|
||||
/** Dirty the image, which increments the modified count, to force osg::Texture to reload the image. */
|
||||
inline void dirty() { ++_modifiedCount; if (_bufferObject.valid()) _bufferObject->dirty(); }
|
||||
|
||||
/** Set the modified count value. Used by osg::Texture when using texture subloading. */
|
||||
inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
|
||||
|
||||
/** Get modified count value. Used by osg::Texture when using texture subloading. */
|
||||
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
||||
|
||||
|
||||
static bool isPackedType(GLenum type);
|
||||
static GLenum computePixelFormat(GLenum pixelFormat);
|
||||
@@ -316,15 +309,15 @@ class OSG_EXPORT Image : public Object
|
||||
virtual bool isImageTranslucent() const;
|
||||
|
||||
/** Set the optional PixelBufferObject used to map the image memory efficiently to graphics memory. */
|
||||
void setPixelBufferObject(PixelBufferObject* buffer) { _bufferObject = buffer; if (_bufferObject.valid()) _bufferObject->setImage(this); }
|
||||
void setPixelBufferObject(PixelBufferObject* buffer) { setBufferObject(buffer); }
|
||||
|
||||
/** Get the PixelBufferObject.*/
|
||||
PixelBufferObject* getPixelBufferObject() { return _bufferObject.get(); }
|
||||
/** Get the PixelBufferObject.*/
|
||||
PixelBufferObject* getPixelBufferObject() { return dynamic_cast<PixelBufferObject*>(_bufferObject.get()); }
|
||||
|
||||
/** Get the const PixelBufferObject.*/
|
||||
const PixelBufferObject* getPixelBufferObject() const { return _bufferObject.get(); }
|
||||
/** Get the const PixelBufferObject.*/
|
||||
const PixelBufferObject* getPixelBufferObject() const { return dynamic_cast<const PixelBufferObject*>(_bufferObject.get()); }
|
||||
|
||||
virtual void update(NodeVisitor* /*nv*/) {}
|
||||
virtual void update(NodeVisitor* /*nv*/) {}
|
||||
|
||||
/** 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. */
|
||||
virtual bool sendPointerEvent(int /*x*/, int /*y*/, int /*buttonMask*/) { return false; }
|
||||
@@ -361,8 +354,6 @@ class OSG_EXPORT Image : public Object
|
||||
|
||||
void setData(unsigned char* data,AllocationMode allocationMode);
|
||||
|
||||
unsigned int _modifiedCount;
|
||||
|
||||
MipmapDataType _mipmapData;
|
||||
|
||||
ref_ptr<PixelBufferObject> _bufferObject;
|
||||
|
||||
Reference in New Issue
Block a user