#ifndef _PVRHEADER_H_INCLUDED_
#define _PVRHEADER_H_INCLUDED_
const int PVR_HEADER_SIZE = 13*4;
const unsigned int PVRTEX_MIPMAP = (1<<8); // has mip map levels
const unsigned int PVRTEX_TWIDDLE = (1<<9); // is twiddled
const unsigned int PVRTEX_BUMPMAP = (1<<10); // has normals encoded for a bump map
const unsigned int PVRTEX_TILING = (1<<11); // is bordered for tiled pvr
const unsigned int PVRTEX_CUBEMAP = (1<<12); // is a cubemap/skybox
const unsigned int PVRTEX_FALSEMIPCOL = (1<<13); //
const unsigned int PVRTEX_VOLUME = (1<<14);
const unsigned int PVRTEX_PIXELTYPE = 0xff; // pixel type is always in the last 16bits of the flags
const unsigned int PVRTEX_IDENTIFIER = 0x21525650; // the pvr identifier is the characters 'P','V','R'
const unsigned int PVRTEX_V1_HEADER_SIZE = 44; // old header size was 44 for identification purposes
const unsigned int PVRTC2_MIN_TEXWIDTH = 16;
const unsigned int PVRTC2_MIN_TEXHEIGHT = 8;
const unsigned int PVRTC4_MIN_TEXWIDTH = 8;
const unsigned int PVRTC4_MIN_TEXHEIGHT = 8;
const unsigned int ETC_MIN_TEXWIDTH = 4;
const unsigned int ETC_MIN_TEXHEIGHT = 4;
const unsigned int DXT_MIN_TEXWIDTH = 4;
const unsigned int DXT_MIN_TEXHEIGHT = 4;
/*
GL_IMG_texture_compression_pvrtc
*/
/* Tokens */
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
enum PixelType
{
MGLPT_ARGB_4444 = 0x00,
MGLPT_ARGB_1555,
MGLPT_RGB_565,
MGLPT_RGB_555,
MGLPT_RGB_888,
MGLPT_ARGB_8888,
MGLPT_ARGB_8332,
MGLPT_I_8,
MGLPT_AI_88,
MGLPT_1_BPP,
MGLPT_VY1UY0,
MGLPT_Y1VY0U,
MGLPT_PVRTC2,
MGLPT_PVRTC4,
MGLPT_PVRTC2_2,
MGLPT_PVRTC2_4,
OGL_RGBA_4444= 0x10,
OGL_RGBA_5551,
OGL_RGBA_8888,
OGL_RGB_565,
OGL_RGB_555,
OGL_RGB_888,
OGL_I_8,
OGL_AI_88,
OGL_PVRTC2,
OGL_PVRTC4,
// OGL_BGRA_8888 extension
OGL_BGRA_8888,
// max cap for iterating
END_OF_PIXEL_TYPES,
MGLPT_NOTYPE = 0xff
};
class PVRHeader
{
public:
PVRHeader();
~PVRHeader();
FILE* LoadHeader(const string& fileName);
int m_headerSize; /*!< size of the structure */
int m_height; /*!< height of surface to be created */
int m_width; /*!< width of input surface */
int m_mipMapCount; /*!< number of mip-map levels requested */
int m_pfFlags; /*!< pixel format flags */
int m_textureDataSize; /*!< Total size in bytes */
int m_bitCount; /*!< number of bits per pixel */
int m_rBitMask; /*!< mask for red bit */
int m_gBitMask; /*!< mask for green bits */
int m_bBitMask; /*!< mask for blue bits */
int m_alphaBitMask; /*!< mask for alpha channel */
int m_pvr; /*!< magic number identifying pvr file */
int m_numSurfs; /*!< the number of surfaces present in the pvr */
};
#endif // _PVRHEADER_H_INCLUDED_