Added virtual bool Texture::isDirty(contextID) method to help determine whether a GL texture object is likely to be out of date and needs updating

This commit is contained in:
Robert Osfield
2018-02-13 12:01:57 +00:00
parent 22d6ce826f
commit b8e5f22cb7
8 changed files with 45 additions and 1 deletions

View File

@@ -60,6 +60,18 @@ class OSG_EXPORT TextureCubeMap : public Texture
/** Get the number of images that can be assigned to the Texture. */
virtual unsigned int getNumImages() const { return 6; }
/** return true if the texture image data has been modified and the associated GL texture object needs to be updated.*/
virtual bool isDirty(unsigned int contextID) const
{
return (_images[0].valid() && _images[0]->getModifiedCount()!=_modifiedCount[0][contextID]) ||
(_images[1].valid() && _images[1]->getModifiedCount()!=_modifiedCount[1][contextID]) ||
(_images[2].valid() && _images[2]->getModifiedCount()!=_modifiedCount[2][contextID]) ||
(_images[3].valid() && _images[3]->getModifiedCount()!=_modifiedCount[3][contextID]) ||
(_images[4].valid() && _images[4]->getModifiedCount()!=_modifiedCount[4][contextID]) ||
(_images[5].valid() && _images[5]->getModifiedCount()!=_modifiedCount[5][contextID]);
}
inline unsigned int& getModifiedCount(unsigned int face,unsigned int contextID) const
{
// get the modified count for the current contextID.