Add some external dependencies.
This commit is contained in:
568
extern/pvrtextool/Include/PVRTArray.h
vendored
Normal file
568
extern/pvrtextool/Include/PVRTArray.h
vendored
Normal file
@ -0,0 +1,568 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTArray.h
|
||||
|
||||
@Title PVRTArray
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI compatible
|
||||
|
||||
@Description Expanding array template class. Allows appending and direct
|
||||
access. Mixing access methods should be approached with caution.
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef __PVRTARRAY_H__
|
||||
#define __PVRTARRAY_H__
|
||||
|
||||
//ACS: PVRTGlobal.h was dragging in too much stuff (like windows.h & crtdbg.h)
|
||||
// so I split the relevant stuff out into a new file, PVRTTypes.h
|
||||
//#include "PVRTGlobal.h"
|
||||
#include "PVRTTypes.h"
|
||||
#include "PVRTError.h"
|
||||
|
||||
/*!****************************************************************************
|
||||
Class
|
||||
******************************************************************************/
|
||||
|
||||
/*!***************************************************************************
|
||||
* @Class CPVRTArray
|
||||
* @Brief Expanding array template class.
|
||||
* @Description Expanding array template class.
|
||||
*****************************************************************************/
|
||||
template<typename T>
|
||||
class CPVRTArray
|
||||
{
|
||||
public:
|
||||
/*!***************************************************************************
|
||||
@Function CPVRTArray
|
||||
@Description Blank constructor. Makes a default sized array.
|
||||
*****************************************************************************/
|
||||
CPVRTArray() : m_uiSize(0), m_uiCapacity(GetDefaultSize())
|
||||
{
|
||||
m_pArray = new T[m_uiCapacity];
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function CPVRTArray
|
||||
@Input uiSize intial size of array
|
||||
@Description Constructor taking initial size of array in elements.
|
||||
*****************************************************************************/
|
||||
CPVRTArray(const unsigned int uiSize) : m_uiSize(0), m_uiCapacity(uiSize)
|
||||
{
|
||||
_ASSERT(uiSize != 0);
|
||||
m_pArray = new T[uiSize];
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function CPVRTArray
|
||||
@Input original the other dynamic array
|
||||
@Description Copy constructor.
|
||||
*****************************************************************************/
|
||||
CPVRTArray(const CPVRTArray& original) : m_uiSize(original.m_uiSize),
|
||||
m_uiCapacity(original.m_uiCapacity)
|
||||
{
|
||||
m_pArray = new T[m_uiCapacity];
|
||||
for(unsigned int i=0;i<m_uiSize;i++)
|
||||
{
|
||||
m_pArray[i]=original.m_pArray[i];
|
||||
}
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function CPVRTArray
|
||||
@Input pArray an ordinary array
|
||||
@Input uiSize number of elements passed
|
||||
@Description constructor from ordinary array.
|
||||
*****************************************************************************/
|
||||
CPVRTArray(const T* const pArray, const unsigned int uiSize) : m_uiSize(uiSize),
|
||||
m_uiCapacity(uiSize)
|
||||
{
|
||||
_ASSERT(uiSize != 0);
|
||||
m_pArray = new T[uiSize];
|
||||
for(unsigned int i=0;i<m_uiSize;i++)
|
||||
{
|
||||
m_pArray[i]=pArray[i];
|
||||
}
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function CPVRTArray
|
||||
@Input uiSize initial capacity
|
||||
@Input val value to populate with
|
||||
@Description constructor from a capacity and initial value.
|
||||
*****************************************************************************/
|
||||
CPVRTArray(const unsigned int uiSize, const T& val) : m_uiSize(uiSize),
|
||||
m_uiCapacity(uiSize)
|
||||
{
|
||||
_ASSERT(uiSize != 0);
|
||||
m_pArray = new T[uiSize];
|
||||
for(unsigned int uiIndex = 0; uiIndex < m_uiSize; ++uiIndex)
|
||||
{
|
||||
m_pArray[uiIndex] = val;
|
||||
}
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function ~CPVRTArray
|
||||
@Description Destructor.
|
||||
*****************************************************************************/
|
||||
virtual ~CPVRTArray()
|
||||
{
|
||||
if(m_pArray)
|
||||
delete [] m_pArray;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Insert
|
||||
@Input pos The position to insert the new element at
|
||||
@Input addT The element to insert
|
||||
@Return The index of the new item or -1 on failure.
|
||||
@Description Inserts an element into the array, expanding it
|
||||
if necessary.
|
||||
*****************************************************************************/
|
||||
int Insert(const unsigned int pos, const T& addT)
|
||||
{
|
||||
unsigned int uiIndex = pos;
|
||||
|
||||
if(pos >= m_uiSize) // Are we adding to the end
|
||||
uiIndex = Append(addT);
|
||||
else
|
||||
{
|
||||
unsigned int uiNewCapacity = 0;
|
||||
T* pArray = m_pArray;
|
||||
|
||||
if(m_uiSize > m_uiCapacity)
|
||||
{
|
||||
uiNewCapacity = m_uiCapacity + 10; // Expand the array by 10.
|
||||
|
||||
pArray = new T[uiNewCapacity]; // New Array
|
||||
|
||||
if(!pArray)
|
||||
return -1; // Failed to allocate memory!
|
||||
|
||||
// Copy the first half to the new array
|
||||
for(unsigned int i = 0; i < pos; ++i)
|
||||
{
|
||||
pArray[i] = m_pArray[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Copy last half to the new array
|
||||
for(unsigned int i = m_uiSize; i > pos; --i)
|
||||
{
|
||||
pArray[i] = m_pArray[i - 1];
|
||||
}
|
||||
|
||||
// Insert our new element
|
||||
pArray[pos] = addT;
|
||||
uiIndex = pos;
|
||||
|
||||
// Increase our size
|
||||
++m_uiSize;
|
||||
|
||||
// Switch pointers and free memory if needed
|
||||
if(pArray != m_pArray)
|
||||
{
|
||||
m_uiCapacity = uiNewCapacity;
|
||||
delete[] m_pArray;
|
||||
m_pArray = pArray;
|
||||
}
|
||||
}
|
||||
|
||||
return uiIndex;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Append
|
||||
@Input addT The element to append
|
||||
@Return The index of the new item.
|
||||
@Description Appends an element to the end of the array, expanding it
|
||||
if necessary.
|
||||
*****************************************************************************/
|
||||
unsigned int Append(const T& addT)
|
||||
{
|
||||
unsigned int uiIndex = Append();
|
||||
m_pArray[uiIndex] = addT;
|
||||
return uiIndex;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Append
|
||||
@Return The index of the new item.
|
||||
@Description Creates space for a new item, but doesn't add. Instead
|
||||
returns the index of the new item.
|
||||
*****************************************************************************/
|
||||
unsigned int Append()
|
||||
{
|
||||
unsigned int uiIndex = m_uiSize;
|
||||
SetCapacity(m_uiSize+1);
|
||||
m_uiSize++;
|
||||
|
||||
return uiIndex;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Clear
|
||||
@Description Clears the array.
|
||||
*****************************************************************************/
|
||||
void Clear()
|
||||
{
|
||||
m_uiSize = 0U;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Resize
|
||||
@Input uiSize New size of array
|
||||
@Description Changes the array to the new size
|
||||
*****************************************************************************/
|
||||
EPVRTError Resize(const unsigned int uiSize)
|
||||
{
|
||||
EPVRTError err = SetCapacity(uiSize);
|
||||
|
||||
if(err != PVR_SUCCESS)
|
||||
return err;
|
||||
|
||||
m_uiSize = uiSize;
|
||||
return PVR_SUCCESS;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function SetCapacity
|
||||
@Input uiSize New capacity of array
|
||||
@Description Expands array to new capacity
|
||||
*****************************************************************************/
|
||||
EPVRTError SetCapacity(const unsigned int uiSize)
|
||||
{
|
||||
if(uiSize <= m_uiCapacity)
|
||||
return PVR_SUCCESS; // nothing to be done
|
||||
|
||||
unsigned int uiNewCapacity;
|
||||
if(uiSize < m_uiCapacity*2)
|
||||
{
|
||||
uiNewCapacity = m_uiCapacity*2; // Ignore the new size. Expand to twice the previous size.
|
||||
}
|
||||
else
|
||||
{
|
||||
uiNewCapacity = uiSize;
|
||||
}
|
||||
|
||||
T* pNewArray = new T[uiNewCapacity]; // New Array
|
||||
if(!pNewArray)
|
||||
return PVR_FAIL; // Failed to allocate memory!
|
||||
|
||||
// Copy source data to new array
|
||||
for(unsigned int i = 0; i < m_uiSize; ++i)
|
||||
{
|
||||
pNewArray[i] = m_pArray[i];
|
||||
}
|
||||
|
||||
// Switch pointers and free memory
|
||||
m_uiCapacity = uiNewCapacity;
|
||||
T* pOldArray = m_pArray;
|
||||
m_pArray = pNewArray;
|
||||
delete [] pOldArray;
|
||||
return PVR_SUCCESS;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Copy
|
||||
@Input other The CPVRTArray needing copied
|
||||
@Description A copy function. Will attempt to copy from other CPVRTArrays
|
||||
if this is possible.
|
||||
*****************************************************************************/
|
||||
template<typename T2>
|
||||
void Copy(const CPVRTArray<T2>& other)
|
||||
{
|
||||
T* pNewArray = new T[other.GetCapacity()];
|
||||
if(pNewArray)
|
||||
{
|
||||
// Copy data
|
||||
for(unsigned int i = 0; i < other.GetSize(); i++)
|
||||
{
|
||||
pNewArray[i] = other[i];
|
||||
}
|
||||
|
||||
// Free current array
|
||||
if(m_pArray)
|
||||
delete [] m_pArray;
|
||||
|
||||
// Swap pointers
|
||||
m_pArray = pNewArray;
|
||||
|
||||
m_uiCapacity = other.GetCapacity();
|
||||
m_uiSize = other.GetSize();
|
||||
}
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function =
|
||||
@Input other The CPVRTArray needing copied
|
||||
@Description assignment operator.
|
||||
*****************************************************************************/
|
||||
CPVRTArray& operator=(const CPVRTArray<T>& other)
|
||||
{
|
||||
if(&other != this)
|
||||
Copy(other);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function operator+=
|
||||
@Input other the array to append.
|
||||
@Description appends an existing CPVRTArray on to this one.
|
||||
*****************************************************************************/
|
||||
CPVRTArray& operator+=(const CPVRTArray<T>& other)
|
||||
{
|
||||
if(&other != this)
|
||||
{
|
||||
for(unsigned int uiIndex = 0; uiIndex < other.GetSize(); ++uiIndex)
|
||||
{
|
||||
Append(other[uiIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function []
|
||||
@Input uiIndex index of element in array
|
||||
@Return the element indexed
|
||||
@Description indexed access into array. Note that this has no error
|
||||
checking whatsoever
|
||||
*****************************************************************************/
|
||||
T& operator[](const unsigned int uiIndex)
|
||||
{
|
||||
_ASSERT(uiIndex < m_uiCapacity);
|
||||
return m_pArray[uiIndex];
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function []
|
||||
@Input uiIndex index of element in array
|
||||
@Return The element indexed
|
||||
@Description Indexed access into array. Note that this has no error
|
||||
checking whatsoever
|
||||
*****************************************************************************/
|
||||
const T& operator[](const unsigned int uiIndex) const
|
||||
{
|
||||
_ASSERT(uiIndex < m_uiCapacity);
|
||||
return m_pArray[uiIndex];
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function GetSize
|
||||
@Return Size of array
|
||||
@Description Gives current size of array/number of elements
|
||||
*****************************************************************************/
|
||||
unsigned int GetSize() const
|
||||
{
|
||||
return m_uiSize;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function GetDefaultSize
|
||||
@Return Default size of array
|
||||
@Description Gives the default size of array/number of elements
|
||||
*****************************************************************************/
|
||||
static unsigned int GetDefaultSize()
|
||||
{
|
||||
return 16U;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function GetCapacity
|
||||
@Return Capacity of array
|
||||
@Description Gives current allocated size of array/number of elements
|
||||
*****************************************************************************/
|
||||
unsigned int GetCapacity() const
|
||||
{
|
||||
return m_uiCapacity;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Contains
|
||||
@Input object The object to check in the array
|
||||
@Return true if object is contained in this array.
|
||||
@Description Indicates whether the given object resides inside the
|
||||
array.
|
||||
*****************************************************************************/
|
||||
bool Contains(const T& object) const
|
||||
{
|
||||
for(unsigned int uiIndex = 0; uiIndex < m_uiSize; ++uiIndex)
|
||||
{
|
||||
if(m_pArray[uiIndex] == object)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Find
|
||||
@Input object The object to check in the array
|
||||
@Return pointer to the found object or NULL.
|
||||
@Description Attempts to find the object in the array and returns a
|
||||
pointer if it is found, or NULL if not found. The time
|
||||
taken is O(N).
|
||||
*****************************************************************************/
|
||||
T* Find(const T& object) const
|
||||
{
|
||||
for(unsigned int uiIndex = 0; uiIndex < m_uiSize; ++uiIndex)
|
||||
{
|
||||
if(m_pArray[uiIndex] == object)
|
||||
return &m_pArray[uiIndex];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Sort
|
||||
@Input predicate The object which defines "bool operator()"
|
||||
@Description Simple bubble-sort of the array. Pred should be an object that
|
||||
defines a bool operator().
|
||||
*****************************************************************************/
|
||||
template<class Pred>
|
||||
void Sort(Pred predicate)
|
||||
{
|
||||
bool bSwap;
|
||||
for(unsigned int i=0; i < m_uiSize; ++i)
|
||||
{
|
||||
bSwap = false;
|
||||
for(unsigned int j=0; j < m_uiSize-1; ++j)
|
||||
{
|
||||
if(predicate(m_pArray[j], m_pArray[j+1]))
|
||||
{
|
||||
PVRTswap(m_pArray[j], m_pArray[j+1]);
|
||||
bSwap = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!bSwap)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Remove
|
||||
@Input uiIndex The index to remove
|
||||
@Return success or failure
|
||||
@Description Removes an element from the array.
|
||||
*****************************************************************************/
|
||||
virtual EPVRTError Remove(unsigned int uiIndex)
|
||||
{
|
||||
_ASSERT(uiIndex < m_uiSize);
|
||||
if(m_uiSize == 0)
|
||||
return PVR_FAIL;
|
||||
|
||||
if(uiIndex == m_uiSize-1)
|
||||
{
|
||||
return RemoveLast();
|
||||
}
|
||||
|
||||
m_uiSize--;
|
||||
// Copy the data. memmove will only work for built-in types.
|
||||
for(unsigned int uiNewIdx = uiIndex; uiNewIdx < m_uiSize; ++uiNewIdx)
|
||||
{
|
||||
m_pArray[uiNewIdx] = m_pArray[uiNewIdx+1];
|
||||
}
|
||||
|
||||
return PVR_SUCCESS;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function RemoveLast
|
||||
@Return success or failure
|
||||
@Description Removes the last element. Simply decrements the size value
|
||||
*****************************************************************************/
|
||||
virtual EPVRTError RemoveLast()
|
||||
{
|
||||
if(m_uiSize > 0)
|
||||
{
|
||||
m_uiSize--;
|
||||
return PVR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PVR_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
unsigned int m_uiSize; /*! current size of contents of array */
|
||||
unsigned int m_uiCapacity; /*! currently allocated size of array */
|
||||
T *m_pArray; /*! the actual array itself */
|
||||
};
|
||||
|
||||
// note "this" is required for ISO standard C++ and gcc complains otherwise
|
||||
// http://lists.apple.com/archives/Xcode-users//2005/Dec/msg00644.html
|
||||
template<typename T>
|
||||
class CPVRTArrayManagedPointers : public CPVRTArray<T*>
|
||||
{
|
||||
public:
|
||||
virtual ~CPVRTArrayManagedPointers()
|
||||
{
|
||||
if(this->m_pArray)
|
||||
{
|
||||
for(unsigned int i=0;i<this->m_uiSize;i++)
|
||||
{
|
||||
delete(this->m_pArray[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function Remove
|
||||
@Input uiIndex The index to remove
|
||||
@Return success or failure
|
||||
@Description Removes an element from the array.
|
||||
*****************************************************************************/
|
||||
virtual EPVRTError Remove(unsigned int uiIndex)
|
||||
{
|
||||
_ASSERT(uiIndex < this->m_uiSize);
|
||||
if(this->m_uiSize == 0)
|
||||
return PVR_FAIL;
|
||||
|
||||
if(uiIndex == this->m_uiSize-1)
|
||||
{
|
||||
return this->RemoveLast();
|
||||
}
|
||||
|
||||
unsigned int uiSize = (this->m_uiSize - (uiIndex+1)) * sizeof(T*);
|
||||
|
||||
delete this->m_pArray[uiIndex];
|
||||
memmove(this->m_pArray + uiIndex, this->m_pArray + (uiIndex+1), uiSize);
|
||||
|
||||
this->m_uiSize--;
|
||||
return PVR_SUCCESS;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function RemoveLast
|
||||
@Return success or failure
|
||||
@Description Removes the last element. Simply decrements the size value
|
||||
*****************************************************************************/
|
||||
virtual EPVRTError RemoveLast()
|
||||
{
|
||||
if(this->m_uiSize > 0 && this->m_pArray)
|
||||
{
|
||||
delete this->m_pArray[this->m_uiSize-1];
|
||||
this->m_uiSize--;
|
||||
return PVR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PVR_FAIL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __PVRTARRAY_H__
|
||||
|
||||
/*****************************************************************************
|
||||
End of file (PVRTArray.h)
|
||||
*****************************************************************************/
|
||||
|
58
extern/pvrtextool/Include/PVRTDecompress.h
vendored
Normal file
58
extern/pvrtextool/Include/PVRTDecompress.h
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTDecompress.h
|
||||
|
||||
@Title PVRTDecompress
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI compatible
|
||||
|
||||
@Description PVRTC and ETC Texture Decompression.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _PVRTDECOMPRESS_H_
|
||||
#define _PVRTDECOMPRESS_H_
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTDecompressPVRTC
|
||||
@Input pCompressedData The PVRTC texture data to decompress
|
||||
@Input Do2bitMode Signifies whether the data is PVRTC2 or PVRTC4
|
||||
@Input XDim X dimension of the texture
|
||||
@Input YDim Y dimension of the texture
|
||||
@Return Returns the amount of data that was decompressed.
|
||||
@Modified pResultImage The decompressed texture data
|
||||
@Description Decompresses PVRTC to RGBA 8888
|
||||
*************************************************************************/
|
||||
int PVRTDecompressPVRTC(const void *pCompressedData,
|
||||
const int Do2bitMode,
|
||||
const int XDim,
|
||||
const int YDim,
|
||||
unsigned char* pResultImage);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTDecompressETC
|
||||
@Input pSrcData The ETC texture data to decompress
|
||||
@Input x X dimension of the texture
|
||||
@Input y Y dimension of the texture
|
||||
@Modified pDestData The decompressed texture data
|
||||
@Input nMode The format of the data
|
||||
@Returns The number of bytes of ETC data decompressed
|
||||
@Description Decompresses ETC to RGBA 8888
|
||||
*************************************************************************/
|
||||
int PVRTDecompressETC(const void * const pSrcData,
|
||||
const unsigned int &x,
|
||||
const unsigned int &y,
|
||||
void *pDestData,
|
||||
const int &nMode);
|
||||
|
||||
|
||||
#endif /* _PVRTDECOMPRESS_H_ */
|
||||
|
||||
/*****************************************************************************
|
||||
End of file (PVRTBoneBatch.h)
|
||||
*****************************************************************************/
|
||||
|
71
extern/pvrtextool/Include/PVRTError.h
vendored
Normal file
71
extern/pvrtextool/Include/PVRTError.h
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTError.h
|
||||
|
||||
@Title PVRTError
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI compatible
|
||||
|
||||
@Description
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRTERROR_H_
|
||||
#define _PVRTERROR_H_
|
||||
|
||||
#if defined(ANDROID)
|
||||
#include <android/log.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
/*!***************************************************************************
|
||||
Macros
|
||||
*****************************************************************************/
|
||||
|
||||
/*! Outputs a string to the standard error if built for debugging. */
|
||||
#if !defined(PVRTERROR_OUTPUT_DEBUG)
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
#if defined(ANDROID)
|
||||
#define PVRTERROR_OUTPUT_DEBUG(A) __android_log_print(ANDROID_LOG_INFO, "PVRTools", A);
|
||||
#elif defined(_WIN32)
|
||||
#define PVRTERROR_OUTPUT_DEBUG(A) OutputDebugStringA(A);
|
||||
#else
|
||||
#define PVRTERROR_OUTPUT_DEBUG(A) fprintf(stderr,A);
|
||||
#endif
|
||||
#else
|
||||
#define PVRTERROR_OUTPUT_DEBUG(A)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*!***************************************************************************
|
||||
Enums
|
||||
*****************************************************************************/
|
||||
/*! Enum error codes */
|
||||
enum EPVRTError
|
||||
{
|
||||
PVR_SUCCESS = 0,
|
||||
PVR_FAIL = 1,
|
||||
PVR_OVERFLOW = 2
|
||||
};
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTErrorOutputDebug
|
||||
@Input format printf style format followed by arguments it requires
|
||||
@Description Outputs a string to the standard error.
|
||||
*****************************************************************************/
|
||||
void PVRTErrorOutputDebug(char const * const format, ...);
|
||||
|
||||
#endif // _PVRTERROR_H_
|
||||
|
||||
/*****************************************************************************
|
||||
End of file (PVRTError.h)
|
||||
*****************************************************************************/
|
||||
|
278
extern/pvrtextool/Include/PVRTGlobal.h
vendored
Normal file
278
extern/pvrtextool/Include/PVRTGlobal.h
vendored
Normal file
@ -0,0 +1,278 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTGlobal.h
|
||||
|
||||
@Title PVRTGlobal
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI compatible
|
||||
|
||||
@Description Global defines and typedefs for PVRTools
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRTGLOBAL_H_
|
||||
#define _PVRTGLOBAL_H_
|
||||
|
||||
/*!***************************************************************************
|
||||
Macros
|
||||
*****************************************************************************/
|
||||
#define PVRT_MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define PVRT_MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#define PVRT_CLAMP(x, l, h) (PVRT_MIN((h), PVRT_MAX((x), (l))))
|
||||
|
||||
// avoid warning about unused parameter
|
||||
#define PVRT_UNREFERENCED_PARAMETER(x) ((void) x)
|
||||
|
||||
#if defined(_WIN32) && !defined(__QT__) /* Windows desktop */
|
||||
#if !defined(_CRTDBG_MAP_ALLOC)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <crtdbg.h>
|
||||
#include <tchar.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(__QT__)
|
||||
|
||||
#else
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#define _ASSERT(a)((void)0)
|
||||
#define _ASSERTE(a)((void)0)
|
||||
#ifdef _DEBUG
|
||||
#ifndef _RPT0
|
||||
#define _RPT0(a,b) printf(b)
|
||||
#endif
|
||||
#ifndef _RPT1
|
||||
#define _RPT1(a,b,c) printf(b,c)
|
||||
#endif
|
||||
#else
|
||||
#ifndef _RPT0
|
||||
#define _RPT0(a,b)((void)0)
|
||||
#endif
|
||||
#ifndef _RPT1
|
||||
#define _RPT1(a,b,c)((void)0)
|
||||
#endif
|
||||
#endif
|
||||
#define _RPT2(a,b,c,d)((void)0)
|
||||
#define _RPT3(a,b,c,d,e)((void)0)
|
||||
#define _RPT4(a,b,c,d,e,f)((void)0)
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define BYTE unsigned char
|
||||
#define WORD unsigned short
|
||||
#define DWORD unsigned int
|
||||
typedef struct tagRGBQUAD {
|
||||
BYTE rgbBlue;
|
||||
BYTE rgbGreen;
|
||||
BYTE rgbRed;
|
||||
BYTE rgbReserved;
|
||||
} RGBQUAD;
|
||||
#define BOOL int
|
||||
#if !defined(TRUE)
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#if !defined(FALSE)
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#else
|
||||
#define _CRT_WARN 0
|
||||
#define _RPT0(a,b)
|
||||
#define _RPT1(a,b,c)
|
||||
#define _RPT2(a,b,c,d)
|
||||
#define _RPT3(a,b,c,d,e)
|
||||
#define _RPT4(a,b,c,d,e,f)
|
||||
#define _ASSERT(X)
|
||||
#define _ASSERTE(X)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define FREE(X) { if(X) { free(X); (X) = 0; } }
|
||||
|
||||
#if 1 //ACS: I split this out into PVRTTypes.h
|
||||
|
||||
#include "PVRTTypes.h"
|
||||
|
||||
#else
|
||||
|
||||
// This macro is used to check at compile time that types are of a certain size
|
||||
// If the size does not equal the expected size, this typedefs an array of size 0
|
||||
// which causes a compile error
|
||||
#define PVRTSIZEASSERT(T, size) typedef int (sizeof_##T)[sizeof(T) == (size)]
|
||||
#define PVRTCOMPILEASSERT(T, expr) typedef int (assert_##T)[expr]
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** Integer types
|
||||
****************************************************************************/
|
||||
|
||||
typedef char PVRTchar8;
|
||||
typedef signed char PVRTint8;
|
||||
typedef signed short PVRTint16;
|
||||
typedef signed int PVRTint32;
|
||||
typedef unsigned char PVRTuint8;
|
||||
typedef unsigned short PVRTuint16;
|
||||
typedef unsigned int PVRTuint32;
|
||||
|
||||
typedef float PVRTfloat32;
|
||||
|
||||
#if (defined(__int64) || defined(_WIN32))
|
||||
typedef signed __int64 PVRTint64;
|
||||
typedef unsigned __int64 PVRTuint64;
|
||||
#elif defined(TInt64)
|
||||
typedef TInt64 PVRTint64;
|
||||
typedef TUInt64 PVRTuint64;
|
||||
#else
|
||||
typedef signed long long PVRTint64;
|
||||
typedef unsigned long long PVRTuint64;
|
||||
#endif
|
||||
|
||||
#if __SIZEOF_WCHAR_T__ == 4 || __WCHAR_MAX__ > 0x10000
|
||||
#define PVRTSIZEOFWCHAR 4
|
||||
#else
|
||||
#define PVRTSIZEOFWCHAR 2
|
||||
#endif
|
||||
|
||||
PVRTSIZEASSERT(PVRTchar8, 1);
|
||||
PVRTSIZEASSERT(PVRTint8, 1);
|
||||
PVRTSIZEASSERT(PVRTuint8, 1);
|
||||
PVRTSIZEASSERT(PVRTint16, 2);
|
||||
PVRTSIZEASSERT(PVRTuint16, 2);
|
||||
PVRTSIZEASSERT(PVRTint32, 4);
|
||||
PVRTSIZEASSERT(PVRTuint32, 4);
|
||||
PVRTSIZEASSERT(PVRTint64, 8);
|
||||
PVRTSIZEASSERT(PVRTuint64, 8);
|
||||
PVRTSIZEASSERT(PVRTfloat32, 4);
|
||||
|
||||
/*!**************************************************************************
|
||||
@Enum ETextureFilter
|
||||
@Brief Enum values for defining texture filtering
|
||||
****************************************************************************/
|
||||
enum ETextureFilter
|
||||
{
|
||||
eFilter_Nearest,
|
||||
eFilter_Linear,
|
||||
eFilter_None,
|
||||
|
||||
eFilter_Size,
|
||||
eFilter_Default = eFilter_Nearest,
|
||||
eFilter_MipDefault = eFilter_None
|
||||
};
|
||||
|
||||
/*!**************************************************************************
|
||||
@Enum ETextureWrap
|
||||
@Brief Enum values for defining texture wrapping
|
||||
****************************************************************************/
|
||||
enum ETextureWrap
|
||||
{
|
||||
eWrap_Clamp,
|
||||
eWrap_Repeat,
|
||||
|
||||
eWrap_Size,
|
||||
eWrap_Default = eWrap_Repeat
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** swap template function
|
||||
****************************************************************************/
|
||||
/*!***************************************************************************
|
||||
@Function PVRTswap
|
||||
@Input a Type a
|
||||
@Input b Type b
|
||||
@Description A swap template function that swaps a and b
|
||||
*****************************************************************************/
|
||||
|
||||
template <typename T>
|
||||
inline void PVRTswap(T& a, T& b)
|
||||
{
|
||||
T temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTClamp
|
||||
@Input val Value to clamp
|
||||
@Input min Minimum legal value
|
||||
@Input max Maximum legal value
|
||||
@Description A clamp template function that clamps val between min and max.
|
||||
*****************************************************************************/
|
||||
template <typename T>
|
||||
inline T PVRTClamp(const T& val, const T& min, const T& max)
|
||||
{
|
||||
if(val > max)
|
||||
return max;
|
||||
if(val < min)
|
||||
return min;
|
||||
return val;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTByteSwap
|
||||
@Input pBytes A number
|
||||
@Input i32ByteNo Number of bytes in pBytes
|
||||
@Description Swaps the endianness of pBytes in place
|
||||
*****************************************************************************/
|
||||
inline void PVRTByteSwap(unsigned char* pBytes, int i32ByteNo)
|
||||
{
|
||||
int i = 0, j = i32ByteNo - 1;
|
||||
|
||||
while(i < j)
|
||||
PVRTswap<unsigned char>(pBytes[i++], pBytes[j--]);
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTByteSwap32
|
||||
@Input ui32Long A number
|
||||
@Returns ui32Long with its endianness changed
|
||||
@Description Converts the endianness of an unsigned int
|
||||
*****************************************************************************/
|
||||
inline unsigned int PVRTByteSwap32(unsigned int ui32Long)
|
||||
{
|
||||
return ((ui32Long&0x000000FF)<<24) + ((ui32Long&0x0000FF00)<<8) + ((ui32Long&0x00FF0000)>>8) + ((ui32Long&0xFF000000) >> 24);
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTByteSwap16
|
||||
@Input ui16Short A number
|
||||
@Returns ui16Short with its endianness changed
|
||||
@Description Converts the endianness of a unsigned short
|
||||
*****************************************************************************/
|
||||
inline unsigned short PVRTByteSwap16(unsigned short ui16Short)
|
||||
{
|
||||
return (ui16Short>>8) | (ui16Short<<8);
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTIsLittleEndian
|
||||
@Returns True if the platform the code is ran on is little endian
|
||||
@Description Returns true if the platform the code is ran on is little endian
|
||||
*****************************************************************************/
|
||||
inline bool PVRTIsLittleEndian()
|
||||
{
|
||||
static bool bLittleEndian;
|
||||
static bool bIsInit = false;
|
||||
|
||||
if(!bIsInit)
|
||||
{
|
||||
short int word = 0x0001;
|
||||
char *byte = (char*) &word;
|
||||
bLittleEndian = byte[0] ? true : false;
|
||||
bIsInit = true;
|
||||
}
|
||||
|
||||
return bLittleEndian;
|
||||
}
|
||||
|
||||
#endif // _PVRTGLOBAL_H_
|
||||
|
||||
/*****************************************************************************
|
||||
End of file (Tools.h)
|
||||
*****************************************************************************/
|
||||
|
222
extern/pvrtextool/Include/PVRTMap.h
vendored
Normal file
222
extern/pvrtextool/Include/PVRTMap.h
vendored
Normal file
@ -0,0 +1,222 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTMap.h
|
||||
|
||||
@Title PVRTArray
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI compatible
|
||||
|
||||
@Description A simple and easy to use implementation of a map.
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef __PVRTMAP_H__
|
||||
#define __PVRTMAP_H__
|
||||
|
||||
#include "PVRTArray.h"
|
||||
|
||||
/*!****************************************************************************
|
||||
Class
|
||||
******************************************************************************/
|
||||
|
||||
/*!***************************************************************************
|
||||
* @Class CPVRTMap
|
||||
* @Brief Expanding map template class.
|
||||
* @Description A simple and easy to use implementation of a map.
|
||||
*****************************************************************************/
|
||||
template <typename KeyType, typename DataType>
|
||||
class CPVRTMap
|
||||
{
|
||||
public:
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTMap
|
||||
@Return A new CPVRTMap.
|
||||
@Description Constructor for a CPVRTMap.
|
||||
*************************************************************************/
|
||||
CPVRTMap() : m_Keys(), m_Data(), m_uiSize(0)
|
||||
{}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function ~CPVRTMap
|
||||
@Description Destructor for a CPVRTMap.
|
||||
*************************************************************************/
|
||||
~CPVRTMap()
|
||||
{
|
||||
//Clear the map, that's enough - the CPVRTArray members will tidy everything else up.
|
||||
Clear();
|
||||
}
|
||||
|
||||
EPVRTError Reserve(const PVRTuint32 uiSize)
|
||||
{
|
||||
//Sets the capacity of each member array to the requested size. The array used will only expand.
|
||||
//Returns the most serious error from either method.
|
||||
return PVRT_MAX(m_Keys.SetCapacity(uiSize),m_Data.SetCapacity(uiSize));
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function GetSize
|
||||
@Return Number of meaningful members in the map.
|
||||
@Description Returns the number of meaningful members in the map.
|
||||
*************************************************************************/
|
||||
PVRTuint32 GetSize() const
|
||||
{
|
||||
//Return the size.
|
||||
return m_uiSize;
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function GetIndexOf
|
||||
@Input key
|
||||
@Return The index value for a mapped item.
|
||||
@Description Gets the position of a particular key/data within the map.
|
||||
If the return value is exactly equal to the value of
|
||||
GetSize() then the item has not been found.
|
||||
*************************************************************************/
|
||||
PVRTuint32 GetIndexOf(const KeyType key) const
|
||||
{
|
||||
//Loop through all the valid keys.
|
||||
for (PVRTuint32 i=0; i<m_uiSize; ++i)
|
||||
{
|
||||
//Check if a key matches.
|
||||
if (m_Keys[i]==key)
|
||||
{
|
||||
//If a matched key is found, return the position.
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
//If not found, return the number of meaningful members.
|
||||
return m_uiSize;
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function GetDataAtIndex
|
||||
@Input uiIndex
|
||||
@Return Data type at the specified position.
|
||||
@Description Returns a pointer to the Data at a particular index.
|
||||
If the index supplied is not valid, NULL is returned
|
||||
instead. Deletion of data at this pointer will lead
|
||||
to undefined behaviour.
|
||||
*************************************************************************/
|
||||
const DataType* GetDataAtIndex(const PVRTuint32 uiIndex) const
|
||||
{
|
||||
return &(m_Data[uiIndex]);
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function operator[]
|
||||
@Input key
|
||||
@Return Data that is mapped to 'key'.
|
||||
@Description If a mapping already exists for 'key' then it will return
|
||||
the associated data. If no mapping currently exists, a new
|
||||
element is created in place.
|
||||
*************************************************************************/
|
||||
DataType& operator[] (const KeyType key)
|
||||
{
|
||||
//Get the index of the key.
|
||||
PVRTuint32 uiIndex = GetIndexOf(key);
|
||||
|
||||
//Check the index is valid
|
||||
if (uiIndex != m_uiSize)
|
||||
{
|
||||
//Return mapped data if the index is valid.
|
||||
return m_Data[uiIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
//Append the key to the Keys array.
|
||||
m_Keys.Append(key);
|
||||
|
||||
//Create a new DataType.
|
||||
DataType sNewData;
|
||||
|
||||
//Append the new pointer to the Data array.
|
||||
m_Data.Append(sNewData);
|
||||
|
||||
//Increment the size of meaningful data.
|
||||
++m_uiSize;
|
||||
|
||||
//Return the contents of pNewData.
|
||||
return m_Data[m_Keys.GetSize()-1];
|
||||
}
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function Remove
|
||||
@Input key
|
||||
@Return Returns PVR_FAIL if item doesn't exist.
|
||||
Otherwise returns PVR_SUCCESS.
|
||||
@Description Removes an element from the map if it exists.
|
||||
*************************************************************************/
|
||||
EPVRTError Remove(const KeyType key)
|
||||
{
|
||||
//Finds the index of the key.
|
||||
PVRTuint32 uiIndex=GetIndexOf(key);
|
||||
|
||||
//If the key is invalid, fail.
|
||||
if (uiIndex==m_uiSize)
|
||||
{
|
||||
//Return failure.
|
||||
return PVR_FAIL;
|
||||
}
|
||||
|
||||
//Decrement the size of the map to ignore the last element in each array.
|
||||
m_uiSize--;
|
||||
|
||||
//Copy the last key over the deleted key. There are now two copies of one element,
|
||||
//but the one at the end of the array is ignored.
|
||||
m_Keys[uiIndex]=m_Keys[m_uiSize-1];
|
||||
|
||||
//Copy the last data over the deleted data in the same way as the keys.
|
||||
m_Data[uiIndex]=m_Data[m_uiSize-1];
|
||||
|
||||
//Return success.
|
||||
return PVR_SUCCESS;
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function Clear
|
||||
@Description Clears the Map of all data values.
|
||||
*************************************************************************/
|
||||
void Clear()
|
||||
{
|
||||
//Set the size to 0.
|
||||
m_uiSize=0;
|
||||
m_Keys.Clear();
|
||||
m_Data.Clear();
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function Exists
|
||||
@Input key
|
||||
@Return Whether data exists for the specified key or not.
|
||||
@Description Checks whether or not data exists for the specified key.
|
||||
*************************************************************************/
|
||||
bool Exists(const KeyType key) const
|
||||
{
|
||||
//Checks for a valid index for key, if not, returns false.
|
||||
return (GetIndexOf(key) != m_uiSize);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//Array of all the keys. Indices match m_Data.
|
||||
CPVRTArray<KeyType> m_Keys;
|
||||
|
||||
//Array of pointers to all the allocated data.
|
||||
CPVRTArray<DataType> m_Data;
|
||||
|
||||
//The number of meaningful members in the map.
|
||||
PVRTuint32 m_uiSize;
|
||||
};
|
||||
|
||||
#endif // __PVRTMAP_H__
|
||||
|
||||
/*****************************************************************************
|
||||
End of file (PVRTMap.h)
|
||||
*****************************************************************************/
|
||||
|
985
extern/pvrtextool/Include/PVRTString.h
vendored
Normal file
985
extern/pvrtextool/Include/PVRTString.h
vendored
Normal file
@ -0,0 +1,985 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTString.h
|
||||
|
||||
@Title PVRTString
|
||||
|
||||
@Version @Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI compatible
|
||||
|
||||
@Description A string class that can be used as drop-in replacement for
|
||||
std::string on platforms/compilers that don't provide a full C++
|
||||
standard library.
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRTSTRING_H_
|
||||
#define _PVRTSTRING_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#define _USING_PVRTSTRING_
|
||||
|
||||
/*!***************************************************************************
|
||||
@Class CPVRTString
|
||||
@Brief A string class
|
||||
*****************************************************************************/
|
||||
class CPVRTString
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Checking printf and scanf format strings
|
||||
#if defined(_CC_GNU_) || defined(__GNUG__) || defined(__GNUC__)
|
||||
#define FX_PRINTF(fmt,arg) __attribute__((format(printf,fmt,arg)))
|
||||
#define FX_SCANF(fmt,arg) __attribute__((format(scanf,fmt,arg)))
|
||||
#else
|
||||
#define FX_PRINTF(fmt,arg)
|
||||
#define FX_SCANF(fmt,arg)
|
||||
#endif
|
||||
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef char value_type;
|
||||
typedef char& reference;
|
||||
typedef const char& const_reference;
|
||||
|
||||
static const size_type npos;
|
||||
|
||||
|
||||
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTString
|
||||
@Input _Ptr A string
|
||||
@Input _Count Length of _Ptr
|
||||
@Description Constructor
|
||||
************************************************************************/
|
||||
CPVRTString(const char* _Ptr, size_t _Count = npos);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTString
|
||||
@Input _Right A string
|
||||
@Input _Roff Offset into _Right
|
||||
@Input _Count Number of chars from _Right to assign to the new string
|
||||
@Description Constructor
|
||||
************************************************************************/
|
||||
CPVRTString(const CPVRTString& _Right, size_t _Roff = 0, size_t _Count = npos);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTString
|
||||
@Input _Count Length of new string
|
||||
@Input _Ch A char to fill it with
|
||||
@Description Constructor
|
||||
*************************************************************************/
|
||||
CPVRTString(size_t _Count, const char _Ch);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTString
|
||||
@Input _Ch A char
|
||||
@Description Constructor
|
||||
*************************************************************************/
|
||||
CPVRTString(const char _Ch);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTString
|
||||
@Description Constructor
|
||||
************************************************************************/
|
||||
CPVRTString();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function ~CPVRTString
|
||||
@Description Destructor
|
||||
************************************************************************/
|
||||
virtual ~CPVRTString();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function append
|
||||
@Input _Ptr A string
|
||||
@Returns Updated string
|
||||
@Description Appends a string
|
||||
*************************************************************************/
|
||||
CPVRTString& append(const char* _Ptr);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function append
|
||||
@Input _Ptr A string
|
||||
@Input _Count String length
|
||||
@Returns Updated string
|
||||
@Description Appends a string of length _Count
|
||||
*************************************************************************/
|
||||
CPVRTString& append(const char* _Ptr, size_t _Count);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function append
|
||||
@Input _Str A string
|
||||
@Returns Updated string
|
||||
@Description Appends a string
|
||||
*************************************************************************/
|
||||
CPVRTString& append(const CPVRTString& _Str);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function append
|
||||
@Input _Str A string
|
||||
@Input _Off A position in string
|
||||
@Input _Count Number of letters to append
|
||||
@Returns Updated string
|
||||
@Description Appends _Count letters of _Str from _Off in _Str
|
||||
*************************************************************************/
|
||||
CPVRTString& append(const CPVRTString& _Str, size_t _Off, size_t _Count);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function append
|
||||
@Input _Ch A char
|
||||
@Input _Count Number of times to append _Ch
|
||||
@Returns Updated string
|
||||
@Description Appends _Ch _Count times
|
||||
*************************************************************************/
|
||||
CPVRTString& append(size_t _Count, const char _Ch);
|
||||
|
||||
//template<class InputIterator> CPVRTString& append(InputIterator _First, InputIterator _Last);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function assign
|
||||
@Input _Ptr A string
|
||||
@Returns Updated string
|
||||
@Description Assigns the string to the string _Ptr
|
||||
*************************************************************************/
|
||||
CPVRTString& assign(const char* _Ptr);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function assign
|
||||
@Input _Ptr A string
|
||||
@Input _Count Length of _Ptr
|
||||
@Returns Updated string
|
||||
@Description Assigns the string to the string _Ptr
|
||||
*************************************************************************/
|
||||
CPVRTString& assign(const char* _Ptr, size_t _Count);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function assign
|
||||
@Input _Str A string
|
||||
@Returns Updated string
|
||||
@Description Assigns the string to the string _Str
|
||||
*************************************************************************/
|
||||
CPVRTString& assign(const CPVRTString& _Str);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function assign
|
||||
@Input _Str A string
|
||||
@Input _Off First char to start assignment from
|
||||
@Input _Count Length of _Str
|
||||
@Returns Updated string
|
||||
@Description Assigns the string to _Count characters in string _Str starting at _Off
|
||||
*************************************************************************/
|
||||
CPVRTString& assign(const CPVRTString& _Str, size_t _Off, size_t _Count=npos);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function assign
|
||||
@Input _Ch A string
|
||||
@Input _Count Number of times to repeat _Ch
|
||||
@Returns Updated string
|
||||
@Description Assigns the string to _Count copies of _Ch
|
||||
*************************************************************************/
|
||||
CPVRTString& assign(size_t _Count, char _Ch);
|
||||
|
||||
//template<class InputIterator> CPVRTString& assign(InputIterator _First, InputIterator _Last);
|
||||
|
||||
//const_reference at(size_t _Off) const;
|
||||
//reference at(size_t _Off);
|
||||
|
||||
// const_iterator begin() const;
|
||||
// iterator begin();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function c_str
|
||||
@Returns const char* pointer of the string
|
||||
@Description Returns a const char* pointer of the string
|
||||
*************************************************************************/
|
||||
const char* c_str() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function capacity
|
||||
@Returns The size of the character array reserved
|
||||
@Description Returns the size of the character array reserved
|
||||
*************************************************************************/
|
||||
size_t capacity() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function clear
|
||||
@Description Clears the string
|
||||
*************************************************************************/
|
||||
void clear();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function compare
|
||||
@Input _Str A string to compare with
|
||||
@Returns 0 if the strings match
|
||||
@Description Compares the string with _Str
|
||||
*************************************************************************/
|
||||
int compare(const CPVRTString& _Str) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function compare
|
||||
@Input _Pos1 Position to start comparing from
|
||||
@Input _Num1 Number of chars to compare
|
||||
@Input _Str A string to compare with
|
||||
@Returns 0 if the strings match
|
||||
@Description Compares the string with _Str
|
||||
*************************************************************************/
|
||||
int compare(size_t _Pos1, size_t _Num1, const CPVRTString& _Str) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function compare
|
||||
@Input _Pos1 Position to start comparing from
|
||||
@Input _Num1 Number of chars to compare
|
||||
@Input _Str A string to compare with
|
||||
@Input _Off Position in _Str to compare from
|
||||
@Input _Count Number of chars in _Str to compare with
|
||||
@Returns 0 if the strings match
|
||||
@Description Compares the string with _Str
|
||||
*************************************************************************/
|
||||
int compare(size_t _Pos1, size_t _Num1, const CPVRTString& _Str, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function compare
|
||||
@Input _Ptr A string to compare with
|
||||
@Returns 0 if the strings match
|
||||
@Description Compares the string with _Ptr
|
||||
*************************************************************************/
|
||||
int compare(const char* _Ptr) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function compare
|
||||
@Input _Pos1 Position to start comparing from
|
||||
@Input _Num1 Number of chars to compare
|
||||
@Input _Ptr A string to compare with
|
||||
@Returns 0 if the strings match
|
||||
@Description Compares the string with _Ptr
|
||||
*************************************************************************/
|
||||
int compare(size_t _Pos1, size_t _Num1, const char* _Ptr) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function compare
|
||||
@Input _Pos1 Position to start comparing from
|
||||
@Input _Num1 Number of chars to compare
|
||||
@Input _Ptr A string to compare with
|
||||
@Input _Count Number of chars to compare
|
||||
@Returns 0 if the strings match
|
||||
@Description Compares the string with _Str
|
||||
*************************************************************************/
|
||||
int compare(size_t _Pos1, size_t _Num1, const char* _Ptr, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function <
|
||||
@Input _Str A string to compare with
|
||||
@Returns True on success
|
||||
@Description Less than operator
|
||||
*************************************************************************/
|
||||
bool operator<(const CPVRTString & _Str) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function ==
|
||||
@Input _Str A string to compare with
|
||||
@Returns True if they match
|
||||
@Description == Operator
|
||||
*************************************************************************/
|
||||
bool operator==(const CPVRTString& _Str) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function ==
|
||||
@Input _Ptr A string to compare with
|
||||
@Returns True if they match
|
||||
@Description == Operator
|
||||
*************************************************************************/
|
||||
bool operator==(const char* const _Ptr) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function !=
|
||||
@Input _Str A string to compare with
|
||||
@Returns True if they don't match
|
||||
@Description != Operator
|
||||
*************************************************************************/
|
||||
bool operator!=(const CPVRTString& _Str) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function !=
|
||||
@Input _Ptr A string to compare with
|
||||
@Returns True if they don't match
|
||||
@Description != Operator
|
||||
*************************************************************************/
|
||||
bool operator!=(const char* const _Ptr) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function copy
|
||||
@Modified _Ptr A string to copy to
|
||||
@Input _Count Size of _Ptr
|
||||
@Input _Off Position to start copying from
|
||||
@Returns Number of bytes copied
|
||||
@Description Copies the string to _Ptr
|
||||
*************************************************************************/
|
||||
size_t copy(char* _Ptr, size_t _Count, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function data
|
||||
@Returns A const char* version of the string
|
||||
@Description Returns a const char* version of the string
|
||||
*************************************************************************/
|
||||
const char* data( ) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function empty
|
||||
@Returns True if the string is empty
|
||||
@Description Returns true if the string is empty
|
||||
*************************************************************************/
|
||||
bool empty() const;
|
||||
|
||||
// const_iterator end() const;
|
||||
// iterator end();
|
||||
|
||||
//iterator erase(iterator _First, iterator _Last);
|
||||
//iterator erase(iterator _It);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function erase
|
||||
@Input _Pos The position to start erasing from
|
||||
@Input _Count Number of chars to erase
|
||||
@Returns An updated string
|
||||
@Description Erases a portion of the string
|
||||
*************************************************************************/
|
||||
CPVRTString& erase(size_t _Pos = 0, size_t _Count = npos);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function substitute
|
||||
@Input _src Character to search
|
||||
@Input _subDes Character to substitute for
|
||||
@Input _all Substitute all
|
||||
@Returns An updated string
|
||||
@Description Erases a portion of the string
|
||||
*************************************************************************/
|
||||
CPVRTString& substitute(char _src,char _subDes, bool _all = true);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function substitute
|
||||
@Input _src Character to search
|
||||
@Input _subDes Character to substitute for
|
||||
@Input _all Substitute all
|
||||
@Returns An updated string
|
||||
@Description Erases a portion of the string
|
||||
*************************************************************************/
|
||||
CPVRTString& substitute(const char* _src, const char* _subDes, bool _all = true);
|
||||
|
||||
//size_t find(char _Ch, size_t _Off = 0) const;
|
||||
//size_t find(const char* _Ptr, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find
|
||||
@Input _Ptr String to search.
|
||||
@Input _Off Offset to search from.
|
||||
@Input _Count Number of characters in this string.
|
||||
@Returns Position of the first matched string.
|
||||
@Description Finds a substring within this string.
|
||||
*************************************************************************/
|
||||
size_t find(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find
|
||||
@Input _Str String to search.
|
||||
@Input _Off Offset to search from.
|
||||
@Returns Position of the first matched string.
|
||||
@Description Finds a substring within this string.
|
||||
*************************************************************************/
|
||||
size_t find(const CPVRTString& _Str, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_not_of
|
||||
@Input _Ch A char
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the first char that is not _Ch
|
||||
@Description Returns the position of the first char that is not _Ch
|
||||
*************************************************************************/
|
||||
size_t find_first_not_of(char _Ch, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_not_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the first char that is not in _Ptr
|
||||
@Description Returns the position of the first char that is not in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_first_not_of(const char* _Ptr, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_not_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Input _Count Number of chars in _Ptr
|
||||
@Returns Position of the first char that is not in _Ptr
|
||||
@Description Returns the position of the first char that is not in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_first_not_of(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_not_of
|
||||
@Input _Str A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the first char that is not in _Str
|
||||
@Description Returns the position of the first char that is not in _Str
|
||||
*************************************************************************/
|
||||
size_t find_first_not_of(const CPVRTString& _Str, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_of
|
||||
@Input _Ch A char
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the first char that is _Ch
|
||||
@Description Returns the position of the first char that is _Ch
|
||||
*************************************************************************/
|
||||
size_t find_first_of(char _Ch, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the first char that matches a char in _Ptr
|
||||
@Description Returns the position of the first char that matches a char in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_first_of(const char* _Ptr, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Input _Count Size of _Ptr
|
||||
@Returns Position of the first char that matches a char in _Ptr
|
||||
@Description Returns the position of the first char that matches a char in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_first_of(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_ofn
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Input _Count Size of _Ptr
|
||||
@Returns Position of the first char that matches a char in _Ptr
|
||||
@Description Returns the position of the first char that matches all chars in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_first_ofn(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_first_of
|
||||
@Input _Str A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the first char that matches a char in _Str
|
||||
@Description Returns the position of the first char that matches a char in _Str
|
||||
*************************************************************************/
|
||||
size_t find_first_of(const CPVRTString& _Str, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_last_not_of
|
||||
@Input _Ch A char
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the last char that is not _Ch
|
||||
@Description Returns the position of the last char that is not _Ch
|
||||
*************************************************************************/
|
||||
size_t find_last_not_of(char _Ch, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_last_not_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the last char that is not in _Ptr
|
||||
@Description Returns the position of the last char that is not in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_last_not_of(const char* _Ptr, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_last_not_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Input _Count Length of _Ptr
|
||||
@Returns Position of the last char that is not in _Ptr
|
||||
@Description Returns the position of the last char that is not in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_last_not_of(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_last_not_of
|
||||
@Input _Str A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the last char that is not in _Str
|
||||
@Description Returns the position of the last char that is not in _Str
|
||||
*************************************************************************/
|
||||
size_t find_last_not_of(const CPVRTString& _Str, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_last_of
|
||||
@Input _Ch A char
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the last char that is _Ch
|
||||
@Description Returns the position of the last char that is _Ch
|
||||
*************************************************************************/
|
||||
size_t find_last_of(char _Ch, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_last_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the last char that is in _Ptr
|
||||
@Description Returns the position of the last char that is in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_last_of(const char* _Ptr, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_last_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Input _Count Length of _Ptr
|
||||
@Returns Position of the last char that is in _Ptr
|
||||
@Description Returns the position of the last char that is in _Ptr
|
||||
*************************************************************************/
|
||||
size_t find_last_of(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_last_of
|
||||
@Input _Str A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Position of the last char that is in _Str
|
||||
@Description Returns the position of the last char that is in _Str
|
||||
*************************************************************************/
|
||||
size_t find_last_of(const CPVRTString& _Str, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_number_of
|
||||
@Input _Ch A char
|
||||
@Input _Off Start position of the find
|
||||
@Returns Number of occurances of _Ch in the parent string.
|
||||
@Description Returns the number of occurances of _Ch in the parent string.
|
||||
*************************************************************************/
|
||||
size_t find_number_of(char _Ch, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_number_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Number of occurances of _Ptr in the parent string.
|
||||
@Description Returns the number of occurances of _Ptr in the parent string.
|
||||
*************************************************************************/
|
||||
size_t find_number_of(const char* _Ptr, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_number_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Input _Count Size of _Ptr
|
||||
@Returns Number of occurances of _Ptr in the parent string.
|
||||
@Description Returns the number of occurances of _Ptr in the parent string.
|
||||
*************************************************************************/
|
||||
size_t find_number_of(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_number_of
|
||||
@Input _Str A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Number of occurances of _Str in the parent string.
|
||||
@Description Returns the number of occurances of _Str in the parent string.
|
||||
*************************************************************************/
|
||||
size_t find_number_of(const CPVRTString& _Str, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_next_occurance_of
|
||||
@Input _Ch A char
|
||||
@Input _Off Start position of the find
|
||||
@Returns Next occurance of _Ch in the parent string.
|
||||
@Description Returns the next occurance of _Ch in the parent string
|
||||
after or at _Off. If not found, returns the length of the string.
|
||||
*************************************************************************/
|
||||
int find_next_occurance_of(char _Ch, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_next_occurance_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Next occurance of _Ptr in the parent string.
|
||||
@Description Returns the next occurance of _Ptr in the parent string
|
||||
after or at _Off. If not found, returns the length of the string.
|
||||
*************************************************************************/
|
||||
int find_next_occurance_of(const char* _Ptr, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_next_occurance_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Input _Count Size of _Ptr
|
||||
@Returns Next occurance of _Ptr in the parent string.
|
||||
@Description Returns the next occurance of _Ptr in the parent string
|
||||
after or at _Off. If not found, returns the length of the string.
|
||||
*************************************************************************/
|
||||
int find_next_occurance_of(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_next_occurance_of
|
||||
@Input _Str A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Next occurance of _Str in the parent string.
|
||||
@Description Returns the next occurance of _Str in the parent string
|
||||
after or at _Off. If not found, returns the length of the string.
|
||||
*************************************************************************/
|
||||
int find_next_occurance_of(const CPVRTString& _Str, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_previous_occurance_of
|
||||
@Input _Ch A char
|
||||
@Input _Off Start position of the find
|
||||
@Returns Previous occurance of _Ch in the parent string.
|
||||
@Description Returns the previous occurance of _Ch in the parent string
|
||||
before _Off. If not found, returns -1.
|
||||
*************************************************************************/
|
||||
int find_previous_occurance_of(char _Ch, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_previous_occurance_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Previous occurance of _Ptr in the parent string.
|
||||
@Description Returns the previous occurance of _Ptr in the parent string
|
||||
before _Off. If not found, returns -1.
|
||||
*************************************************************************/
|
||||
int find_previous_occurance_of(const char* _Ptr, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_previous_occurance_of
|
||||
@Input _Ptr A string
|
||||
@Input _Off Start position of the find
|
||||
@Input _Count Size of _Ptr
|
||||
@Returns Previous occurance of _Ptr in the parent string.
|
||||
@Description Returns the previous occurance of _Ptr in the parent string
|
||||
before _Off. If not found, returns -1.
|
||||
*************************************************************************/
|
||||
int find_previous_occurance_of(const char* _Ptr, size_t _Off, size_t _Count) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function find_previous_occurance_of
|
||||
@Input _Str A string
|
||||
@Input _Off Start position of the find
|
||||
@Returns Previous occurance of _Str in the parent string.
|
||||
@Description Returns the previous occurance of _Str in the parent string
|
||||
before _Off. If not found, returns -1.
|
||||
*************************************************************************/
|
||||
int find_previous_occurance_of(const CPVRTString& _Str, size_t _Off = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function left
|
||||
@Input iSize number of characters to return (excluding null character)
|
||||
@Returns The leftmost 'iSize' characters of the string.
|
||||
@Description Returns the leftmost characters of the string (excluding
|
||||
the null character) in a new CPVRTString. If iSize is
|
||||
larger than the string, a copy of the original string is returned.
|
||||
*************************************************************************/
|
||||
CPVRTString left(size_t iSize) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function right
|
||||
@Input iSize number of characters to return (excluding null character)
|
||||
@Returns The rightmost 'iSize' characters of the string.
|
||||
@Description Returns the rightmost characters of the string (excluding
|
||||
the null character) in a new CPVRTString. If iSize is
|
||||
larger than the string, a copy of the original string is returned.
|
||||
*************************************************************************/
|
||||
CPVRTString right(size_t iSize) const;
|
||||
|
||||
//allocator_type get_allocator( ) const;
|
||||
|
||||
//CPVRTString& insert(size_t _P0, const char* _Ptr);
|
||||
//CPVRTString& insert(size_t _P0, const char* _Ptr, size_t _Count);
|
||||
//CPVRTString& insert(size_t _P0, const CPVRTString& _Str);
|
||||
//CPVRTString& insert(size_t _P0, const CPVRTString& _Str, size_t _Off, size_t _Count);
|
||||
//CPVRTString& insert(size_t _P0, size_t _Count, char _Ch);
|
||||
//iterator insert(iterator _It, char _Ch = char());
|
||||
//template<class InputIterator> void insert(iterator _It, InputIterator _First, InputIterator _Last);
|
||||
//void insert(iterator _It, size_t _Count, char _Ch);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function length
|
||||
@Returns Length of the string
|
||||
@Description Returns the length of the string
|
||||
*************************************************************************/
|
||||
size_t length() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function max_size
|
||||
@Returns The maximum number of chars that the string can contain
|
||||
@Description Returns the maximum number of chars that the string can contain
|
||||
*************************************************************************/
|
||||
size_t max_size() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function push_back
|
||||
@Input _Ch A char to append
|
||||
@Description Appends _Ch to the string
|
||||
*************************************************************************/
|
||||
void push_back(char _Ch);
|
||||
|
||||
// const_reverse_iterator rbegin() const;
|
||||
// reverse_iterator rbegin();
|
||||
|
||||
// const_reverse_iterator rend() const;
|
||||
// reverse_iterator rend();
|
||||
|
||||
//CPVRTString& replace(size_t _Pos1, size_t _Num1, const char* _Ptr);
|
||||
//CPVRTString& replace(size_t _Pos1, size_t _Num1, const CPVRTString& _Str);
|
||||
//CPVRTString& replace(size_t _Pos1, size_t _Num1, const char* _Ptr, size_t _Num2);
|
||||
//CPVRTString& replace(size_t _Pos1, size_t _Num1, const CPVRTString& _Str, size_t _Pos2, size_t _Num2);
|
||||
//CPVRTString& replace(size_t _Pos1, size_t _Num1, size_t _Count, char _Ch);
|
||||
|
||||
//CPVRTString& replace(iterator _First0, iterator _Last0, const char* _Ptr);
|
||||
//CPVRTString& replace(iterator _First0, iterator _Last0, const CPVRTString& _Str);
|
||||
//CPVRTString& replace(iterator _First0, iterator _Last0, const char* _Ptr, size_t _Num2);
|
||||
//CPVRTString& replace(iterator _First0, iterator _Last0, size_t _Num2, char _Ch);
|
||||
//template<class InputIterator> CPVRTString& replace(iterator _First0, iterator _Last0, InputIterator _First, InputIterator _Last);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function reserve
|
||||
@Input _Count Size of string to reserve
|
||||
@Description Reserves space for _Count number of chars
|
||||
*************************************************************************/
|
||||
void reserve(size_t _Count = 0);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function resize
|
||||
@Input _Count Size of string to resize to
|
||||
@Input _Ch Character to use to fill any additional space
|
||||
@Description Resizes the string to _Count in length
|
||||
*************************************************************************/
|
||||
void resize(size_t _Count, char _Ch = char());
|
||||
|
||||
//size_t rfind(char _Ch, size_t _Off = npos) const;
|
||||
//size_t rfind(const char* _Ptr, size_t _Off = npos) const;
|
||||
//size_t rfind(const char* _Ptr, size_t _Off = npos, size_t _Count) const;
|
||||
//size_t rfind(const CPVRTString& _Str, size_t _Off = npos) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function size
|
||||
@Returns Size of the string
|
||||
@Description Returns the size of the string
|
||||
*************************************************************************/
|
||||
size_t size() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function substr
|
||||
@Input _Off Start of the substring
|
||||
@Input _Count Length of the substring
|
||||
@Returns A substring of the string
|
||||
@Description Returns the size of the string
|
||||
*************************************************************************/
|
||||
CPVRTString substr(size_t _Off = 0, size_t _Count = npos) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function swap
|
||||
@Input _Str A string to swap with
|
||||
@Description Swaps the contents of the string with _Str
|
||||
*************************************************************************/
|
||||
void swap(CPVRTString& _Str);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function toLower
|
||||
@Returns An updated string
|
||||
@Description Converts the string to lower case
|
||||
*************************************************************************/
|
||||
CPVRTString& toLower();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function toUpper
|
||||
@Returns An updated string
|
||||
@Description Converts the string to upper case
|
||||
*************************************************************************/
|
||||
CPVRTString& toUpper();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function format
|
||||
@Input pFormat A string containing the formating
|
||||
@Returns A formatted string
|
||||
@Description return the formatted string
|
||||
************************************************************************/
|
||||
CPVRTString format(const char *pFormat, ...);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function +=
|
||||
@Input _Ch A char
|
||||
@Returns An updated string
|
||||
@Description += Operator
|
||||
*************************************************************************/
|
||||
CPVRTString& operator+=(char _Ch);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function +=
|
||||
@Input _Ptr A string
|
||||
@Returns An updated string
|
||||
@Description += Operator
|
||||
*************************************************************************/
|
||||
CPVRTString& operator+=(const char* _Ptr);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function +=
|
||||
@Input _Right A string
|
||||
@Returns An updated string
|
||||
@Description += Operator
|
||||
*************************************************************************/
|
||||
CPVRTString& operator+=(const CPVRTString& _Right);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function =
|
||||
@Input _Ch A char
|
||||
@Returns An updated string
|
||||
@Description = Operator
|
||||
*************************************************************************/
|
||||
CPVRTString& operator=(char _Ch);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function =
|
||||
@Input _Ptr A string
|
||||
@Returns An updated string
|
||||
@Description = Operator
|
||||
*************************************************************************/
|
||||
CPVRTString& operator=(const char* _Ptr);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function =
|
||||
@Input _Right A string
|
||||
@Returns An updated string
|
||||
@Description = Operator
|
||||
*************************************************************************/
|
||||
CPVRTString& operator=(const CPVRTString& _Right);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function []
|
||||
@Input _Off An index into the string
|
||||
@Returns A character
|
||||
@Description [] Operator
|
||||
*************************************************************************/
|
||||
const_reference operator[](size_t _Off) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function []
|
||||
@Input _Off An index into the string
|
||||
@Returns A character
|
||||
@Description [] Operator
|
||||
*************************************************************************/
|
||||
reference operator[](size_t _Off);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function +
|
||||
@Input _Left A string
|
||||
@Input _Right A string
|
||||
@Returns An updated string
|
||||
@Description + Operator
|
||||
*************************************************************************/
|
||||
friend CPVRTString operator+ (const CPVRTString& _Left, const CPVRTString& _Right);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function +
|
||||
@Input _Left A string
|
||||
@Input _Right A string
|
||||
@Returns An updated string
|
||||
@Description + Operator
|
||||
*************************************************************************/
|
||||
friend CPVRTString operator+ (const CPVRTString& _Left, const char* _Right);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function +
|
||||
@Input _Left A string
|
||||
@Input _Right A string
|
||||
@Returns An updated string
|
||||
@Description + Operator
|
||||
*************************************************************************/
|
||||
friend CPVRTString operator+ (const CPVRTString& _Left, const char _Right);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function +
|
||||
@Input _Left A string
|
||||
@Input _Right A string
|
||||
@Returns An updated string
|
||||
@Description + Operator
|
||||
*************************************************************************/
|
||||
friend CPVRTString operator+ (const char* _Left, const CPVRTString& _Right);
|
||||
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function +
|
||||
@Input _Left A string
|
||||
@Input _Right A string
|
||||
@Returns An updated string
|
||||
@Description + Operator
|
||||
*************************************************************************/
|
||||
friend CPVRTString operator+ (const char _Left, const CPVRTString& _Right);
|
||||
|
||||
protected:
|
||||
char* m_pString;
|
||||
size_t m_Size;
|
||||
size_t m_Capacity;
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
* MISCELLANEOUS UTILITY FUNCTIONS
|
||||
*************************************************************************/
|
||||
/*!***********************************************************************
|
||||
@Function PVRTStringGetFileExtension
|
||||
@Input strFilePath A string
|
||||
@Returns Extension
|
||||
@Description Extracts the file extension from a file path.
|
||||
Returns an empty CPVRTString if no extension is found.
|
||||
************************************************************************/
|
||||
CPVRTString PVRTStringGetFileExtension(const CPVRTString& strFilePath);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTStringGetContainingDirectoryPath
|
||||
@Input strFilePath A string
|
||||
@Returns Directory
|
||||
@Description Extracts the directory portion from a file path.
|
||||
************************************************************************/
|
||||
CPVRTString PVRTStringGetContainingDirectoryPath(const CPVRTString& strFilePath);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTStringGetFileName
|
||||
@Input strFilePath A string
|
||||
@Returns FileName
|
||||
@Description Extracts the name and extension portion from a file path.
|
||||
************************************************************************/
|
||||
CPVRTString PVRTStringGetFileName(const CPVRTString& strFilePath);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTStringStripWhiteSpaceFromStartOf
|
||||
@Input strLine A string
|
||||
@Returns Result of the white space stripping
|
||||
@Description strips white space characters from the beginning of a CPVRTString.
|
||||
************************************************************************/
|
||||
CPVRTString PVRTStringStripWhiteSpaceFromStartOf(const CPVRTString& strLine);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTStringStripWhiteSpaceFromEndOf
|
||||
@Input strLine A string
|
||||
@Returns Result of the white space stripping
|
||||
@Description strips white space characters from the end of a CPVRTString.
|
||||
************************************************************************/
|
||||
CPVRTString PVRTStringStripWhiteSpaceFromEndOf(const CPVRTString& strLine);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTStringFromFormattedStr
|
||||
@Input pFormat A string containing the formating
|
||||
@Returns A formatted string
|
||||
@Description Creates a formatted string
|
||||
************************************************************************/
|
||||
CPVRTString PVRTStringFromFormattedStr(const char *pFormat, ...);
|
||||
|
||||
#endif // _PVRTSTRING_H_
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
End of file (PVRTString.h)
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
703
extern/pvrtextool/Include/PVRTTexture.h
vendored
Normal file
703
extern/pvrtextool/Include/PVRTTexture.h
vendored
Normal file
@ -0,0 +1,703 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTTexture.h
|
||||
|
||||
@Title PVRTTexture
|
||||
|
||||
@Version @Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI compatible
|
||||
|
||||
@Description Texture loading.
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRTTEXTURE_H_
|
||||
#define _PVRTTEXTURE_H_
|
||||
|
||||
//ACS: PVRTGlobal.h was dragging in too much stuff (like windows.h & crtdbg.h)
|
||||
// so I split the relevant stuff out into a new file, PVRTTypes.h
|
||||
//#include "PVRTGlobal.h"
|
||||
#include "PVRTTypes.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* Texture related constants and enumerations.
|
||||
*****************************************************************************/
|
||||
// V3 Header Identifiers.
|
||||
const PVRTuint32 PVRTEX3_IDENT = 0x03525650; // 'P''V''R'3
|
||||
const PVRTuint32 PVRTEX3_IDENT_REV = 0x50565203;
|
||||
// If endianness is backwards then PVR3 will read as 3RVP, hence why it is written as an int.
|
||||
|
||||
//Current version texture identifiers
|
||||
const PVRTuint32 PVRTEX_CURR_IDENT = PVRTEX3_IDENT;
|
||||
const PVRTuint32 PVRTEX_CURR_IDENT_REV = PVRTEX3_IDENT_REV;
|
||||
|
||||
// PVR Header file flags. Condition if true. If false, opposite is true unless specified.
|
||||
const PVRTuint32 PVRTEX3_FILE_COMPRESSED = (1<<0); // Texture has been file compressed using PVRTexLib (currently unused)
|
||||
const PVRTuint32 PVRTEX3_PREMULTIPLIED = (1<<1); // Texture has been premultiplied by alpha value.
|
||||
|
||||
// Mip Map level specifier constants. Other levels are specified by 1,2...n
|
||||
const PVRTint32 PVRTEX_TOPMIPLEVEL = 0;
|
||||
const PVRTint32 PVRTEX_ALLMIPLEVELS = -1; //This is a special number used simply to return a total of all MIP levels when dealing with data sizes.
|
||||
|
||||
//values for each meta data type that we know about. Texture arrays hinge on each surface being identical in all but content, including meta data.
|
||||
//If the meta data varies even slightly then a new texture should be used. It is possible to write your own extension to get around this however.
|
||||
enum EPVRTMetaData
|
||||
{
|
||||
ePVRTMetaDataTextureAtlasCoords=0,
|
||||
ePVRTMetaDataBumpData,
|
||||
ePVRTMetaDataCubeMapOrder,
|
||||
ePVRTMetaDataTextureOrientation,
|
||||
ePVRTMetaDataBorderData,
|
||||
ePVRTMetaDataPadding,
|
||||
ePVRTMetaDataNumMetaDataTypes
|
||||
};
|
||||
|
||||
enum EPVRTAxis
|
||||
{
|
||||
ePVRTAxisX = 0,
|
||||
ePVRTAxisY = 1,
|
||||
ePVRTAxisZ = 2
|
||||
};
|
||||
|
||||
enum EPVRTOrientation
|
||||
{
|
||||
ePVRTOrientLeft = 1<<ePVRTAxisX,
|
||||
ePVRTOrientRight= 0,
|
||||
ePVRTOrientUp = 1<<ePVRTAxisY,
|
||||
ePVRTOrientDown = 0,
|
||||
ePVRTOrientOut = 1<<ePVRTAxisZ,
|
||||
ePVRTOrientIn = 0
|
||||
};
|
||||
|
||||
enum EPVRTColourSpace
|
||||
{
|
||||
ePVRTCSpacelRGB,
|
||||
ePVRTCSpacesRGB,
|
||||
ePVRTCSpaceNumSpaces
|
||||
};
|
||||
|
||||
//Compressed pixel formats
|
||||
enum EPVRTPixelFormat
|
||||
{
|
||||
ePVRTPF_PVRTCI_2bpp_RGB,
|
||||
ePVRTPF_PVRTCI_2bpp_RGBA,
|
||||
ePVRTPF_PVRTCI_4bpp_RGB,
|
||||
ePVRTPF_PVRTCI_4bpp_RGBA,
|
||||
ePVRTPF_PVRTCII_2bpp,
|
||||
ePVRTPF_PVRTCII_4bpp,
|
||||
ePVRTPF_ETC1,
|
||||
ePVRTPF_DXT1,
|
||||
ePVRTPF_DXT2,
|
||||
ePVRTPF_DXT3,
|
||||
ePVRTPF_DXT4,
|
||||
ePVRTPF_DXT5,
|
||||
|
||||
//These formats are identical to some DXT formats.
|
||||
ePVRTPF_BC1 = ePVRTPF_DXT1,
|
||||
ePVRTPF_BC2 = ePVRTPF_DXT3,
|
||||
ePVRTPF_BC3 = ePVRTPF_DXT5,
|
||||
|
||||
//These are currently unsupported:
|
||||
ePVRTPF_BC4,
|
||||
ePVRTPF_BC5,
|
||||
ePVRTPF_BC6,
|
||||
ePVRTPF_BC7,
|
||||
|
||||
//These are supported
|
||||
ePVRTPF_UYVY,
|
||||
ePVRTPF_YUY2,
|
||||
ePVRTPF_BW1bpp,
|
||||
ePVRTPF_SharedExponentR9G9B9E5,
|
||||
ePVRTPF_RGBG8888,
|
||||
ePVRTPF_GRGB8888,
|
||||
ePVRTPF_ETC2_RGB,
|
||||
ePVRTPF_ETC2_RGBA,
|
||||
ePVRTPF_ETC2_RGB_A1,
|
||||
ePVRTPF_EAC_R11,
|
||||
ePVRTPF_EAC_RG11,
|
||||
|
||||
//Invalid value
|
||||
ePVRTPF_NumCompressedPFs
|
||||
};
|
||||
|
||||
//Variable Type Names
|
||||
enum EPVRTVariableType
|
||||
{
|
||||
ePVRTVarTypeUnsignedByteNorm,
|
||||
ePVRTVarTypeSignedByteNorm,
|
||||
ePVRTVarTypeUnsignedByte,
|
||||
ePVRTVarTypeSignedByte,
|
||||
ePVRTVarTypeUnsignedShortNorm,
|
||||
ePVRTVarTypeSignedShortNorm,
|
||||
ePVRTVarTypeUnsignedShort,
|
||||
ePVRTVarTypeSignedShort,
|
||||
ePVRTVarTypeUnsignedIntegerNorm,
|
||||
ePVRTVarTypeSignedIntegerNorm,
|
||||
ePVRTVarTypeUnsignedInteger,
|
||||
ePVRTVarTypeSignedInteger,
|
||||
ePVRTVarTypeSignedFloat, ePVRTVarTypeFloat=ePVRTVarTypeSignedFloat, //the name ePVRTVarTypeFloat is now deprecated.
|
||||
ePVRTVarTypeUnsignedFloat,
|
||||
ePVRTVarTypeNumVarTypes
|
||||
};
|
||||
|
||||
//A 64 bit pixel format ID & this will give you the high bits of a pixel format to check for a compressed format.
|
||||
static const PVRTuint64 PVRTEX_PFHIGHMASK=0xffffffff00000000ull;
|
||||
|
||||
/*****************************************************************************
|
||||
* Texture header structures.
|
||||
*****************************************************************************/
|
||||
|
||||
struct MetaDataBlock
|
||||
{
|
||||
PVRTuint32 DevFOURCC; //A 4cc descriptor of the data type's creator. Values equating to values between 'P' 'V' 'R' 0 and 'P' 'V' 'R' 255 will be used by our headers.
|
||||
PVRTuint32 u32Key; //A DWORD (enum value) identifying the data type, and thus how to read it.
|
||||
PVRTuint32 u32DataSize; //Size of the Data member.
|
||||
PVRTuint8* Data; //Data array, can be absolutely anything, the loader needs to know how to handle it based on DevFOURCC and Key. Use new operator to assign to it.
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function MetaDataBlock
|
||||
@Description Meta Data Block Constructor
|
||||
*************************************************************************/
|
||||
MetaDataBlock() : DevFOURCC(0), u32Key(0), u32DataSize(0), Data(NULL)
|
||||
{}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function MetaDataBlock
|
||||
@Description Meta Data Block Copy Constructor
|
||||
*************************************************************************/
|
||||
MetaDataBlock(const MetaDataBlock& rhs) : DevFOURCC(rhs.DevFOURCC), u32Key(rhs.u32Key), u32DataSize(rhs.u32DataSize)
|
||||
{
|
||||
//Copy the data across.
|
||||
Data = new PVRTuint8[u32DataSize];
|
||||
for (PVRTuint32 uiDataAmt=0; uiDataAmt<u32DataSize; ++uiDataAmt)
|
||||
{
|
||||
Data[uiDataAmt]=rhs.Data[uiDataAmt];
|
||||
}
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function ~MetaDataBlock
|
||||
@Description Meta Data Block Destructor
|
||||
*************************************************************************/
|
||||
~MetaDataBlock()
|
||||
{
|
||||
if (Data)
|
||||
delete [] Data;
|
||||
Data = NULL;
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function SizeOfBlock
|
||||
@Return size_t Size (in a file) of the block.
|
||||
@Description Returns the number of extra bytes this will add to any output files.
|
||||
*************************************************************************/
|
||||
size_t SizeOfBlock() const
|
||||
{
|
||||
return sizeof(DevFOURCC)+sizeof(u32Key)+sizeof(u32DataSize)+u32DataSize;
|
||||
}
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function operator=
|
||||
@Return MetaDataBlock This MetaDataBlock after the operation.
|
||||
@Description Assigns one MetaDataBlock to the other.
|
||||
*************************************************************************/
|
||||
MetaDataBlock& operator=(const MetaDataBlock& rhs)
|
||||
{
|
||||
if (&rhs==this)
|
||||
return *this;
|
||||
|
||||
//Remove pre-existing data.
|
||||
if (Data)
|
||||
delete [] Data;
|
||||
Data=NULL;
|
||||
|
||||
//Copy the basic parameters
|
||||
DevFOURCC=rhs.DevFOURCC;
|
||||
u32Key=rhs.u32Key;
|
||||
u32DataSize=rhs.u32DataSize;
|
||||
|
||||
//Copy the data across.
|
||||
if (rhs.Data)
|
||||
{
|
||||
Data = new PVRTuint8[u32DataSize];
|
||||
for (PVRTuint32 uiDataAmt=0; uiDataAmt<u32DataSize; ++uiDataAmt)
|
||||
{
|
||||
Data[uiDataAmt]=rhs.Data[uiDataAmt];
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function ReadFromPtr
|
||||
@Input pDataCursor The data to read
|
||||
@Description Reads from a pointer of memory in to the meta data block.
|
||||
*****************************************************************************/
|
||||
bool ReadFromPtr(const unsigned char** pDataCursor);
|
||||
};
|
||||
|
||||
//The idea behind this is that it stores EVERYTHING that you would ever need to read a texture accurately, and nothing more.
|
||||
//Extraneous data is stored in meta data. Correct use of the texture may rely on meta data, but accurate data loading can be done through the
|
||||
//Standard header alone.
|
||||
|
||||
#pragma pack(push,4)
|
||||
struct PVRTextureHeaderV3{
|
||||
PVRTuint32 u32Version; //Version of the file header, used to identify it.
|
||||
PVRTuint32 u32Flags; //Various format flags.
|
||||
PVRTuint64 u64PixelFormat; //The pixel format, 8cc value storing the 4 channel identifiers and their respective sizes.
|
||||
PVRTuint32 u32ColourSpace; //The Colour Space of the texture, currently either linear RGB or sRGB.
|
||||
PVRTuint32 u32ChannelType; //Variable type that the channel is stored in. Supports signed/unsigned int/short/byte or float for now.
|
||||
PVRTuint32 u32Height; //Height of the texture.
|
||||
PVRTuint32 u32Width; //Width of the texture.
|
||||
PVRTuint32 u32Depth; //Depth of the texture. (Z-slices)
|
||||
PVRTuint32 u32NumSurfaces; //Number of members in a Texture Array.
|
||||
PVRTuint32 u32NumFaces; //Number of faces in a Cube Map. Maybe be a value other than 6.
|
||||
PVRTuint32 u32MIPMapCount; //Number of MIP Maps in the texture - NB: Includes top level.
|
||||
PVRTuint32 u32MetaDataSize; //Size of the accompanying meta data.
|
||||
|
||||
//Constructor for the header - used to make sure that the header is initialised usefully. The initial pixel format is an invalid one and must be set.
|
||||
PVRTextureHeaderV3() :
|
||||
u32Version(PVRTEX3_IDENT),u32Flags(0),
|
||||
u64PixelFormat(ePVRTPF_NumCompressedPFs),
|
||||
u32ColourSpace(0),u32ChannelType(0),
|
||||
u32Height(1),u32Width(1),u32Depth(1),
|
||||
u32NumSurfaces(1),u32NumFaces(1),
|
||||
u32MIPMapCount(1),u32MetaDataSize(0)
|
||||
{}
|
||||
};
|
||||
#pragma pack(pop)
|
||||
#define PVRTEX3_HEADERSIZE 52
|
||||
|
||||
/*!***************************************************************************
|
||||
Describes the Version 2 header of a PVR texture header.
|
||||
*****************************************************************************/
|
||||
struct PVR_Texture_Header
|
||||
{
|
||||
PVRTuint32 dwHeaderSize; /*!< size of the structure */
|
||||
PVRTuint32 dwHeight; /*!< height of surface to be created */
|
||||
PVRTuint32 dwWidth; /*!< width of input surface */
|
||||
PVRTuint32 dwMipMapCount; /*!< number of mip-map levels requested */
|
||||
PVRTuint32 dwpfFlags; /*!< pixel format flags */
|
||||
PVRTuint32 dwTextureDataSize; /*!< Total size in bytes */
|
||||
PVRTuint32 dwBitCount; /*!< number of bits per pixel */
|
||||
PVRTuint32 dwRBitMask; /*!< mask for red bit */
|
||||
PVRTuint32 dwGBitMask; /*!< mask for green bits */
|
||||
PVRTuint32 dwBBitMask; /*!< mask for blue bits */
|
||||
PVRTuint32 dwAlphaBitMask; /*!< mask for alpha channel */
|
||||
PVRTuint32 dwPVR; /*!< magic number identifying pvr file */
|
||||
PVRTuint32 dwNumSurfs; /*!< the number of surfaces present in the pvr */
|
||||
} ;
|
||||
|
||||
/*****************************************************************************
|
||||
* Legacy (V2 and V1) ENUMS
|
||||
*****************************************************************************/
|
||||
|
||||
enum PVRTPixelType
|
||||
{
|
||||
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,
|
||||
|
||||
// OpenGL version of pixel types
|
||||
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,
|
||||
OGL_A_8,
|
||||
OGL_PVRTCII4, //Not in use
|
||||
OGL_PVRTCII2, //Not in use
|
||||
|
||||
// S3TC Encoding
|
||||
D3D_DXT1 = 0x20,
|
||||
D3D_DXT2,
|
||||
D3D_DXT3,
|
||||
D3D_DXT4,
|
||||
D3D_DXT5,
|
||||
|
||||
//RGB Formats
|
||||
D3D_RGB_332,
|
||||
D3D_AL_44,
|
||||
D3D_LVU_655,
|
||||
D3D_XLVU_8888,
|
||||
D3D_QWVU_8888,
|
||||
|
||||
//10 bit integer - 2 bit alpha
|
||||
D3D_ABGR_2101010,
|
||||
D3D_ARGB_2101010,
|
||||
D3D_AWVU_2101010,
|
||||
|
||||
//16 bit integers
|
||||
D3D_GR_1616,
|
||||
D3D_VU_1616,
|
||||
D3D_ABGR_16161616,
|
||||
|
||||
//Float Formats
|
||||
D3D_R16F,
|
||||
D3D_GR_1616F,
|
||||
D3D_ABGR_16161616F,
|
||||
|
||||
//32 bits per channel
|
||||
D3D_R32F,
|
||||
D3D_GR_3232F,
|
||||
D3D_ABGR_32323232F,
|
||||
|
||||
// Ericsson
|
||||
ETC_RGB_4BPP,
|
||||
ETC_RGBA_EXPLICIT, // unimplemented
|
||||
ETC_RGBA_INTERPOLATED, // unimplemented
|
||||
|
||||
D3D_A8 = 0x40,
|
||||
D3D_V8U8,
|
||||
D3D_L16,
|
||||
|
||||
D3D_L8,
|
||||
D3D_AL_88,
|
||||
|
||||
//Y'UV Colourspace
|
||||
D3D_UYVY,
|
||||
D3D_YUY2,
|
||||
|
||||
// DX10
|
||||
DX10_R32G32B32A32_FLOAT= 0x50,
|
||||
DX10_R32G32B32A32_UINT ,
|
||||
DX10_R32G32B32A32_SINT,
|
||||
|
||||
DX10_R32G32B32_FLOAT,
|
||||
DX10_R32G32B32_UINT,
|
||||
DX10_R32G32B32_SINT,
|
||||
|
||||
DX10_R16G16B16A16_FLOAT ,
|
||||
DX10_R16G16B16A16_UNORM,
|
||||
DX10_R16G16B16A16_UINT ,
|
||||
DX10_R16G16B16A16_SNORM ,
|
||||
DX10_R16G16B16A16_SINT ,
|
||||
|
||||
DX10_R32G32_FLOAT ,
|
||||
DX10_R32G32_UINT ,
|
||||
DX10_R32G32_SINT ,
|
||||
|
||||
DX10_R10G10B10A2_UNORM ,
|
||||
DX10_R10G10B10A2_UINT ,
|
||||
|
||||
DX10_R11G11B10_FLOAT , // unimplemented
|
||||
|
||||
DX10_R8G8B8A8_UNORM ,
|
||||
DX10_R8G8B8A8_UNORM_SRGB ,
|
||||
DX10_R8G8B8A8_UINT ,
|
||||
DX10_R8G8B8A8_SNORM ,
|
||||
DX10_R8G8B8A8_SINT ,
|
||||
|
||||
DX10_R16G16_FLOAT ,
|
||||
DX10_R16G16_UNORM ,
|
||||
DX10_R16G16_UINT ,
|
||||
DX10_R16G16_SNORM ,
|
||||
DX10_R16G16_SINT ,
|
||||
|
||||
DX10_R32_FLOAT ,
|
||||
DX10_R32_UINT ,
|
||||
DX10_R32_SINT ,
|
||||
|
||||
DX10_R8G8_UNORM ,
|
||||
DX10_R8G8_UINT ,
|
||||
DX10_R8G8_SNORM ,
|
||||
DX10_R8G8_SINT ,
|
||||
|
||||
DX10_R16_FLOAT ,
|
||||
DX10_R16_UNORM ,
|
||||
DX10_R16_UINT ,
|
||||
DX10_R16_SNORM ,
|
||||
DX10_R16_SINT ,
|
||||
|
||||
DX10_R8_UNORM,
|
||||
DX10_R8_UINT,
|
||||
DX10_R8_SNORM,
|
||||
DX10_R8_SINT,
|
||||
|
||||
DX10_A8_UNORM,
|
||||
DX10_R1_UNORM,
|
||||
DX10_R9G9B9E5_SHAREDEXP, // unimplemented
|
||||
DX10_R8G8_B8G8_UNORM, // unimplemented
|
||||
DX10_G8R8_G8B8_UNORM, // unimplemented
|
||||
|
||||
DX10_BC1_UNORM,
|
||||
DX10_BC1_UNORM_SRGB,
|
||||
|
||||
DX10_BC2_UNORM,
|
||||
DX10_BC2_UNORM_SRGB,
|
||||
|
||||
DX10_BC3_UNORM,
|
||||
DX10_BC3_UNORM_SRGB,
|
||||
|
||||
DX10_BC4_UNORM, // unimplemented
|
||||
DX10_BC4_SNORM, // unimplemented
|
||||
|
||||
DX10_BC5_UNORM, // unimplemented
|
||||
DX10_BC5_SNORM, // unimplemented
|
||||
|
||||
// OpenVG
|
||||
|
||||
/* RGB{A,X} channel ordering */
|
||||
ePT_VG_sRGBX_8888 = 0x90,
|
||||
ePT_VG_sRGBA_8888,
|
||||
ePT_VG_sRGBA_8888_PRE,
|
||||
ePT_VG_sRGB_565,
|
||||
ePT_VG_sRGBA_5551,
|
||||
ePT_VG_sRGBA_4444,
|
||||
ePT_VG_sL_8,
|
||||
ePT_VG_lRGBX_8888,
|
||||
ePT_VG_lRGBA_8888,
|
||||
ePT_VG_lRGBA_8888_PRE,
|
||||
ePT_VG_lL_8,
|
||||
ePT_VG_A_8,
|
||||
ePT_VG_BW_1,
|
||||
|
||||
/* {A,X}RGB channel ordering */
|
||||
ePT_VG_sXRGB_8888,
|
||||
ePT_VG_sARGB_8888,
|
||||
ePT_VG_sARGB_8888_PRE,
|
||||
ePT_VG_sARGB_1555,
|
||||
ePT_VG_sARGB_4444,
|
||||
ePT_VG_lXRGB_8888,
|
||||
ePT_VG_lARGB_8888,
|
||||
ePT_VG_lARGB_8888_PRE,
|
||||
|
||||
/* BGR{A,X} channel ordering */
|
||||
ePT_VG_sBGRX_8888,
|
||||
ePT_VG_sBGRA_8888,
|
||||
ePT_VG_sBGRA_8888_PRE,
|
||||
ePT_VG_sBGR_565,
|
||||
ePT_VG_sBGRA_5551,
|
||||
ePT_VG_sBGRA_4444,
|
||||
ePT_VG_lBGRX_8888,
|
||||
ePT_VG_lBGRA_8888,
|
||||
ePT_VG_lBGRA_8888_PRE,
|
||||
|
||||
/* {A,X}BGR channel ordering */
|
||||
ePT_VG_sXBGR_8888,
|
||||
ePT_VG_sABGR_8888 ,
|
||||
ePT_VG_sABGR_8888_PRE,
|
||||
ePT_VG_sABGR_1555,
|
||||
ePT_VG_sABGR_4444,
|
||||
ePT_VG_lXBGR_8888,
|
||||
ePT_VG_lABGR_8888,
|
||||
ePT_VG_lABGR_8888_PRE,
|
||||
|
||||
// max cap for iterating
|
||||
END_OF_PIXEL_TYPES,
|
||||
|
||||
MGLPT_NOTYPE = 0xffffffff
|
||||
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* Legacy constants (V1/V2)
|
||||
*****************************************************************************/
|
||||
|
||||
const PVRTuint32 PVRTEX_MIPMAP = (1<<8); // has mip map levels
|
||||
const PVRTuint32 PVRTEX_TWIDDLE = (1<<9); // is twiddled
|
||||
const PVRTuint32 PVRTEX_BUMPMAP = (1<<10); // has normals encoded for a bump map
|
||||
const PVRTuint32 PVRTEX_TILING = (1<<11); // is bordered for tiled pvr
|
||||
const PVRTuint32 PVRTEX_CUBEMAP = (1<<12); // is a cubemap/skybox
|
||||
const PVRTuint32 PVRTEX_FALSEMIPCOL = (1<<13); // are there false coloured MIP levels
|
||||
const PVRTuint32 PVRTEX_VOLUME = (1<<14); // is this a volume texture
|
||||
const PVRTuint32 PVRTEX_ALPHA = (1<<15); // v2.1 is there transparency info in the texture
|
||||
const PVRTuint32 PVRTEX_VERTICAL_FLIP = (1<<16); // v2.1 is the texture vertically flipped
|
||||
|
||||
const PVRTuint32 PVRTEX_PIXELTYPE = 0xff; // pixel type is always in the last 16bits of the flags
|
||||
const PVRTuint32 PVRTEX_IDENTIFIER = 0x21525650; // the pvr identifier is the characters 'P','V','R'
|
||||
|
||||
const PVRTuint32 PVRTEX_V1_HEADER_SIZE = 44; // old header size was 44 for identification purposes
|
||||
|
||||
const PVRTuint32 PVRTC2_MIN_TEXWIDTH = 16;
|
||||
const PVRTuint32 PVRTC2_MIN_TEXHEIGHT = 8;
|
||||
const PVRTuint32 PVRTC4_MIN_TEXWIDTH = 8;
|
||||
const PVRTuint32 PVRTC4_MIN_TEXHEIGHT = 8;
|
||||
const PVRTuint32 ETC_MIN_TEXWIDTH = 4;
|
||||
const PVRTuint32 ETC_MIN_TEXHEIGHT = 4;
|
||||
const PVRTuint32 DXT_MIN_TEXWIDTH = 4;
|
||||
const PVRTuint32 DXT_MIN_TEXHEIGHT = 4;
|
||||
|
||||
/****************************************************************************
|
||||
** Functions
|
||||
****************************************************************************/
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTTextureCreate
|
||||
@Input w Size of the texture
|
||||
@Input h Size of the texture
|
||||
@Input wMin Minimum size of a texture level
|
||||
@Input hMin Minimum size of a texture level
|
||||
@Input nBPP Bits per pixel of the format
|
||||
@Input bMIPMap Create memory for MIP-map levels also?
|
||||
@Return Allocated texture memory (must be free()d)
|
||||
@Description Creates a PVRTextureHeaderV3 structure, including room for
|
||||
the specified texture, in memory.
|
||||
*****************************************************************************/
|
||||
PVRTextureHeaderV3 *PVRTTextureCreate(
|
||||
unsigned int w,
|
||||
unsigned int h,
|
||||
const unsigned int wMin,
|
||||
const unsigned int hMin,
|
||||
const unsigned int nBPP,
|
||||
const bool bMIPMap);
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTTextureTile
|
||||
@Modified pOut The tiled texture in system memory
|
||||
@Input pIn The source texture
|
||||
@Input nRepeatCnt Number of times to repeat the source texture
|
||||
@Description Allocates and fills, in system memory, a texture large enough
|
||||
to repeat the source texture specified number of times.
|
||||
*****************************************************************************/
|
||||
void PVRTTextureTile(
|
||||
PVRTextureHeaderV3 **pOut,
|
||||
const PVRTextureHeaderV3 * const pIn,
|
||||
const int nRepeatCnt);
|
||||
|
||||
/****************************************************************************
|
||||
** Internal Functions
|
||||
****************************************************************************/
|
||||
//Preprocessor definitions to generate a pixelID for use when consts are needed. For example - switch statements. These should be evaluated by the compiler rather than at run time - assuming that arguments are all constant.
|
||||
|
||||
//Generate a 4 channel PixelID.
|
||||
#define PVRTGENPIXELID4(C1Name, C2Name, C3Name, C4Name, C1Bits, C2Bits, C3Bits, C4Bits) ( ( (PVRTuint64)C1Name) + ( (PVRTuint64)C2Name<<8) + ( (PVRTuint64)C3Name<<16) + ( (PVRTuint64)C4Name<<24) + ( (PVRTuint64)C1Bits<<32) + ( (PVRTuint64)C2Bits<<40) + ( (PVRTuint64)C3Bits<<48) + ( (PVRTuint64)C4Bits<<56) )
|
||||
|
||||
//Generate a 1 channel PixelID.
|
||||
#define PVRTGENPIXELID3(C1Name, C2Name, C3Name, C1Bits, C2Bits, C3Bits)( PVRTGENPIXELID4(C1Name, C2Name, C3Name, 0, C1Bits, C2Bits, C3Bits, 0) )
|
||||
|
||||
//Generate a 2 channel PixelID.
|
||||
#define PVRTGENPIXELID2(C1Name, C2Name, C1Bits, C2Bits) ( PVRTGENPIXELID4(C1Name, C2Name, 0, 0, C1Bits, C2Bits, 0, 0) )
|
||||
|
||||
//Generate a 3 channel PixelID.
|
||||
#define PVRTGENPIXELID1(C1Name, C1Bits) ( PVRTGENPIXELID4(C1Name, 0, 0, 0, C1Bits, 0, 0, 0))
|
||||
|
||||
//Forward declaration of CPVRTMap.
|
||||
template <typename KeyType, typename DataType>
|
||||
class CPVRTMap;
|
||||
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTGetBitsPerPixel
|
||||
@Input u64PixelFormat A PVR Pixel Format ID.
|
||||
@Return const PVRTuint32 Number of bits per pixel.
|
||||
@Description Returns the number of bits per pixel in a PVR Pixel Format
|
||||
identifier.
|
||||
*************************************************************************/
|
||||
PVRTuint32 PVRTGetBitsPerPixel(PVRTuint64 u64PixelFormat);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTGetFormatMinDims
|
||||
@Input u64PixelFormat A PVR Pixel Format ID.
|
||||
@Modified minX Returns the minimum width.
|
||||
@Modified minY Returns the minimum height.
|
||||
@Modified minZ Returns the minimum depth.
|
||||
@Description Gets the minimum dimensions (x,y,z) for a given pixel format.
|
||||
*************************************************************************/
|
||||
void PVRTGetFormatMinDims(PVRTuint64 u64PixelFormat, PVRTuint32 &minX, PVRTuint32 &minY, PVRTuint32 &minZ);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTConvertOldTextureHeaderToV3
|
||||
@Input LegacyHeader Legacy header for conversion.
|
||||
@Modified NewHeader New header to output into.
|
||||
@Modified pMetaData MetaData Map to output into.
|
||||
@Description Converts a legacy texture header (V1 or V2) to a current
|
||||
generation header (V3)
|
||||
*************************************************************************/
|
||||
void PVRTConvertOldTextureHeaderToV3(const PVR_Texture_Header* LegacyHeader, PVRTextureHeaderV3& NewHeader, CPVRTMap<PVRTuint32, CPVRTMap<PVRTuint32,MetaDataBlock> >* pMetaData);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTMapLegacyTextureEnumToNewFormat
|
||||
@Input OldFormat Legacy Enumeration Value
|
||||
@Modified newType New PixelType identifier.
|
||||
@Modified newCSpace New ColourSpace
|
||||
@Modified newChanType New Channel Type
|
||||
@Modified isPreMult Whether format is pre-multiplied
|
||||
@Description Maps a legacy enumeration value to the new PVR3 style format.
|
||||
*************************************************************************/
|
||||
void PVRTMapLegacyTextureEnumToNewFormat(PVRTPixelType OldFormat, PVRTuint64& newType, EPVRTColourSpace& newCSpace, EPVRTVariableType& newChanType, bool& isPreMult);
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTTextureLoadTiled
|
||||
@Modified pDst Texture to place the tiled data
|
||||
@Input nWidthDst Width of destination texture
|
||||
@Input nHeightDst Height of destination texture
|
||||
@Input pSrc Texture to tile
|
||||
@Input nWidthSrc Width of source texture
|
||||
@Input nHeightSrc Height of source texture
|
||||
@Input nElementSize Bytes per pixel
|
||||
@Input bTwiddled True if the data is twiddled
|
||||
@Description Needed by PVRTTextureTile() in the various PVRTTextureAPIs
|
||||
*****************************************************************************/
|
||||
void PVRTTextureLoadTiled(
|
||||
PVRTuint8 * const pDst,
|
||||
const unsigned int nWidthDst,
|
||||
const unsigned int nHeightDst,
|
||||
const PVRTuint8 * const pSrc,
|
||||
const unsigned int nWidthSrc,
|
||||
const unsigned int nHeightSrc,
|
||||
const unsigned int nElementSize,
|
||||
const bool bTwiddled);
|
||||
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTTextureTwiddle
|
||||
@Output a Twiddled value
|
||||
@Input u Coordinate axis 0
|
||||
@Input v Coordinate axis 1
|
||||
@Description Combine a 2D coordinate into a twiddled value
|
||||
*****************************************************************************/
|
||||
void PVRTTextureTwiddle(unsigned int &a, const unsigned int u, const unsigned int v);
|
||||
|
||||
/*!***************************************************************************
|
||||
@Function PVRTTextureDeTwiddle
|
||||
@Output u Coordinate axis 0
|
||||
@Output v Coordinate axis 1
|
||||
@Input a Twiddled value
|
||||
@Description Extract 2D coordinates from a twiddled value.
|
||||
*****************************************************************************/
|
||||
void PVRTTextureDeTwiddle(unsigned int &u, unsigned int &v, const unsigned int a);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PVRTGetTextureDataSize
|
||||
@Input sTextureHeader Specifies the texture header.
|
||||
@Input iMipLevel Specifies a mip level to check, 'PVRTEX_ALLMIPLEVELS'
|
||||
can be passed to get the size of all MIP levels.
|
||||
@Input bAllSurfaces Size of all surfaces is calculated if true,
|
||||
only a single surface if false.
|
||||
@Input bAllFaces Size of all faces is calculated if true,
|
||||
only a single face if false.
|
||||
@Return PVRTuint32 Size in BYTES of the specified texture area.
|
||||
@Description Gets the size in BYTES of the texture, given various input
|
||||
parameters. User can retrieve the size of either all
|
||||
surfaces or a single surface, all faces or a single face and
|
||||
all MIP-Maps or a single specified MIP level.
|
||||
*************************************************************************/
|
||||
PVRTuint32 PVRTGetTextureDataSize(PVRTextureHeaderV3 sTextureHeader, PVRTint32 iMipLevel=PVRTEX_ALLMIPLEVELS, bool bAllSurfaces = true, bool bAllFaces = true);
|
||||
|
||||
#endif /* _PVRTTEXTURE_H_ */
|
||||
|
||||
/*****************************************************************************
|
||||
End of file (PVRTTexture.h)
|
||||
*****************************************************************************/
|
||||
|
120
extern/pvrtextool/Include/PVRTTypes.h
vendored
Normal file
120
extern/pvrtextool/Include/PVRTTypes.h
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTTypes.h
|
||||
|
||||
@Title PVRTTypes
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI compatible
|
||||
|
||||
@Description Global enums and typedefs for PVRTools
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
//ACS: I split this out of PVRTGlobal.h
|
||||
|
||||
#ifndef _PVRTTYPES_H_
|
||||
#define _PVRTTYPES_H_
|
||||
|
||||
/*!***************************************************************************
|
||||
Macros
|
||||
*****************************************************************************/
|
||||
//#include <stdio.h>
|
||||
|
||||
// This macro is used to check at compile time that types are of a certain size
|
||||
// If the size does not equal the expected size, this typedefs an array of size 0
|
||||
// which causes a compile error
|
||||
#define PVRTSIZEASSERT(T, size) typedef int (sizeof_##T)[sizeof(T) == (size)]
|
||||
#define PVRTCOMPILEASSERT(T, expr) typedef int (assert_##T)[expr]
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
** Integer types
|
||||
****************************************************************************/
|
||||
|
||||
typedef char PVRTchar8;
|
||||
typedef signed char PVRTint8;
|
||||
typedef signed short PVRTint16;
|
||||
typedef signed int PVRTint32;
|
||||
typedef unsigned char PVRTuint8;
|
||||
typedef unsigned short PVRTuint16;
|
||||
typedef unsigned int PVRTuint32;
|
||||
|
||||
typedef float PVRTfloat32;
|
||||
|
||||
#if (defined(__int64) || defined(_WIN32))
|
||||
typedef signed __int64 PVRTint64;
|
||||
typedef unsigned __int64 PVRTuint64;
|
||||
#elif defined(TInt64)
|
||||
typedef TInt64 PVRTint64;
|
||||
typedef TUInt64 PVRTuint64;
|
||||
#else
|
||||
typedef signed long long PVRTint64;
|
||||
typedef unsigned long long PVRTuint64;
|
||||
#endif
|
||||
|
||||
#if __SIZEOF_WCHAR_T__ == 4 || __WCHAR_MAX__ > 0x10000
|
||||
#define PVRTSIZEOFWCHAR 4
|
||||
#else
|
||||
#define PVRTSIZEOFWCHAR 2
|
||||
#endif
|
||||
|
||||
PVRTSIZEASSERT(PVRTchar8, 1);
|
||||
PVRTSIZEASSERT(PVRTint8, 1);
|
||||
PVRTSIZEASSERT(PVRTuint8, 1);
|
||||
PVRTSIZEASSERT(PVRTint16, 2);
|
||||
PVRTSIZEASSERT(PVRTuint16, 2);
|
||||
PVRTSIZEASSERT(PVRTint32, 4);
|
||||
PVRTSIZEASSERT(PVRTuint32, 4);
|
||||
PVRTSIZEASSERT(PVRTint64, 8);
|
||||
PVRTSIZEASSERT(PVRTuint64, 8);
|
||||
PVRTSIZEASSERT(PVRTfloat32, 4);
|
||||
|
||||
/*!**************************************************************************
|
||||
@Enum ETextureFilter
|
||||
@Brief Enum values for defining texture filtering
|
||||
****************************************************************************/
|
||||
enum ETextureFilter
|
||||
{
|
||||
eFilter_Nearest,
|
||||
eFilter_Linear,
|
||||
eFilter_None,
|
||||
|
||||
eFilter_Size,
|
||||
eFilter_Default = eFilter_Nearest,
|
||||
eFilter_MipDefault = eFilter_None
|
||||
};
|
||||
|
||||
/*!**************************************************************************
|
||||
@Enum ETextureWrap
|
||||
@Brief Enum values for defining texture wrapping
|
||||
****************************************************************************/
|
||||
enum ETextureWrap
|
||||
{
|
||||
eWrap_Clamp,
|
||||
eWrap_Repeat,
|
||||
|
||||
eWrap_Size,
|
||||
eWrap_Default = eWrap_Repeat
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
ACS: Handle missing assert macros.
|
||||
Maybe you needed to include PVRTGlobal.h after all?
|
||||
*****************************************************************************/
|
||||
#ifndef _ASSERT
|
||||
# define _ASSERT(X)
|
||||
#endif
|
||||
#ifndef _ASSERTE
|
||||
# define _ASSERTE(X)
|
||||
#endif
|
||||
|
||||
#endif // _PVRTTYPES_H_
|
||||
|
||||
/*****************************************************************************
|
||||
End of file
|
||||
*****************************************************************************/
|
||||
|
225
extern/pvrtextool/Include/PVRTexture.h
vendored
Normal file
225
extern/pvrtextool/Include/PVRTexture.h
vendored
Normal file
@ -0,0 +1,225 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTexture.h
|
||||
|
||||
@Title
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform
|
||||
|
||||
@Description
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRTEXTURE_H
|
||||
#define _PVRTEXTURE_H
|
||||
|
||||
#include "PVRTextureDefines.h"
|
||||
#include "PVRTextureHeader.h"
|
||||
//ACS: removed unneccesary includes:
|
||||
//#include "PVRTString.h"
|
||||
|
||||
namespace pvrtexture
|
||||
{
|
||||
class PVR_DLL CPVRTexture : public CPVRTextureHeader
|
||||
{
|
||||
public:
|
||||
/*******************************************************************************
|
||||
* Construction methods for a texture.
|
||||
*******************************************************************************/
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTexture
|
||||
@Return CPVRTexture A new texture.
|
||||
@Description Creates a new empty texture
|
||||
*************************************************************************/
|
||||
CPVRTexture();
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTexture
|
||||
@Input sHeader
|
||||
@Input pData
|
||||
@Return CPVRTexture A new texture.
|
||||
@Description Creates a new texture based on a texture header,
|
||||
pre-allocating the correct amount of memory. If data is
|
||||
supplied, it will be copied into memory.
|
||||
*************************************************************************/
|
||||
CPVRTexture(const CPVRTextureHeader& sHeader, const void* pData=NULL);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTexture
|
||||
@Input szFilePath
|
||||
@Return CPVRTexture A new texture.
|
||||
@Description Creates a new texture from a filepath.
|
||||
*************************************************************************/
|
||||
CPVRTexture(const char* szFilePath);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTexture
|
||||
@Input pTexture
|
||||
@Return CPVRTexture A new texture.
|
||||
@Description Creates a new texture from a pointer that includes a header
|
||||
structure, meta data and texture data as laid out in a file.
|
||||
This functionality is primarily for user defined file loading.
|
||||
Header may be any version of pvr.
|
||||
*************************************************************************/
|
||||
CPVRTexture( const void* pTexture );
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTexture
|
||||
@Input texture
|
||||
@Return CPVRTexture A new texture
|
||||
@Description Creates a new texture as a copy of another.
|
||||
*************************************************************************/
|
||||
CPVRTexture(const CPVRTexture& texture);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function ~CPVRTexture
|
||||
@Description Deconstructor for CPVRTextures.
|
||||
*************************************************************************/
|
||||
~CPVRTexture();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function operator=
|
||||
@Input rhs
|
||||
@Return CPVRTexture& This texture.
|
||||
@Description Will copy the contents and information of another texture into this one.
|
||||
*************************************************************************/
|
||||
CPVRTexture& operator=(const CPVRTexture& rhs);
|
||||
|
||||
/*******************************************************************************
|
||||
* Texture accessor functions - others are inherited from CPVRTextureHeader.
|
||||
*******************************************************************************/
|
||||
/*!***********************************************************************
|
||||
@Function getDataPtr
|
||||
@Input uiMIPLevel
|
||||
@Input uiArrayMember
|
||||
@Input uiFaceNumber
|
||||
@Return void* Pointer to a location in the texture.
|
||||
@Description Returns a pointer into the texture's data.
|
||||
It is possible to specify an offset to specific array members,
|
||||
faces and MIP Map levels.
|
||||
*************************************************************************/
|
||||
void* getDataPtr(uint32 uiMIPLevel = 0, uint32 uiArrayMember = 0, uint32 uiFaceNumber = 0) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getHeader
|
||||
@Return const CPVRTextureHeader& Returns the header only for this texture.
|
||||
@Description Gets the header for this texture, allowing you to create a new
|
||||
texture based on this one with some changes. Useful for passing
|
||||
information about a texture without passing all of its data.
|
||||
*************************************************************************/
|
||||
const CPVRTextureHeader& getHeader() const;
|
||||
|
||||
/*******************************************************************************
|
||||
* File io.
|
||||
*******************************************************************************/
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setPaddedMetaData
|
||||
@Input uiPadding
|
||||
@Description When writing the texture out to a PVR file, it is often
|
||||
desirable to pad the meta data so that the start of the
|
||||
texture data aligns to a given boundary.
|
||||
This function pads to a boundary value equal to "uiPadding".
|
||||
For example setting uiPadding=8 will align the start of the
|
||||
texture data to an 8 byte boundary.
|
||||
Note - this should be called immediately before saving as
|
||||
the value is worked out based on the current meta data size.
|
||||
*************************************************************************/
|
||||
void addPaddingMetaData( uint32 uiPadding );
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function saveFile
|
||||
@Input filepath
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Writes out to a file, given a filename and path.
|
||||
File type will be determined by the extension present in the string.
|
||||
If no extension is present, PVR format will be selected.
|
||||
Unsupported formats will result in failure.
|
||||
*************************************************************************/
|
||||
bool saveFile(const CPVRTString& filepath) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function saveFileLegacyPVR
|
||||
@Input filepath
|
||||
@Input eApi
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Writes out to a file, stripping any extensions specified
|
||||
and appending .pvr. This function is for legacy support only
|
||||
and saves out to PVR Version 2 file. The target api must be
|
||||
specified in order to save to this format.
|
||||
*************************************************************************/
|
||||
bool saveFileLegacyPVR(const CPVRTString& filepath, ELegacyApi eApi) const;
|
||||
|
||||
private:
|
||||
size_t m_stDataSize; // Size of the texture data.
|
||||
uint8* m_pTextureData; // Pointer to texture data.
|
||||
|
||||
/*******************************************************************************
|
||||
* Private IO functions
|
||||
*******************************************************************************/
|
||||
/*!***********************************************************************
|
||||
@Function loadPVRFile
|
||||
@Input pTextureFile
|
||||
@Description Loads a PVR file.
|
||||
*************************************************************************/
|
||||
bool privateLoadPVRFile(FILE* pTextureFile);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function privateSavePVRFile
|
||||
@Input pTextureFile
|
||||
@Description Saves a PVR File.
|
||||
*************************************************************************/
|
||||
bool privateSavePVRFile(FILE* pTextureFile) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function loadKTXFile
|
||||
@Input pTextureFile
|
||||
@Description Loads a KTX file.
|
||||
*************************************************************************/
|
||||
bool privateLoadKTXFile(FILE* pTextureFile);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function privateSaveKTXFile
|
||||
@Input pTextureFile
|
||||
@Description Saves a KTX File.
|
||||
*************************************************************************/
|
||||
bool privateSaveKTXFile(FILE* pTextureFile) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function loadDDSFile
|
||||
@Input pTextureFile
|
||||
@Description Loads a DDS file.
|
||||
*************************************************************************/
|
||||
bool privateLoadDDSFile(FILE* pTextureFile);
|
||||
bool privateLoadDDS10File(FILE* pTextureFile);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function privateSaveDDSFile
|
||||
@Input pTextureFile
|
||||
@Description Saves a DDS File.
|
||||
*************************************************************************/
|
||||
bool privateSaveDDSFile(FILE* pTextureFile) const;
|
||||
|
||||
//Legacy IO
|
||||
/*!***********************************************************************
|
||||
@Function privateSavePVRFile
|
||||
@Input pTextureFile
|
||||
@Input filename
|
||||
@Description Saves a .h File.
|
||||
*************************************************************************/
|
||||
bool privateSaveCHeaderFile(FILE* pTextureFile, CPVRTString filename) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function privateSaveLegacyPVRFile
|
||||
@Input pTextureFile
|
||||
@Input eApi
|
||||
@Description Saves a legacy PVR File - Uses version 2 file format.
|
||||
*************************************************************************/
|
||||
bool privateSaveLegacyPVRFile(FILE* pTextureFile, ELegacyApi eApi) const;
|
||||
};
|
||||
};
|
||||
|
||||
#endif //_PVRTEXTURE_H
|
||||
|
109
extern/pvrtextool/Include/PVRTextureDefines.h
vendored
Normal file
109
extern/pvrtextool/Include/PVRTextureDefines.h
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTextureDefines.h
|
||||
|
||||
@Title
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform
|
||||
|
||||
@Description
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRTEXTURE_DEFINES_H
|
||||
#define _PVRTEXTURE_DEFINES_H
|
||||
|
||||
//To use the PVRTexLib .dll on Windows, you need to define _WINDLL_IMPORT
|
||||
#ifndef PVR_DLL
|
||||
#if defined(_WINDLL_EXPORT)
|
||||
#define PVR_DLL __declspec(dllexport)
|
||||
//Forward declaration of PVRTexture Header and CPVRTMap. This exports their interfaces for DLLs.
|
||||
struct PVR_DLL PVRTextureHeaderV3;
|
||||
template <typename KeyType, typename DataType>
|
||||
class PVR_DLL CPVRTMap;
|
||||
template<typename T>
|
||||
class PVR_DLL CPVRTArray;
|
||||
#elif defined(_WINDLL_IMPORT)
|
||||
#define PVR_DLL __declspec(dllimport)
|
||||
//Forward declaration of PVRTexture Header and CPVRTMap. This imports their interfaces for DLLs.
|
||||
struct PVR_DLL PVRTextureHeaderV3;
|
||||
template <typename KeyType, typename DataType>
|
||||
class PVR_DLL CPVRTMap;
|
||||
template<typename T>
|
||||
class PVR_DLL CPVRTArray;
|
||||
#else
|
||||
#define PVR_DLL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include "PVRTTexture.h"
|
||||
|
||||
namespace pvrtexture
|
||||
{
|
||||
/*****************************************************************************
|
||||
* Type defines for standard variable sizes.
|
||||
*****************************************************************************/
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed int int32;
|
||||
typedef signed long long int64;
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned long long uint64;
|
||||
|
||||
/*****************************************************************************
|
||||
* Texture related constants and enumerations.
|
||||
*****************************************************************************/
|
||||
enum ECompressorQuality
|
||||
{
|
||||
ePVRTCFast=0,
|
||||
ePVRTCNormal,
|
||||
ePVRTCHigh,
|
||||
ePVRTCBest,
|
||||
eNumPVRTCModes,
|
||||
|
||||
eETCFast=0,
|
||||
eETCFastPerceptual,
|
||||
eETCSlow,
|
||||
eETCSlowPerceptual,
|
||||
eNumETCModes
|
||||
};
|
||||
|
||||
enum EResizeMode
|
||||
{
|
||||
eResizeNearest,
|
||||
eResizeLinear,
|
||||
eResizeCubic,
|
||||
eNumResizeModes
|
||||
};
|
||||
|
||||
// Legacy - API enums.
|
||||
enum ELegacyApi
|
||||
{
|
||||
eOGLES=1,
|
||||
eOGLES2,
|
||||
eD3DM,
|
||||
eOGL,
|
||||
eDX9,
|
||||
eDX10,
|
||||
eOVG,
|
||||
eMGL,
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* Useful macros.
|
||||
*****************************************************************************/
|
||||
#define TEXOFFSET2D(x,y,width) ( ((x)+(y)*(width)) )
|
||||
#define TEXOFFSET3D(x,y,z,width,height) ( ((x)+(y)*(width)+(z)*(width)*(height)) )
|
||||
|
||||
/*****************************************************************************
|
||||
* Useful typedef for Meta Data Maps
|
||||
*****************************************************************************/
|
||||
typedef CPVRTMap<uint32, CPVRTMap<uint32,MetaDataBlock> > MetaDataMap;
|
||||
};
|
||||
#endif //_PVRTEXTURE_DEFINES_H
|
90
extern/pvrtextool/Include/PVRTextureFormat.h
vendored
Normal file
90
extern/pvrtextool/Include/PVRTextureFormat.h
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTextureFormat.h
|
||||
|
||||
@Title
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform
|
||||
|
||||
@Description
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRT_PIXEL_FORMAT_H
|
||||
#define _PVRT_PIXEL_FORMAT_H
|
||||
|
||||
#include "PVRTextureDefines.h"
|
||||
//ACS: removed unneccesary includes:
|
||||
//#include "PVRTString.h"
|
||||
|
||||
namespace pvrtexture
|
||||
{
|
||||
//Channel Names
|
||||
enum EChannelName
|
||||
{
|
||||
eNoChannel,
|
||||
eRed,
|
||||
eGreen,
|
||||
eBlue,
|
||||
eAlpha,
|
||||
eLuminance,
|
||||
eIntensity,
|
||||
eUnspecified,
|
||||
eNumChannels
|
||||
};
|
||||
|
||||
//PixelType union
|
||||
union PVR_DLL PixelType
|
||||
{
|
||||
/*!***********************************************************************
|
||||
@Function PixelType
|
||||
@Return A new PixelType
|
||||
@Description Creates an empty pixeltype.
|
||||
*************************************************************************/
|
||||
PixelType();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PixelType
|
||||
@Input Type
|
||||
@Return A new PixelType
|
||||
@Description Initialises a new pixel type from a 64 bit integer value.
|
||||
*************************************************************************/
|
||||
PixelType(uint64 Type);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PixelType
|
||||
@Input C1Name
|
||||
@Input C2Name
|
||||
@Input C3Name
|
||||
@Input C4Name
|
||||
@Input C1Bits
|
||||
@Input C2Bits
|
||||
@Input C3Bits
|
||||
@Input C4Bits
|
||||
@Return A new PixelType
|
||||
@Description Takes up to 4 characters (CnName) and 4 values (CnBits)
|
||||
to create a new PixelType. Any unused channels should be set to 0.
|
||||
For example: PixelType('r','g','b',0,8,8,8,0);
|
||||
*************************************************************************/
|
||||
PixelType(uint8 C1Name, uint8 C2Name, uint8 C3Name, uint8 C4Name, uint8 C1Bits, uint8 C2Bits, uint8 C3Bits, uint8 C4Bits);
|
||||
|
||||
struct PVR_DLL LowHigh
|
||||
{
|
||||
uint32 Low;
|
||||
uint32 High;
|
||||
} Part;
|
||||
|
||||
uint64 PixelTypeID;
|
||||
uint8 PixelTypeChar[8];
|
||||
};
|
||||
|
||||
static const PixelType PVRStandard8PixelType = PixelType('r','g','b','a',8,8,8,8);
|
||||
static const PixelType PVRStandard16PixelType = PixelType('r','g','b','a',16,16,16,16);
|
||||
static const PixelType PVRStandard32PixelType = PixelType('r','g','b','a',32,32,32,32);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
603
extern/pvrtextool/Include/PVRTextureHeader.h
vendored
Normal file
603
extern/pvrtextool/Include/PVRTextureHeader.h
vendored
Normal file
@ -0,0 +1,603 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTextureHeader.h
|
||||
|
||||
@Title
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform
|
||||
|
||||
@Description
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRTEXTURE_HEADER_H
|
||||
#define _PVRTEXTURE_HEADER_H
|
||||
|
||||
#include "PVRTextureDefines.h"
|
||||
#include "PVRTextureFormat.h"
|
||||
#include "PVRTMap.h"
|
||||
#include "PVRTString.h"
|
||||
|
||||
namespace pvrtexture
|
||||
{
|
||||
//Wrapper class for PVRTextureHeaderV3, adds 'smart' accessor functions.
|
||||
class PVR_DLL CPVRTextureHeader
|
||||
{
|
||||
protected:
|
||||
PVRTextureHeaderV3 m_sHeader; //Texture header as laid out in a file.
|
||||
mutable CPVRTMap<uint32, CPVRTMap<uint32,MetaDataBlock> > m_MetaData; //Map of all the meta data stored for a texture.
|
||||
|
||||
public:
|
||||
/*******************************************************************************
|
||||
* Construction methods for a texture header.
|
||||
*******************************************************************************/
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTextureHeader
|
||||
@Return CPVRTextureHeader A new texture header.
|
||||
@Description Default constructor for a CPVRTextureHeader. Returns an empty header.
|
||||
*************************************************************************/
|
||||
CPVRTextureHeader();
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTextureHeader
|
||||
@Input fileHeader
|
||||
@Input metaDataCount
|
||||
@Input metaData
|
||||
@Return CPVRTextureHeader A new texture header.
|
||||
@Description Creates a new texture header from a PVRTextureHeaderV3,
|
||||
and appends Meta data if any is supplied.
|
||||
*************************************************************************/
|
||||
CPVRTextureHeader( PVRTextureHeaderV3 fileHeader,
|
||||
uint32 metaDataCount=0,
|
||||
MetaDataBlock* metaData=NULL);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CPVRTextureHeader
|
||||
@Input u64PixelFormat
|
||||
@Input u32Height
|
||||
@Input u32Width
|
||||
@Input u32Depth
|
||||
@Input u32NumMipMaps
|
||||
@Input u32NumArrayMembers
|
||||
@Input u32NumFaces
|
||||
@Input eColourSpace
|
||||
@Input eChannelType
|
||||
@Input bPreMultiplied
|
||||
@Return CPVRTextureHeader A new texture header.
|
||||
@Description Creates a new texture header based on individual header
|
||||
variables.
|
||||
*************************************************************************/
|
||||
CPVRTextureHeader( uint64 u64PixelFormat,
|
||||
uint32 u32Height=1,
|
||||
uint32 u32Width=1,
|
||||
uint32 u32Depth=1,
|
||||
uint32 u32NumMipMaps=1,
|
||||
uint32 u32NumArrayMembers=1,
|
||||
uint32 u32NumFaces=1,
|
||||
EPVRTColourSpace eColourSpace=ePVRTCSpacelRGB,
|
||||
EPVRTVariableType eChannelType=ePVRTVarTypeUnsignedByteNorm,
|
||||
bool bPreMultiplied=false);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function operator=
|
||||
@Input rhs
|
||||
@Return CPVRTextureHeader& This header.
|
||||
@Description Will copy the contents and information of another header into this one.
|
||||
*************************************************************************/
|
||||
CPVRTextureHeader& operator=(const CPVRTextureHeader& rhs);
|
||||
|
||||
/*******************************************************************************
|
||||
* Accessor Methods for a texture's properties - getters.
|
||||
*******************************************************************************/
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getFileHeader
|
||||
@Return PVRTextureHeaderV3 The file header.
|
||||
@Description Gets the file header structure.
|
||||
*************************************************************************/
|
||||
const PVRTextureHeaderV3 getFileHeader() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getPixelType
|
||||
@Return PixelType 64-bit pixel type ID.
|
||||
@Description Gets the 64-bit pixel type ID of the texture.
|
||||
*************************************************************************/
|
||||
const PixelType getPixelType() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getBitsPerPixel
|
||||
@Return uint32 Number of bits per pixel
|
||||
@Description Gets the bits per pixel of the texture format.
|
||||
*************************************************************************/
|
||||
const uint32 getBitsPerPixel() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getColourSpace
|
||||
@Return EPVRTColourSpace enum representing colour space.
|
||||
@Description Returns the colour space of the texture.
|
||||
*************************************************************************/
|
||||
const EPVRTColourSpace getColourSpace() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getChannelType
|
||||
@Return EPVRTVariableType enum representing the type of the texture.
|
||||
@Description Returns the variable type that the texture's data is stored in.
|
||||
*************************************************************************/
|
||||
const EPVRTVariableType getChannelType() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getWidth
|
||||
@Input uiMipLevel MIP level that user is interested in.
|
||||
@Return uint32 Width of the specified MIP-Map level.
|
||||
@Description Gets the width of the user specified MIP-Map
|
||||
level for the texture
|
||||
*************************************************************************/
|
||||
const uint32 getWidth(uint32 uiMipLevel=PVRTEX_TOPMIPLEVEL) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getHeight
|
||||
@Input uiMipLevel MIP level that user is interested in.
|
||||
@Return uint32 Height of the specified MIP-Map level.
|
||||
@Description Gets the height of the user specified MIP-Map
|
||||
level for the texture
|
||||
*************************************************************************/
|
||||
const uint32 getHeight(uint32 uiMipLevel=PVRTEX_TOPMIPLEVEL) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getDepth
|
||||
@Input uiMipLevel MIP level that user is interested in.
|
||||
@Return Depth of the specified MIP-Map level.
|
||||
@Description Gets the depth of the user specified MIP-Map
|
||||
level for the texture
|
||||
*************************************************************************/
|
||||
const uint32 getDepth(uint32 uiMipLevel=PVRTEX_TOPMIPLEVEL) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getTextureSize
|
||||
@Input iMipLevel Specifies a MIP level to check,
|
||||
'PVRTEX_ALLMIPLEVELS' can be passed to get
|
||||
the size of all MIP levels.
|
||||
@Input bAllSurfaces Size of all surfaces is calculated if true,
|
||||
only a single surface if false.
|
||||
@Input bAllFaces Size of all faces is calculated if true,
|
||||
only a single face if false.
|
||||
@Return uint32 Size in PIXELS of the specified texture area.
|
||||
@Description Gets the size in PIXELS of the texture, given various input
|
||||
parameters. User can retrieve the total size of either all
|
||||
surfaces or a single surface, all faces or a single face and
|
||||
all MIP-Maps or a single specified MIP level. All of these
|
||||
*************************************************************************/
|
||||
const uint32 getTextureSize(int32 iMipLevel=PVRTEX_ALLMIPLEVELS, bool bAllSurfaces = true, bool bAllFaces = true) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getDataSize
|
||||
@Input iMipLevel Specifies a mip level to check,
|
||||
'PVRTEX_ALLMIPLEVELS' can be passed to get
|
||||
the size of all MIP levels.
|
||||
@Input bAllSurfaces Size of all surfaces is calculated if true,
|
||||
only a single surface if false.
|
||||
@Input bAllFaces Size of all faces is calculated if true,
|
||||
only a single face if false.
|
||||
@Return uint32 Size in BYTES of the specified texture area.
|
||||
@Description Gets the size in BYTES of the texture, given various input
|
||||
parameters. User can retrieve the size of either all
|
||||
surfaces or a single surface, all faces or a single face
|
||||
and all MIP-Maps or a single specified MIP level.
|
||||
*************************************************************************/
|
||||
const uint32 getDataSize(int32 iMipLevel=PVRTEX_ALLMIPLEVELS, bool bAllSurfaces = true, bool bAllFaces = true) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getNumArrayMembers
|
||||
@Return uint32 Number of array members in this texture.
|
||||
@Description Gets the number of array members stored in this texture.
|
||||
*************************************************************************/
|
||||
const uint32 getNumArrayMembers() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getNumMIPLevels
|
||||
@Return uint32 Number of MIP-Map levels in this texture.
|
||||
@Description Gets the number of MIP-Map levels stored in this texture.
|
||||
*************************************************************************/
|
||||
const uint32 getNumMIPLevels() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getNumFaces
|
||||
@Return uint32 Number of faces in this texture.
|
||||
@Description Gets the number of faces stored in this texture.
|
||||
*************************************************************************/
|
||||
const uint32 getNumFaces() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getOrientation
|
||||
@Input axis EPVRTAxis type specifying the axis to examine.
|
||||
@Return EPVRTOrientation Enum orientation of the axis.
|
||||
@Description Gets the data orientation for this texture.
|
||||
*************************************************************************/
|
||||
const EPVRTOrientation getOrientation(EPVRTAxis axis) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function isFileCompressed
|
||||
@Return bool True if it is file compressed.
|
||||
@Description Returns whether or not the texture is compressed using
|
||||
PVRTexLib's FILE compression - this is independent of
|
||||
any texture compression.
|
||||
*************************************************************************/
|
||||
const bool isFileCompressed() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function isPreMultiplied
|
||||
@Return bool True if texture is premultiplied.
|
||||
@Description Returns whether or not the texture's colour has been
|
||||
pre-multiplied by the alpha values.
|
||||
*************************************************************************/
|
||||
const bool isPreMultiplied() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getMetaDataSize
|
||||
@Return const uint32 Size, in bytes, of the meta data stored in the header.
|
||||
@Description Returns the total size of the meta data stored in the header.
|
||||
This includes the size of all information stored in all MetaDataBlocks.
|
||||
*************************************************************************/
|
||||
const uint32 getMetaDataSize() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getOGLFormat
|
||||
@Modified internalformat
|
||||
@Modified format
|
||||
@Modified type
|
||||
@Description Gets the OpenGL equivalent values of internal format, format
|
||||
and type for this texture. This will return any supported
|
||||
OpenGL texture values, it is up to the user to decide if
|
||||
these are valid for their current platform.
|
||||
*************************************************************************/
|
||||
const void getOGLFormat(uint32& internalformat, uint32& format, uint32& type) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getOGLESFormat
|
||||
@Modified internalformat
|
||||
@Modified format
|
||||
@Modified type
|
||||
@Description Gets the OpenGLES equivalent values of internal format,
|
||||
format and type for this texture. This will return any
|
||||
supported OpenGLES texture values, it is up to the user
|
||||
to decide if these are valid for their current platform.
|
||||
*************************************************************************/
|
||||
const void getOGLESFormat(uint32& internalformat, uint32& format, uint32& type) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getD3DFormat
|
||||
@Return const uint32
|
||||
@Description Gets the D3DFormat (up to DirectX 9 and Direct 3D Mobile)
|
||||
equivalent values for this texture. This will return any
|
||||
supported D3D texture formats, it is up to the user to
|
||||
decide if this is valid for their current platform.
|
||||
*************************************************************************/
|
||||
const uint32 getD3DFormat() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getDXGIFormat
|
||||
@Return const uint32
|
||||
@Description Gets the DXGIFormat (DirectX 10 onward) equivalent values
|
||||
for this texture. This will return any supported DX texture
|
||||
formats, it is up to the user to decide if this is valid
|
||||
for their current platform.
|
||||
*************************************************************************/
|
||||
const uint32 getDXGIFormat() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
* Accessor Methods for a texture's properties - setters.
|
||||
*************************************************************************/
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setPixelFormat
|
||||
@Input uPixelFormat The format of the pixel.
|
||||
@Description Sets the pixel format for this texture.
|
||||
*************************************************************************/
|
||||
void setPixelFormat(PixelType uPixelFormat);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setColourSpace
|
||||
@Input eColourSpace A colour space enum.
|
||||
@Description Sets the colour space for this texture. Default is lRGB.
|
||||
*************************************************************************/
|
||||
void setColourSpace(EPVRTColourSpace eColourSpace);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setChannelType
|
||||
@Input eVarType A variable type enum.
|
||||
@Description Sets the variable type for the channels in this texture.
|
||||
*************************************************************************/
|
||||
void setChannelType(EPVRTVariableType eVarType);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setOGLFormat
|
||||
@Input internalformat
|
||||
@Input format
|
||||
@Input type
|
||||
@Return bool Whether the format is valid or not.
|
||||
@Description Sets the format of the texture to PVRTexLib's internal
|
||||
representation of the OGL format.
|
||||
*************************************************************************/
|
||||
bool setOGLFormat(const uint32& internalformat, const uint32& format, const uint32& type);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setOGLESFormat
|
||||
@Input internalformat
|
||||
@Input format
|
||||
@Input type
|
||||
@Return bool Whether the format is valid or not.
|
||||
@Description Sets the format of the texture to PVRTexLib's internal
|
||||
representation of the OGLES format.
|
||||
*************************************************************************/
|
||||
bool setOGLESFormat(const uint32& internalformat, const uint32& format, const uint32& type);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setD3DFormat
|
||||
@Return bool Whether the format is valid or not.
|
||||
@Description Sets the format of the texture to PVRTexLib's internal
|
||||
representation of the D3D format.
|
||||
*************************************************************************/
|
||||
bool setD3DFormat(const uint32& DWORD_D3D_FORMAT);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setDXGIFormat
|
||||
@Return bool Whether the format is valid or not.
|
||||
@Description Sets the format of the texture to PVRTexLib's internal
|
||||
representation of the DXGI format.
|
||||
*************************************************************************/
|
||||
bool setDXGIFormat(const uint32& DWORD_DXGI_FORMAT);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setWidth
|
||||
@Input newWidth The new width.
|
||||
@Description Sets the width.
|
||||
*************************************************************************/
|
||||
void setWidth(uint32 newWidth);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setHeight
|
||||
@Input newHeight The new height.
|
||||
@Description Sets the height.
|
||||
*************************************************************************/
|
||||
void setHeight(uint32 newHeight);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setDepth
|
||||
@Input newDepth The new depth.
|
||||
@Description Sets the depth.
|
||||
*************************************************************************/
|
||||
void setDepth(uint32 newDepth);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setNumArrayMembers
|
||||
@Input newNumMembers The new number of members in this array.
|
||||
@Description Sets the depth.
|
||||
*************************************************************************/
|
||||
void setNumArrayMembers(uint32 newNumMembers);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setNumMIPLevels
|
||||
@Input newNumMIPLevels New number of MIP-Map levels.
|
||||
@Description Sets the number of MIP-Map levels in this texture.
|
||||
*************************************************************************/
|
||||
void setNumMIPLevels(uint32 newNumMIPLevels);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setNumFaces
|
||||
@Input newNumFaces New number of faces for this texture.
|
||||
@Description Sets the number of faces stored in this texture.
|
||||
*************************************************************************/
|
||||
void setNumFaces(uint32 newNumFaces);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setOrientation
|
||||
@Input eAxisOrientation Enum specifying axis and orientation.
|
||||
@Description Sets the data orientation for a given axis in this texture.
|
||||
*************************************************************************/
|
||||
void setOrientation(EPVRTOrientation eAxisOrientation);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setIsFileCompressed
|
||||
@Input isFileCompressed Sets file compression to true/false.
|
||||
@Description Sets whether or not the texture is compressed using
|
||||
PVRTexLib's FILE compression - this is independent of
|
||||
any texture compression. Currently unsupported.
|
||||
*************************************************************************/
|
||||
void setIsFileCompressed(bool isFileCompressed);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function isPreMultiplied
|
||||
@Return isPreMultiplied Sets if texture is premultiplied.
|
||||
@Description Sets whether or not the texture's colour has been
|
||||
pre-multiplied by the alpha values.
|
||||
*************************************************************************/
|
||||
void setIsPreMultiplied(bool isPreMultiplied);
|
||||
|
||||
/*!***********************************************************************
|
||||
Meta Data functions - Getters.
|
||||
*************************************************************************/
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function isBumpMap
|
||||
@Return bool True if it is a bump map.
|
||||
@Description Returns whether the texture is a bump map or not.
|
||||
*************************************************************************/
|
||||
const bool isBumpMap() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getBumpMapScale
|
||||
@Return float Returns the bump map scale.
|
||||
@Description Gets the bump map scaling value for this texture. If the
|
||||
texture is not a bump map, 0.0f is returned. If the
|
||||
texture is a bump map but no meta data is stored to
|
||||
specify its scale, then 1.0f is returned.
|
||||
*************************************************************************/
|
||||
const float getBumpMapScale() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getBumpMapOrder
|
||||
@Return CPVRTString Returns bump map order relative to rgba.
|
||||
@Description Gets the bump map channel order relative to rgba. For
|
||||
example, an RGB texture with bumps mapped to XYZ returns
|
||||
'xyz'. A BGR texture with bumps in the order ZYX will also
|
||||
return 'xyz' as the mapping is the same: R=X, G=Y, B=Z.
|
||||
If the letter 'h' is present in the string, it means that
|
||||
the height map has been stored here.
|
||||
Other characters are possible if the bump map was created
|
||||
manually, but PVRTexLib will ignore these characters. They
|
||||
are returned simply for completeness.
|
||||
*************************************************************************/
|
||||
const CPVRTString getBumpMapOrder() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getNumTextureAtlasMembers
|
||||
@Return int Returns number of sub textures defined by meta data.
|
||||
@Description Works out the number of possible texture atlas members in
|
||||
the texture based on the w/h/d and the data size.
|
||||
TODO: Is this the right way to do things? Should I return number of floats? Or just data size? Hmm. Also need to make it TWO floats per dimension, and also possibly a rotated value. Not sure.
|
||||
*************************************************************************/
|
||||
const int getNumTextureAtlasMembers() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getTextureAtlasData
|
||||
@Return float* Returns a pointer directly to the texture atlas data.
|
||||
@Description Returns a pointer to the texture atlas data.
|
||||
TODO: Maybe I should return a copy rather than the original.
|
||||
*************************************************************************/
|
||||
const float* getTextureAtlasData() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getCubeMapOrder
|
||||
@Return CPVRTString Returns cube map order.
|
||||
@Description Gets the cube map face order. Returned string will be in
|
||||
the form "ZzXxYy" with capitals representing positive and
|
||||
small letters representing negative. I.e. Z=Z-Positive,
|
||||
z=Z-Negative.
|
||||
*************************************************************************/
|
||||
const CPVRTString getCubeMapOrder() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getBorder
|
||||
@Input uiBorderWidth
|
||||
@Input uiBorderHeight
|
||||
@Input uiBorderDepth
|
||||
@Description Obtains the border size in each dimension for this texture.
|
||||
*************************************************************************/
|
||||
void getBorder(uint32& uiBorderWidth, uint32& uiBorderHeight, uint32& uiBorderDepth) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getMetaData
|
||||
@Input DevFOURCC
|
||||
@Input u32Key
|
||||
@Return pvrtexture::MetaDataBlock A copy of the meta data from the texture.
|
||||
@Description Returns a block of meta data from the texture. If the meta data doesn't exist, a block with data size 0 will be returned.
|
||||
*************************************************************************/
|
||||
MetaDataBlock getMetaData(uint32 DevFOURCC, uint32 u32Key) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function hasMetaData
|
||||
@Input DevFOURCC
|
||||
@Input u32Key
|
||||
@Return bool Whether or not the meta data bock specified exists
|
||||
@Description Returns whether or not the specified meta data exists as
|
||||
part of this texture header.
|
||||
*************************************************************************/
|
||||
bool hasMetaData(uint32 DevFOURCC, uint32 u32Key) const;
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function getMetaDataMap
|
||||
@Return MetaDataMap* A direct pointer to the MetaData map.
|
||||
@Description A pointer directly to the Meta Data Map, to allow users to read out data.
|
||||
*************************************************************************/
|
||||
const MetaDataMap* const getMetaDataMap() const;
|
||||
|
||||
/*!***********************************************************************
|
||||
Meta Data functions - Setters.
|
||||
*************************************************************************/
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setBumpMap
|
||||
@Input bumpScale Floating point "height" value to scale the bump map.
|
||||
@Input bumpOrder Up to 4 character string, with values x,y,z,h in
|
||||
some combination. Not all values need to be present.
|
||||
Denotes channel order; x,y,z refer to the
|
||||
corresponding axes, h indicates presence of the
|
||||
original height map. It is possible to have only some
|
||||
of these values rather than all. For example if 'h'
|
||||
is present alone it will be considered a height map.
|
||||
The values should be presented in RGBA order, regardless
|
||||
of the texture format, so a zyxh order in a bgra texture
|
||||
should still be passed as 'xyzh'. Capitals are allowed.
|
||||
Any character stored here that is not one of x,y,z,h
|
||||
or a NULL character will be ignored when PVRTexLib
|
||||
reads the data, but will be preserved. This is useful
|
||||
if you wish to define a custom data channel for instance.
|
||||
In these instances PVRTexLib will assume it is simply
|
||||
colour data.
|
||||
@Description Sets a texture's bump map data.
|
||||
*************************************************************************/
|
||||
void setBumpMap(float bumpScale, CPVRTString bumpOrder="xyz");
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setTextureAtlas
|
||||
@Input pAtlasData Pointer to an array of atlas data.
|
||||
@Input dataSize Number of floats that the data pointer contains.
|
||||
@Description Sets the texture atlas coordinate meta data for later display.
|
||||
It is up to the user to make sure that this texture atlas
|
||||
data actually makes sense in the context of the header. It is
|
||||
suggested that the "generateTextureAtlas" method in the tools
|
||||
is used to create a texture atlas, manually setting one up is
|
||||
possible but should be done with care.
|
||||
*************************************************************************/
|
||||
void setTextureAtlas(float* pAtlasData, uint32 dataSize);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setCubeMapOrder
|
||||
@Input cubeMapOrder Up to 6 character string, with values
|
||||
x,X,y,Y,z,Z in some combination. Not all
|
||||
values need to be present. Denotes face
|
||||
order; Capitals refer to positive axis
|
||||
positions and small letters refer to
|
||||
negative axis positions. E.g. x=X-Negative,
|
||||
X=X-Positive. It is possible to have only
|
||||
some of these values rather than all, as
|
||||
long as they are NULL terminated.
|
||||
NB: Values past the 6th character are not read.
|
||||
@Description Sets a texture's bump map data.
|
||||
*************************************************************************/
|
||||
void setCubeMapOrder(CPVRTString cubeMapOrder="XxYyZz");
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function setBorder
|
||||
@Input uiBorderWidth
|
||||
@Input uiBorderHeight
|
||||
@Input uiBorderDepth
|
||||
@Return void
|
||||
@Description Sets a texture's border size data. This value is subtracted
|
||||
from the current texture height/width/depth to get the valid
|
||||
texture data.
|
||||
*************************************************************************/
|
||||
void setBorder(uint32 uiBorderWidth, uint32 uiBorderHeight, uint32 uiBorderDepth);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function addMetaData
|
||||
@Input MetaBlock Meta data block to be added.
|
||||
@Description Adds an arbitrary piece of meta data.
|
||||
*************************************************************************/
|
||||
void addMetaData(const MetaDataBlock& MetaBlock);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function removeMetaData
|
||||
@Input DevFourCC
|
||||
@Input u32Key
|
||||
@Return void
|
||||
@Description Removes a specified piece of meta data, if it exists.
|
||||
*************************************************************************/
|
||||
void removeMetaData(const uint32& DevFourCC, const uint32& u32Key);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
171
extern/pvrtextool/Include/PVRTextureUtilities.h
vendored
Normal file
171
extern/pvrtextool/Include/PVRTextureUtilities.h
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTextureUtilities.h
|
||||
|
||||
@Title
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform
|
||||
|
||||
@Description
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef _PVRTEXTURE_UTILITIES_H
|
||||
#define _PVRTEXTURE_UTILITIES_H
|
||||
|
||||
#include "PVRTextureFormat.h"
|
||||
#include "PVRTexture.h"
|
||||
|
||||
namespace pvrtexture
|
||||
{
|
||||
/*!***********************************************************************
|
||||
@Function Resize
|
||||
@Input sTexture
|
||||
@Input u32NewWidth
|
||||
@Input u32NewHeight
|
||||
@Input u32NewDepth
|
||||
@Input eResizeMode
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Resizes the texture to new specified dimensions. Filtering
|
||||
mode is specified with "eResizeMode".
|
||||
*************************************************************************/
|
||||
bool PVR_DLL Resize(CPVRTexture& sTexture, const uint32& u32NewWidth, const uint32& u32NewHeight, const uint32& u32NewDepth, const EResizeMode eResizeMode);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function Rotate90
|
||||
@Input sTexture
|
||||
@Input eRotationAxis
|
||||
@Input bForward
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Rotates a texture by 90 degrees around the given axis. bForward controls direction of rotation.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL Rotate90(CPVRTexture& sTexture, const EPVRTAxis eRotationAxis, const bool bForward);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function Flip
|
||||
@Input sTexture
|
||||
@Input eFlipDirection
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Flips a texture in a given direction.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL Flip(CPVRTexture& sTexture, const EPVRTAxis eFlipDirection);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function Border
|
||||
@Input sTexture
|
||||
@Input uiBorderX
|
||||
@Input uiBorderY
|
||||
@Input uiBorderZ
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Adds a user specified border to the texture.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL Border(CPVRTexture& sTexture, uint32 uiBorderX, uint32 uiBorderY, uint32 uiBorderZ);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function PreMultiplyAlpha
|
||||
@Input sTexture
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Pre-multiplies a texture's colours by its alpha values.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL PreMultiplyAlpha(CPVRTexture& sTexture);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function Bleed
|
||||
@Input sTexture
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Allows a texture's colours to run into any fully transparent areas.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL Bleed(CPVRTexture& sTexture);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function SetChannels
|
||||
@Input sTexture
|
||||
@Input uiNumChannelSets
|
||||
@Input eChannels
|
||||
@Input pValues
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Sets the specified number of channels to values specified in pValues.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL SetChannels(CPVRTexture& sTexture, uint32 uiNumChannelSets, EChannelName *eChannels, uint32 *pValues);
|
||||
bool PVR_DLL SetChannelsFloat(CPVRTexture& sTexture, uint32 uiNumChannelSets, EChannelName *eChannels, float *pValues);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function CopyChannels
|
||||
@Input sTexture
|
||||
@Input sTextureSource
|
||||
@Input uiNumChannelCopies
|
||||
@Input eChannels
|
||||
@Input eChannelsSource
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Copies the specified channels from sTextureSource into sTexture.
|
||||
sTextureSource is not modified so it is possible to use the
|
||||
same texture as both input and output. When using the same
|
||||
texture as source and destination, channels are preserved
|
||||
between swaps (e.g. copying Red to Green and then Green to Red
|
||||
will result in the two channels trading places correctly).
|
||||
Channels in eChannels are set to the value of the channels
|
||||
in eChannelSource.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL CopyChannels(CPVRTexture& sTexture, const CPVRTexture& sTextureSource, uint32 uiNumChannelCopies, EChannelName *eChannels, EChannelName *eChannelsSource);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function GenerateNormalMap
|
||||
@Input sTexture
|
||||
@Input fScale
|
||||
@Input sChannelOrder
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Generates a Normal Map from a given height map.
|
||||
Assumes the red channel has the height values.
|
||||
By default outputs to red/green/blue = x/y/z,
|
||||
this can be overridden by specifying a channel
|
||||
order in sChannelOrder. The channels specified
|
||||
will output to red/green/blue/alpha in that order.
|
||||
So "xyzh" maps x to red, y to green, z to blue
|
||||
and h to alpha. 'h' is used to specify that the
|
||||
original height map data should be preserved in
|
||||
the given channel.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL GenerateNormalMap(CPVRTexture& sTexture, const float fScale, CPVRTString sChannelOrder);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function GenerateMIPMaps
|
||||
@Input sTexture
|
||||
@Input eFilterMode
|
||||
@Input uiMIPMapsToDo
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Generates MIPMaps for a source texture. Default is to
|
||||
create a complete MIPMap chain, however this can be
|
||||
overridden with uiMIPMapsToDo.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL GenerateMIPMaps(CPVRTexture& sTexture, const EResizeMode eFilterMode, const uint32 uiMIPMapsToDo=PVRTEX_ALLMIPLEVELS);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function ColourMIPMaps
|
||||
@Input sTexture
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Colours a texture's MIPMap levels with artificial colours
|
||||
for debugging. MIP levels are coloured in the order:
|
||||
Red, Green, Blue, Cyan, Magenta and Yellow
|
||||
in a repeating pattern.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL ColourMIPMaps(CPVRTexture& sTexture);
|
||||
|
||||
/*!***********************************************************************
|
||||
@Function Transcode
|
||||
@Input sTexture
|
||||
@Input ptFormat
|
||||
@Input eChannelType
|
||||
@Input eColourspace
|
||||
@Input eQuality
|
||||
@Input bDoDither
|
||||
@Return bool Whether the method succeeds or not.
|
||||
@Description Transcodes a texture from its original format into a newly specified format.
|
||||
Will either quantise or dither to lower precisions based on bDoDither.
|
||||
uiQuality specifies the quality for PVRTC and ETC compression.
|
||||
*************************************************************************/
|
||||
bool PVR_DLL Transcode(CPVRTexture& sTexture, const PixelType ptFormat, const EPVRTVariableType eChannelType, const EPVRTColourSpace eColourspace, const ECompressorQuality eQuality=ePVRTCNormal, const bool bDoDither=false);
|
||||
};
|
||||
#endif //_PVRTEXTURE_UTILTIES_H
|
23
extern/pvrtextool/Include/PVRTextureVersion.h
vendored
Normal file
23
extern/pvrtextool/Include/PVRTextureVersion.h
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/******************************************************************************
|
||||
|
||||
@File PVRTextureVersion.h
|
||||
|
||||
@Title
|
||||
|
||||
@Version
|
||||
|
||||
@Copyright Copyright (c) Imagination Technologies Limited. All Rights Reserved. Strictly Confidential.
|
||||
|
||||
@Platform ANSI
|
||||
|
||||
@Description Texture processing routines.
|
||||
|
||||
******************************************************************************/
|
||||
#ifndef PVRTEXLIBVERSION_H
|
||||
#define PVRTEXLIBVERSION_H
|
||||
#define PVRTLMAJORVERSION 4
|
||||
#define PVRTLMINORVERSION 2
|
||||
#define PVRTLSTRINGVERSION "4.2"
|
||||
#define PVRTLVERSIONDESCRIPTOR "" //"BETA" //"ALPHA" //"ENGINEERING DROP"
|
||||
#endif
|
||||
|
BIN
extern/pvrtextool/OSX_x86/Static/libPVRTexLib.a
vendored
Normal file
BIN
extern/pvrtextool/OSX_x86/Static/libPVRTexLib.a
vendored
Normal file
Binary file not shown.
BIN
extern/pvrtextool/Windows_x86_32/Static/PVRTexLib.lib
vendored
Normal file
BIN
extern/pvrtextool/Windows_x86_32/Static/PVRTexLib.lib
vendored
Normal file
Binary file not shown.
BIN
extern/pvrtextool/Windows_x86_64/Static/PVRTexLib.lib
vendored
Normal file
BIN
extern/pvrtextool/Windows_x86_64/Static/PVRTexLib.lib
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user