|
#include "PreCompile.h"
#include "PVRHeader.h"
PVRHeader::PVRHeader()
{
}
PVRHeader::~PVRHeader()
{
}
FILE* PVRHeader::LoadHeader(const string& fileName)
{
FILE* pFile = fopen(fileName.c_str(), "rb");
if (pFile == NULL)
{
throw RacException("can't open ", fileName);
}
int bytesRead = (int)fread((void *)this, PVR_HEADER_SIZE, 1, pFile);
if (bytesRead != 1)
{
fclose(pFile);
throw RacException("error reading header from ", fileName);
}
// Header V2
if (m_numSurfs != 1)
{
fclose(pFile);
throw RacException("amount of surfaces is not = 1: ", fileName);
}
if (m_width != m_height)
{
fclose(pFile);
throw RacException("texture not square: ", fileName);
}
// check that this data is cube map data or not.
if (m_pfFlags & PVRTEX_CUBEMAP)
{ // not in OGLES you don't
fclose(pFile);
throw RacException("cube map texture in ", fileName);
}
return pFile;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
After working in the software industry for many years, I've started my own
games company that specialises in strategy games for mobile platforms.