Integrated submission from Boris Bralo:

Supported added for precompiled mip maps stored in osg::Image, and read
by osg::Texture.

Updates to TerraPage loader for support of compressed texture images and
precompiled mip maps.
This commit is contained in:
Robert Osfield
2002-04-22 21:13:33 +00:00
parent 8b30a10375
commit dcfef4a023
4 changed files with 168 additions and 29 deletions

View File

@@ -11,6 +11,7 @@
#include <osg/GL>
#include <string>
#include <vector>
namespace osg {
@@ -131,7 +132,31 @@ class SG_EXPORT Image : public Object
static const unsigned int computePixelSizeInBits(GLenum format,GLenum type);
static const unsigned int computeRowWidthInBytes(int width,GLenum format,GLenum type,int packing);
// precomputed mipmaps stuff;
typedef std::vector< std::size_t > MipmapDataType;
inline bool isMipmap() const {return !_mipmapData.empty();};
std::size_t getNumMipmaps() const
{
return _mipmapData.size()+1;
};
// send offsets into data
// It is assumed that first mipmap offset (index 0) is 0
inline void setMipmapData(const MipmapDataType& mipmapDataVector)
{
_mipmapData = mipmapDataVector;
};
inline unsigned char* getMipmapData(std::size_t mipmapNumber ) const
{
if(mipmapNumber == 0)
return _data;
else if(mipmapNumber < getNumMipmaps())
return _data + _mipmapData[mipmapNumber-1];
return 0L;
};
protected :
@@ -148,6 +173,8 @@ class SG_EXPORT Image : public Object
unsigned char *_data;
unsigned int _modifiedTag;
MipmapDataType _mipmapData;
};
class Geode;