Organized directory structure for 3rd party source and libraries.
Added pvrtexlib library and headers Added Recast --HG-- branch : nfb
This commit is contained in:
565
KREngine/3rdparty/pvrtexlib/include/PVRTArray.h
vendored
Normal file
565
KREngine/3rdparty/pvrtexlib/include/PVRTArray.h
vendored
Normal file
@@ -0,0 +1,565 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
@File PVRTArray.h
|
||||||
|
|
||||||
|
@Title PVRTArray
|
||||||
|
|
||||||
|
@Version
|
||||||
|
|
||||||
|
@Copyright Copyright (c) Imagination Technologies Limited.
|
||||||
|
|
||||||
|
@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__
|
||||||
|
|
||||||
|
#include "PVRTGlobal.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
KREngine/3rdparty/pvrtexlib/include/PVRTDecompress.h
vendored
Normal file
58
KREngine/3rdparty/pvrtexlib/include/PVRTDecompress.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
@File PVRTDecompress.h
|
||||||
|
|
||||||
|
@Title PVRTDecompress
|
||||||
|
|
||||||
|
@Version
|
||||||
|
|
||||||
|
@Copyright Copyright (c) Imagination Technologies Limited.
|
||||||
|
|
||||||
|
@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
KREngine/3rdparty/pvrtexlib/include/PVRTError.h
vendored
Normal file
71
KREngine/3rdparty/pvrtexlib/include/PVRTError.h
vendored
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
@File PVRTError.h
|
||||||
|
|
||||||
|
@Title PVRTError
|
||||||
|
|
||||||
|
@Version
|
||||||
|
|
||||||
|
@Copyright Copyright (c) Imagination Technologies Limited.
|
||||||
|
|
||||||
|
@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) && !defined(UNDER_CE)
|
||||||
|
#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)
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
296
KREngine/3rdparty/pvrtexlib/include/PVRTGlobal.h
vendored
Normal file
296
KREngine/3rdparty/pvrtexlib/include/PVRTGlobal.h
vendored
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
@File PVRTGlobal.h
|
||||||
|
|
||||||
|
@Title PVRTGlobal
|
||||||
|
|
||||||
|
@Version
|
||||||
|
|
||||||
|
@Copyright Copyright (c) Imagination Technologies Limited.
|
||||||
|
|
||||||
|
@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__) && !defined(UNDER_CE) /* Windows desktop */
|
||||||
|
#if !defined(_CRTDBG_MAP_ALLOC)
|
||||||
|
#define _CRTDBG_MAP_ALLOC
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
#include <crtdbg.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(UNDER_CE)
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#ifndef _ASSERT
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define _ASSERT(X) { (X) ? 0 : DebugBreak(); }
|
||||||
|
#else
|
||||||
|
#define _ASSERT(X)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ASSERTE
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define _ASSERTE _ASSERT
|
||||||
|
#else
|
||||||
|
#define _ASSERTE(X)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#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)
|
||||||
|
#else
|
||||||
|
|
||||||
|
#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
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define FREE(X) { if(X) { free(X); (X) = 0; } }
|
||||||
|
|
||||||
|
// 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_Linear,
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
** 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)
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
225
KREngine/3rdparty/pvrtexlib/include/PVRTMap.h
vendored
Normal file
225
KREngine/3rdparty/pvrtexlib/include/PVRTMap.h
vendored
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
@File PVRTMap.h
|
||||||
|
|
||||||
|
@Title PVRTArray
|
||||||
|
|
||||||
|
@Version
|
||||||
|
|
||||||
|
@Copyright Copyright (c) Imagination Technologies Limited.
|
||||||
|
|
||||||
|
@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
|
||||||
|
{
|
||||||
|
if (uiIndex>=m_uiSize)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
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)
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
982
KREngine/3rdparty/pvrtexlib/include/PVRTString.h
vendored
Normal file
982
KREngine/3rdparty/pvrtexlib/include/PVRTString.h
vendored
Normal file
@@ -0,0 +1,982 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
@File PVRTString.h
|
||||||
|
|
||||||
|
@Title PVRTString
|
||||||
|
|
||||||
|
@Version
|
||||||
|
|
||||||
|
@Copyright Copyright (c) Imagination Technologies Limited.
|
||||||
|
|
||||||
|
@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)
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
700
KREngine/3rdparty/pvrtexlib/include/PVRTTexture.h
vendored
Normal file
700
KREngine/3rdparty/pvrtexlib/include/PVRTTexture.h
vendored
Normal file
@@ -0,0 +1,700 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
@File PVRTTexture.h
|
||||||
|
|
||||||
|
@Title PVRTTexture
|
||||||
|
|
||||||
|
@Version
|
||||||
|
|
||||||
|
@Copyright Copyright (c) Imagination Technologies Limited.
|
||||||
|
|
||||||
|
@Platform ANSI compatible
|
||||||
|
|
||||||
|
@Description Texture loading.
|
||||||
|
|
||||||
|
******************************************************************************/
|
||||||
|
#ifndef _PVRTTEXTURE_H_
|
||||||
|
#define _PVRTTEXTURE_H_
|
||||||
|
|
||||||
|
#include "PVRTGlobal.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)
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
208
KREngine/3rdparty/pvrtexlib/include/PVRTexture.h
vendored
Normal file
208
KREngine/3rdparty/pvrtexlib/include/PVRTexture.h
vendored
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
#ifndef _PVRTEXTURE_H
|
||||||
|
#define _PVRTEXTURE_H
|
||||||
|
|
||||||
|
#include "PVRTextureDefines.h"
|
||||||
|
#include "PVRTextureHeader.h"
|
||||||
|
#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);
|
||||||
|
|
||||||
|
/*!***********************************************************************
|
||||||
|
@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
|
||||||
|
|
||||||
98
KREngine/3rdparty/pvrtexlib/include/PVRTextureDefines.h
vendored
Normal file
98
KREngine/3rdparty/pvrtexlib/include/PVRTextureDefines.h
vendored
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
#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 various classes/structs used by this library. This exports their interfaces for DLLs.
|
||||||
|
struct PVR_DLL PVRTextureHeaderV3;
|
||||||
|
struct PVR_DLL MetaDataBlock;
|
||||||
|
template <typename KeyType, typename DataType>
|
||||||
|
class PVR_DLL CPVRTMap;
|
||||||
|
template<typename T>
|
||||||
|
class PVR_DLL CPVRTArray;
|
||||||
|
class PVR_DLL CPVRTString;
|
||||||
|
#elif defined(_WINDLL_IMPORT)
|
||||||
|
#define PVR_DLL __declspec(dllimport)
|
||||||
|
//Forward declaration of various classes/structs used by this library. This imports their interfaces for DLLs.
|
||||||
|
struct PVR_DLL PVRTextureHeaderV3;
|
||||||
|
struct PVR_DLL MetaDataBlock;
|
||||||
|
template <typename KeyType, typename DataType>
|
||||||
|
class PVR_DLL CPVRTMap;
|
||||||
|
template<typename T>
|
||||||
|
class PVR_DLL CPVRTArray;
|
||||||
|
class PVR_DLL CPVRTString;
|
||||||
|
#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
|
||||||
73
KREngine/3rdparty/pvrtexlib/include/PVRTextureFormat.h
vendored
Normal file
73
KREngine/3rdparty/pvrtexlib/include/PVRTextureFormat.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
#ifndef _PVRT_PIXEL_FORMAT_H
|
||||||
|
#define _PVRT_PIXEL_FORMAT_H
|
||||||
|
|
||||||
|
#include "PVRTextureDefines.h"
|
||||||
|
#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
|
||||||
586
KREngine/3rdparty/pvrtexlib/include/PVRTextureHeader.h
vendored
Normal file
586
KREngine/3rdparty/pvrtexlib/include/PVRTextureHeader.h
vendored
Normal file
@@ -0,0 +1,586 @@
|
|||||||
|
#ifndef _PVRTEXTURE_HEADER_H
|
||||||
|
#define _PVRTEXTURE_HEADER_H
|
||||||
|
|
||||||
|
#include "PVRTextureDefines.h"
|
||||||
|
#include "PVRTextureFormat.h"
|
||||||
|
#include "PVRTString.h"
|
||||||
|
#include "PVRTMap.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.
|
||||||
|
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.
|
||||||
|
*************************************************************************/
|
||||||
|
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.
|
||||||
|
*************************************************************************/
|
||||||
|
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.
|
||||||
|
*************************************************************************/
|
||||||
|
const 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
|
||||||
157
KREngine/3rdparty/pvrtexlib/include/PVRTextureUtilities.h
vendored
Normal file
157
KREngine/3rdparty/pvrtexlib/include/PVRTextureUtilities.h
vendored
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
#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
|
||||||
|
|
||||||
7
KREngine/3rdparty/pvrtexlib/include/PVRTextureVersion.h
vendored
Normal file
7
KREngine/3rdparty/pvrtexlib/include/PVRTextureVersion.h
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef PVRTEXLIBVERSION_H
|
||||||
|
#define PVRTEXLIBVERSION_H
|
||||||
|
#define PVRTLMAJORVERSION 4
|
||||||
|
#define PVRTLMINORVERSION 6
|
||||||
|
#define PVRTLSTRINGVERSION "4.6"
|
||||||
|
#define PVRTLVERSIONDESCRIPTOR "" //"BETA" //"ALPHA" //"ENGINEERING DROP"
|
||||||
|
#endif
|
||||||
BIN
KREngine/3rdparty/pvrtexlib/static_osx/libPVRTexLib.a
vendored
Normal file
BIN
KREngine/3rdparty/pvrtexlib/static_osx/libPVRTexLib.a
vendored
Normal file
Binary file not shown.
1135
KREngine/3rdparty/recast/include/Recast.h
vendored
Executable file
1135
KREngine/3rdparty/recast/include/Recast.h
vendored
Executable file
File diff suppressed because it is too large
Load Diff
124
KREngine/3rdparty/recast/include/RecastAlloc.h
vendored
Executable file
124
KREngine/3rdparty/recast/include/RecastAlloc.h
vendored
Executable file
@@ -0,0 +1,124 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef RECASTALLOC_H
|
||||||
|
#define RECASTALLOC_H
|
||||||
|
|
||||||
|
/// Provides hint values to the memory allocator on how long the
|
||||||
|
/// memory is expected to be used.
|
||||||
|
enum rcAllocHint
|
||||||
|
{
|
||||||
|
RC_ALLOC_PERM, ///< Memory will persist after a function call.
|
||||||
|
RC_ALLOC_TEMP ///< Memory used temporarily within a function.
|
||||||
|
};
|
||||||
|
|
||||||
|
/// A memory allocation function.
|
||||||
|
// @param[in] size The size, in bytes of memory, to allocate.
|
||||||
|
// @param[in] rcAllocHint A hint to the allocator on how long the memory is expected to be in use.
|
||||||
|
// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed.
|
||||||
|
/// @see rcAllocSetCustom
|
||||||
|
typedef void* (rcAllocFunc)(int size, rcAllocHint hint);
|
||||||
|
|
||||||
|
/// A memory deallocation function.
|
||||||
|
/// @param[in] ptr A pointer to a memory block previously allocated using #rcAllocFunc.
|
||||||
|
/// @see rcAllocSetCustom
|
||||||
|
typedef void (rcFreeFunc)(void* ptr);
|
||||||
|
|
||||||
|
/// Sets the base custom allocation functions to be used by Recast.
|
||||||
|
/// @param[in] allocFunc The memory allocation function to be used by #rcAlloc
|
||||||
|
/// @param[in] freeFunc The memory de-allocation function to be used by #rcFree
|
||||||
|
void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc);
|
||||||
|
|
||||||
|
/// Allocates a memory block.
|
||||||
|
/// @param[in] size The size, in bytes of memory, to allocate.
|
||||||
|
/// @param[in] hint A hint to the allocator on how long the memory is expected to be in use.
|
||||||
|
/// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed.
|
||||||
|
/// @see rcFree
|
||||||
|
void* rcAlloc(int size, rcAllocHint hint);
|
||||||
|
|
||||||
|
/// Deallocates a memory block.
|
||||||
|
/// @param[in] ptr A pointer to a memory block previously allocated using #rcAlloc.
|
||||||
|
/// @see rcAlloc
|
||||||
|
void rcFree(void* ptr);
|
||||||
|
|
||||||
|
|
||||||
|
/// A simple dynamic array of integers.
|
||||||
|
class rcIntArray
|
||||||
|
{
|
||||||
|
int* m_data;
|
||||||
|
int m_size, m_cap;
|
||||||
|
inline rcIntArray(const rcIntArray&);
|
||||||
|
inline rcIntArray& operator=(const rcIntArray&);
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// Constructs an instance with an initial array size of zero.
|
||||||
|
inline rcIntArray() : m_data(0), m_size(0), m_cap(0) {}
|
||||||
|
|
||||||
|
/// Constructs an instance initialized to the specified size.
|
||||||
|
/// @param[in] n The initial size of the integer array.
|
||||||
|
inline rcIntArray(int n) : m_data(0), m_size(0), m_cap(0) { resize(n); }
|
||||||
|
inline ~rcIntArray() { rcFree(m_data); }
|
||||||
|
|
||||||
|
/// Specifies the new size of the integer array.
|
||||||
|
/// @param[in] n The new size of the integer array.
|
||||||
|
void resize(int n);
|
||||||
|
|
||||||
|
/// Push the specified integer onto the end of the array and increases the size by one.
|
||||||
|
/// @param[in] item The new value.
|
||||||
|
inline void push(int item) { resize(m_size+1); m_data[m_size-1] = item; }
|
||||||
|
|
||||||
|
/// Returns the value at the end of the array and reduces the size by one.
|
||||||
|
/// @return The value at the end of the array.
|
||||||
|
inline int pop() { if (m_size > 0) m_size--; return m_data[m_size]; }
|
||||||
|
|
||||||
|
/// The value at the specified array index.
|
||||||
|
/// @warning Does not provide overflow protection.
|
||||||
|
/// @param[in] i The index of the value.
|
||||||
|
inline const int& operator[](int i) const { return m_data[i]; }
|
||||||
|
|
||||||
|
/// The value at the specified array index.
|
||||||
|
/// @warning Does not provide overflow protection.
|
||||||
|
/// @param[in] i The index of the value.
|
||||||
|
inline int& operator[](int i) { return m_data[i]; }
|
||||||
|
|
||||||
|
/// The current size of the integer array.
|
||||||
|
inline int size() const { return m_size; }
|
||||||
|
};
|
||||||
|
|
||||||
|
/// A simple helper class used to delete an array when it goes out of scope.
|
||||||
|
/// @note This class is rarely if ever used by the end user.
|
||||||
|
template<class T> class rcScopedDelete
|
||||||
|
{
|
||||||
|
T* ptr;
|
||||||
|
inline T* operator=(T* p);
|
||||||
|
public:
|
||||||
|
|
||||||
|
/// Constructs an instance with a null pointer.
|
||||||
|
inline rcScopedDelete() : ptr(0) {}
|
||||||
|
|
||||||
|
/// Constructs an instance with the specified pointer.
|
||||||
|
/// @param[in] p An pointer to an allocated array.
|
||||||
|
inline rcScopedDelete(T* p) : ptr(p) {}
|
||||||
|
inline ~rcScopedDelete() { rcFree(ptr); }
|
||||||
|
|
||||||
|
/// The root array pointer.
|
||||||
|
/// @return The root array pointer.
|
||||||
|
inline operator T*() { return ptr; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
33
KREngine/3rdparty/recast/include/RecastAssert.h
vendored
Executable file
33
KREngine/3rdparty/recast/include/RecastAssert.h
vendored
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef RECASTASSERT_H
|
||||||
|
#define RECASTASSERT_H
|
||||||
|
|
||||||
|
// Note: This header file's only purpose is to include define assert.
|
||||||
|
// Feel free to change the file and include your own implementation instead.
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
// From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
|
||||||
|
# define rcAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false)
|
||||||
|
#else
|
||||||
|
# include <assert.h>
|
||||||
|
# define rcAssert assert
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RECASTASSERT_H
|
||||||
489
KREngine/3rdparty/recast/source/Recast.cpp
vendored
Executable file
489
KREngine/3rdparty/recast/source/Recast.cpp
vendored
Executable file
@@ -0,0 +1,489 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
float rcSqrt(float x)
|
||||||
|
{
|
||||||
|
return sqrtf(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @class rcContext
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// This class does not provide logging or timer functionality on its
|
||||||
|
/// own. Both must be provided by a concrete implementation
|
||||||
|
/// by overriding the protected member functions. Also, this class does not
|
||||||
|
/// provide an interface for extracting log messages. (Only adding them.)
|
||||||
|
/// So concrete implementations must provide one.
|
||||||
|
///
|
||||||
|
/// If no logging or timers are required, just pass an instance of this
|
||||||
|
/// class through the Recast build process.
|
||||||
|
///
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// @code
|
||||||
|
/// // Where ctx is an instance of rcContext and filepath is a char array.
|
||||||
|
/// ctx->log(RC_LOG_ERROR, "buildTiledNavigation: Could not load '%s'", filepath);
|
||||||
|
/// @endcode
|
||||||
|
void rcContext::log(const rcLogCategory category, const char* format, ...)
|
||||||
|
{
|
||||||
|
if (!m_logEnabled)
|
||||||
|
return;
|
||||||
|
static const int MSG_SIZE = 512;
|
||||||
|
char msg[MSG_SIZE];
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
int len = vsnprintf(msg, MSG_SIZE, format, ap);
|
||||||
|
if (len >= MSG_SIZE)
|
||||||
|
{
|
||||||
|
len = MSG_SIZE-1;
|
||||||
|
msg[MSG_SIZE-1] = '\0';
|
||||||
|
}
|
||||||
|
va_end(ap);
|
||||||
|
doLog(category, msg, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcHeightfield* rcAllocHeightfield()
|
||||||
|
{
|
||||||
|
rcHeightfield* hf = (rcHeightfield*)rcAlloc(sizeof(rcHeightfield), RC_ALLOC_PERM);
|
||||||
|
memset(hf, 0, sizeof(rcHeightfield));
|
||||||
|
return hf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreeHeightField(rcHeightfield* hf)
|
||||||
|
{
|
||||||
|
if (!hf) return;
|
||||||
|
// Delete span array.
|
||||||
|
rcFree(hf->spans);
|
||||||
|
// Delete span pools.
|
||||||
|
while (hf->pools)
|
||||||
|
{
|
||||||
|
rcSpanPool* next = hf->pools->next;
|
||||||
|
rcFree(hf->pools);
|
||||||
|
hf->pools = next;
|
||||||
|
}
|
||||||
|
rcFree(hf);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcCompactHeightfield* rcAllocCompactHeightfield()
|
||||||
|
{
|
||||||
|
rcCompactHeightfield* chf = (rcCompactHeightfield*)rcAlloc(sizeof(rcCompactHeightfield), RC_ALLOC_PERM);
|
||||||
|
memset(chf, 0, sizeof(rcCompactHeightfield));
|
||||||
|
return chf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreeCompactHeightfield(rcCompactHeightfield* chf)
|
||||||
|
{
|
||||||
|
if (!chf) return;
|
||||||
|
rcFree(chf->cells);
|
||||||
|
rcFree(chf->spans);
|
||||||
|
rcFree(chf->dist);
|
||||||
|
rcFree(chf->areas);
|
||||||
|
rcFree(chf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rcHeightfieldLayerSet* rcAllocHeightfieldLayerSet()
|
||||||
|
{
|
||||||
|
rcHeightfieldLayerSet* lset = (rcHeightfieldLayerSet*)rcAlloc(sizeof(rcHeightfieldLayerSet), RC_ALLOC_PERM);
|
||||||
|
memset(lset, 0, sizeof(rcHeightfieldLayerSet));
|
||||||
|
return lset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreeHeightfieldLayerSet(rcHeightfieldLayerSet* lset)
|
||||||
|
{
|
||||||
|
if (!lset) return;
|
||||||
|
for (int i = 0; i < lset->nlayers; ++i)
|
||||||
|
{
|
||||||
|
rcFree(lset->layers[i].heights);
|
||||||
|
rcFree(lset->layers[i].areas);
|
||||||
|
rcFree(lset->layers[i].cons);
|
||||||
|
}
|
||||||
|
rcFree(lset->layers);
|
||||||
|
rcFree(lset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rcContourSet* rcAllocContourSet()
|
||||||
|
{
|
||||||
|
rcContourSet* cset = (rcContourSet*)rcAlloc(sizeof(rcContourSet), RC_ALLOC_PERM);
|
||||||
|
memset(cset, 0, sizeof(rcContourSet));
|
||||||
|
return cset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreeContourSet(rcContourSet* cset)
|
||||||
|
{
|
||||||
|
if (!cset) return;
|
||||||
|
for (int i = 0; i < cset->nconts; ++i)
|
||||||
|
{
|
||||||
|
rcFree(cset->conts[i].verts);
|
||||||
|
rcFree(cset->conts[i].rverts);
|
||||||
|
}
|
||||||
|
rcFree(cset->conts);
|
||||||
|
rcFree(cset);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcPolyMesh* rcAllocPolyMesh()
|
||||||
|
{
|
||||||
|
rcPolyMesh* pmesh = (rcPolyMesh*)rcAlloc(sizeof(rcPolyMesh), RC_ALLOC_PERM);
|
||||||
|
memset(pmesh, 0, sizeof(rcPolyMesh));
|
||||||
|
return pmesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreePolyMesh(rcPolyMesh* pmesh)
|
||||||
|
{
|
||||||
|
if (!pmesh) return;
|
||||||
|
rcFree(pmesh->verts);
|
||||||
|
rcFree(pmesh->polys);
|
||||||
|
rcFree(pmesh->regs);
|
||||||
|
rcFree(pmesh->flags);
|
||||||
|
rcFree(pmesh->areas);
|
||||||
|
rcFree(pmesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcPolyMeshDetail* rcAllocPolyMeshDetail()
|
||||||
|
{
|
||||||
|
rcPolyMeshDetail* dmesh = (rcPolyMeshDetail*)rcAlloc(sizeof(rcPolyMeshDetail), RC_ALLOC_PERM);
|
||||||
|
memset(dmesh, 0, sizeof(rcPolyMeshDetail));
|
||||||
|
return dmesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreePolyMeshDetail(rcPolyMeshDetail* dmesh)
|
||||||
|
{
|
||||||
|
if (!dmesh) return;
|
||||||
|
rcFree(dmesh->meshes);
|
||||||
|
rcFree(dmesh->verts);
|
||||||
|
rcFree(dmesh->tris);
|
||||||
|
rcFree(dmesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcCalcBounds(const float* verts, int nv, float* bmin, float* bmax)
|
||||||
|
{
|
||||||
|
// Calculate bounding box.
|
||||||
|
rcVcopy(bmin, verts);
|
||||||
|
rcVcopy(bmax, verts);
|
||||||
|
for (int i = 1; i < nv; ++i)
|
||||||
|
{
|
||||||
|
const float* v = &verts[i*3];
|
||||||
|
rcVmin(bmin, v);
|
||||||
|
rcVmax(bmax, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcCalcGridSize(const float* bmin, const float* bmax, float cs, int* w, int* h)
|
||||||
|
{
|
||||||
|
*w = (int)((bmax[0] - bmin[0])/cs+0.5f);
|
||||||
|
*h = (int)((bmax[2] - bmin[2])/cs+0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
|
///
|
||||||
|
/// @see rcAllocHeightfield, rcHeightfield
|
||||||
|
bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int height,
|
||||||
|
const float* bmin, const float* bmax,
|
||||||
|
float cs, float ch)
|
||||||
|
{
|
||||||
|
rcIgnoreUnused(ctx);
|
||||||
|
|
||||||
|
hf.width = width;
|
||||||
|
hf.height = height;
|
||||||
|
rcVcopy(hf.bmin, bmin);
|
||||||
|
rcVcopy(hf.bmax, bmax);
|
||||||
|
hf.cs = cs;
|
||||||
|
hf.ch = ch;
|
||||||
|
hf.spans = (rcSpan**)rcAlloc(sizeof(rcSpan*)*hf.width*hf.height, RC_ALLOC_PERM);
|
||||||
|
if (!hf.spans)
|
||||||
|
return false;
|
||||||
|
memset(hf.spans, 0, sizeof(rcSpan*)*hf.width*hf.height);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void calcTriNormal(const float* v0, const float* v1, const float* v2, float* norm)
|
||||||
|
{
|
||||||
|
float e0[3], e1[3];
|
||||||
|
rcVsub(e0, v1, v0);
|
||||||
|
rcVsub(e1, v2, v0);
|
||||||
|
rcVcross(norm, e0, e1);
|
||||||
|
rcVnormalize(norm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Only sets the aread id's for the walkable triangles. Does not alter the
|
||||||
|
/// area id's for unwalkable triangles.
|
||||||
|
///
|
||||||
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
|
||||||
|
void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
||||||
|
const float* verts, int /*nv*/,
|
||||||
|
const int* tris, int nt,
|
||||||
|
unsigned char* areas)
|
||||||
|
{
|
||||||
|
rcIgnoreUnused(ctx);
|
||||||
|
|
||||||
|
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
|
||||||
|
|
||||||
|
float norm[3];
|
||||||
|
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const int* tri = &tris[i*3];
|
||||||
|
calcTriNormal(&verts[tri[0]*3], &verts[tri[1]*3], &verts[tri[2]*3], norm);
|
||||||
|
// Check if the face is walkable.
|
||||||
|
if (norm[1] > walkableThr)
|
||||||
|
areas[i] = RC_WALKABLE_AREA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Only sets the aread id's for the unwalkable triangles. Does not alter the
|
||||||
|
/// area id's for walkable triangles.
|
||||||
|
///
|
||||||
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
|
||||||
|
void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
||||||
|
const float* verts, int /*nv*/,
|
||||||
|
const int* tris, int nt,
|
||||||
|
unsigned char* areas)
|
||||||
|
{
|
||||||
|
rcIgnoreUnused(ctx);
|
||||||
|
|
||||||
|
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
|
||||||
|
|
||||||
|
float norm[3];
|
||||||
|
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const int* tri = &tris[i*3];
|
||||||
|
calcTriNormal(&verts[tri[0]*3], &verts[tri[1]*3], &verts[tri[2]*3], norm);
|
||||||
|
// Check if the face is walkable.
|
||||||
|
if (norm[1] <= walkableThr)
|
||||||
|
areas[i] = RC_NULL_AREA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int rcGetHeightFieldSpanCount(rcContext* ctx, rcHeightfield& hf)
|
||||||
|
{
|
||||||
|
rcIgnoreUnused(ctx);
|
||||||
|
|
||||||
|
const int w = hf.width;
|
||||||
|
const int h = hf.height;
|
||||||
|
int spanCount = 0;
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
for (rcSpan* s = hf.spans[x + y*w]; s; s = s->next)
|
||||||
|
{
|
||||||
|
if (s->area != RC_NULL_AREA)
|
||||||
|
spanCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return spanCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// This is just the beginning of the process of fully building a compact heightfield.
|
||||||
|
/// Various filters may be applied applied, then the distance field and regions built.
|
||||||
|
/// E.g: #rcBuildDistanceField and #rcBuildRegions
|
||||||
|
///
|
||||||
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
|
///
|
||||||
|
/// @see rcAllocCompactHeightfield, rcHeightfield, rcCompactHeightfield, rcConfig
|
||||||
|
bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const int walkableClimb,
|
||||||
|
rcHeightfield& hf, rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_COMPACTHEIGHTFIELD);
|
||||||
|
|
||||||
|
const int w = hf.width;
|
||||||
|
const int h = hf.height;
|
||||||
|
const int spanCount = rcGetHeightFieldSpanCount(ctx, hf);
|
||||||
|
|
||||||
|
// Fill in header.
|
||||||
|
chf.width = w;
|
||||||
|
chf.height = h;
|
||||||
|
chf.spanCount = spanCount;
|
||||||
|
chf.walkableHeight = walkableHeight;
|
||||||
|
chf.walkableClimb = walkableClimb;
|
||||||
|
chf.maxRegions = 0;
|
||||||
|
rcVcopy(chf.bmin, hf.bmin);
|
||||||
|
rcVcopy(chf.bmax, hf.bmax);
|
||||||
|
chf.bmax[1] += walkableHeight*hf.ch;
|
||||||
|
chf.cs = hf.cs;
|
||||||
|
chf.ch = hf.ch;
|
||||||
|
chf.cells = (rcCompactCell*)rcAlloc(sizeof(rcCompactCell)*w*h, RC_ALLOC_PERM);
|
||||||
|
if (!chf.cells)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.cells' (%d)", w*h);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(chf.cells, 0, sizeof(rcCompactCell)*w*h);
|
||||||
|
chf.spans = (rcCompactSpan*)rcAlloc(sizeof(rcCompactSpan)*spanCount, RC_ALLOC_PERM);
|
||||||
|
if (!chf.spans)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.spans' (%d)", spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(chf.spans, 0, sizeof(rcCompactSpan)*spanCount);
|
||||||
|
chf.areas = (unsigned char*)rcAlloc(sizeof(unsigned char)*spanCount, RC_ALLOC_PERM);
|
||||||
|
if (!chf.areas)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.areas' (%d)", spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(chf.areas, RC_NULL_AREA, sizeof(unsigned char)*spanCount);
|
||||||
|
|
||||||
|
const int MAX_HEIGHT = 0xffff;
|
||||||
|
|
||||||
|
// Fill in cells and spans.
|
||||||
|
int idx = 0;
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcSpan* s = hf.spans[x + y*w];
|
||||||
|
// If there are no spans at this cell, just leave the data to index=0, count=0.
|
||||||
|
if (!s) continue;
|
||||||
|
rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
c.index = idx;
|
||||||
|
c.count = 0;
|
||||||
|
while (s)
|
||||||
|
{
|
||||||
|
if (s->area != RC_NULL_AREA)
|
||||||
|
{
|
||||||
|
const int bot = (int)s->smax;
|
||||||
|
const int top = s->next ? (int)s->next->smin : MAX_HEIGHT;
|
||||||
|
chf.spans[idx].y = (unsigned short)rcClamp(bot, 0, 0xffff);
|
||||||
|
chf.spans[idx].h = (unsigned char)rcClamp(top - bot, 0, 0xff);
|
||||||
|
chf.areas[idx] = s->area;
|
||||||
|
idx++;
|
||||||
|
c.count++;
|
||||||
|
}
|
||||||
|
s = s->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find neighbour connections.
|
||||||
|
const int MAX_LAYERS = RC_NOT_CONNECTED-1;
|
||||||
|
int tooHighNeighbour = 0;
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
rcSetCon(s, dir, RC_NOT_CONNECTED);
|
||||||
|
const int nx = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ny = y + rcGetDirOffsetY(dir);
|
||||||
|
// First check that the neighbour cell is in bounds.
|
||||||
|
if (nx < 0 || ny < 0 || nx >= w || ny >= h)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Iterate over all neighbour spans and check if any of the is
|
||||||
|
// accessible from current cell.
|
||||||
|
const rcCompactCell& nc = chf.cells[nx+ny*w];
|
||||||
|
for (int k = (int)nc.index, nk = (int)(nc.index+nc.count); k < nk; ++k)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& ns = chf.spans[k];
|
||||||
|
const int bot = rcMax(s.y, ns.y);
|
||||||
|
const int top = rcMin(s.y+s.h, ns.y+ns.h);
|
||||||
|
|
||||||
|
// Check that the gap between the spans is walkable,
|
||||||
|
// and that the climb height between the gaps is not too high.
|
||||||
|
if ((top - bot) >= walkableHeight && rcAbs((int)ns.y - (int)s.y) <= walkableClimb)
|
||||||
|
{
|
||||||
|
// Mark direction as walkable.
|
||||||
|
const int lidx = k - (int)nc.index;
|
||||||
|
if (lidx < 0 || lidx > MAX_LAYERS)
|
||||||
|
{
|
||||||
|
tooHighNeighbour = rcMax(tooHighNeighbour, lidx);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rcSetCon(s, dir, lidx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tooHighNeighbour > MAX_LAYERS)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Heightfield has too many layers %d (max: %d)",
|
||||||
|
tooHighNeighbour, MAX_LAYERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_COMPACTHEIGHTFIELD);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static int getHeightfieldMemoryUsage(const rcHeightfield& hf)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
size += sizeof(hf);
|
||||||
|
size += hf.width * hf.height * sizeof(rcSpan*);
|
||||||
|
|
||||||
|
rcSpanPool* pool = hf.pools;
|
||||||
|
while (pool)
|
||||||
|
{
|
||||||
|
size += (sizeof(rcSpanPool) - sizeof(rcSpan)) + sizeof(rcSpan)*RC_SPANS_PER_POOL;
|
||||||
|
pool = pool->next;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int getCompactHeightFieldMemoryusage(const rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
size += sizeof(rcCompactHeightfield);
|
||||||
|
size += sizeof(rcCompactSpan) * chf.spanCount;
|
||||||
|
size += sizeof(rcCompactCell) * chf.width * chf.height;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
*/
|
||||||
88
KREngine/3rdparty/recast/source/RecastAlloc.cpp
vendored
Executable file
88
KREngine/3rdparty/recast/source/RecastAlloc.cpp
vendored
Executable file
@@ -0,0 +1,88 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
|
||||||
|
static void *rcAllocDefault(int size, rcAllocHint)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rcFreeDefault(void *ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static rcAllocFunc* sRecastAllocFunc = rcAllocDefault;
|
||||||
|
static rcFreeFunc* sRecastFreeFunc = rcFreeDefault;
|
||||||
|
|
||||||
|
/// @see rcAlloc, rcFree
|
||||||
|
void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc)
|
||||||
|
{
|
||||||
|
sRecastAllocFunc = allocFunc ? allocFunc : rcAllocDefault;
|
||||||
|
sRecastFreeFunc = freeFunc ? freeFunc : rcFreeDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @see rcAllocSetCustom
|
||||||
|
void* rcAlloc(int size, rcAllocHint hint)
|
||||||
|
{
|
||||||
|
return sRecastAllocFunc(size, hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// @warning This function leaves the value of @p ptr unchanged. So it still
|
||||||
|
/// points to the same (now invalid) location, and not to null.
|
||||||
|
///
|
||||||
|
/// @see rcAllocSetCustom
|
||||||
|
void rcFree(void* ptr)
|
||||||
|
{
|
||||||
|
if (ptr)
|
||||||
|
sRecastFreeFunc(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @class rcIntArray
|
||||||
|
///
|
||||||
|
/// While it is possible to pre-allocate a specific array size during
|
||||||
|
/// construction or by using the #resize method, certain methods will
|
||||||
|
/// automatically resize the array as needed.
|
||||||
|
///
|
||||||
|
/// @warning The array memory is not initialized to zero when the size is
|
||||||
|
/// manually set during construction or when using #resize.
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Using this method ensures the array is at least large enough to hold
|
||||||
|
/// the specified number of elements. This can improve performance by
|
||||||
|
/// avoiding auto-resizing during use.
|
||||||
|
void rcIntArray::resize(int n)
|
||||||
|
{
|
||||||
|
if (n > m_cap)
|
||||||
|
{
|
||||||
|
if (!m_cap) m_cap = n;
|
||||||
|
while (m_cap < n) m_cap *= 2;
|
||||||
|
int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP);
|
||||||
|
if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int));
|
||||||
|
rcFree(m_data);
|
||||||
|
m_data = newData;
|
||||||
|
}
|
||||||
|
m_size = n;
|
||||||
|
}
|
||||||
|
|
||||||
602
KREngine/3rdparty/recast/source/RecastArea.cpp
vendored
Executable file
602
KREngine/3rdparty/recast/source/RecastArea.cpp
vendored
Executable file
@@ -0,0 +1,602 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Basically, any spans that are closer to a boundary or obstruction than the specified radius
|
||||||
|
/// are marked as unwalkable.
|
||||||
|
///
|
||||||
|
/// This method is usually called immediately after the heightfield has been built.
|
||||||
|
///
|
||||||
|
/// @see rcCompactHeightfield, rcBuildCompactHeightfield, rcConfig::walkableRadius
|
||||||
|
bool rcErodeWalkableArea(rcContext* ctx, int radius, rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
const int w = chf.width;
|
||||||
|
const int h = chf.height;
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_ERODE_AREA);
|
||||||
|
|
||||||
|
unsigned char* dist = (unsigned char*)rcAlloc(sizeof(unsigned char)*chf.spanCount, RC_ALLOC_TEMP);
|
||||||
|
if (!dist)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "erodeWalkableArea: Out of memory 'dist' (%d).", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init distance.
|
||||||
|
memset(dist, 0xff, sizeof(unsigned char)*chf.spanCount);
|
||||||
|
|
||||||
|
// Mark boundary cells.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
if (chf.areas[i] == RC_NULL_AREA)
|
||||||
|
{
|
||||||
|
dist[i] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
int nc = 0;
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int nx = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ny = y + rcGetDirOffsetY(dir);
|
||||||
|
const int nidx = (int)chf.cells[nx+ny*w].index + rcGetCon(s, dir);
|
||||||
|
if (chf.areas[nidx] != RC_NULL_AREA)
|
||||||
|
{
|
||||||
|
nc++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// At least one missing neighbour.
|
||||||
|
if (nc != 4)
|
||||||
|
dist[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char nd;
|
||||||
|
|
||||||
|
// Pass 1
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
|
if (rcGetCon(s, 0) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
// (-1,0)
|
||||||
|
const int ax = x + rcGetDirOffsetX(0);
|
||||||
|
const int ay = y + rcGetDirOffsetY(0);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 0);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
nd = (unsigned char)rcMin((int)dist[ai]+2, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
|
||||||
|
// (-1,-1)
|
||||||
|
if (rcGetCon(as, 3) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int aax = ax + rcGetDirOffsetX(3);
|
||||||
|
const int aay = ay + rcGetDirOffsetY(3);
|
||||||
|
const int aai = (int)chf.cells[aax+aay*w].index + rcGetCon(as, 3);
|
||||||
|
nd = (unsigned char)rcMin((int)dist[aai]+3, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rcGetCon(s, 3) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
// (0,-1)
|
||||||
|
const int ax = x + rcGetDirOffsetX(3);
|
||||||
|
const int ay = y + rcGetDirOffsetY(3);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 3);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
nd = (unsigned char)rcMin((int)dist[ai]+2, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
|
||||||
|
// (1,-1)
|
||||||
|
if (rcGetCon(as, 2) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int aax = ax + rcGetDirOffsetX(2);
|
||||||
|
const int aay = ay + rcGetDirOffsetY(2);
|
||||||
|
const int aai = (int)chf.cells[aax+aay*w].index + rcGetCon(as, 2);
|
||||||
|
nd = (unsigned char)rcMin((int)dist[aai]+3, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pass 2
|
||||||
|
for (int y = h-1; y >= 0; --y)
|
||||||
|
{
|
||||||
|
for (int x = w-1; x >= 0; --x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
|
if (rcGetCon(s, 2) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
// (1,0)
|
||||||
|
const int ax = x + rcGetDirOffsetX(2);
|
||||||
|
const int ay = y + rcGetDirOffsetY(2);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 2);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
nd = (unsigned char)rcMin((int)dist[ai]+2, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
|
||||||
|
// (1,1)
|
||||||
|
if (rcGetCon(as, 1) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int aax = ax + rcGetDirOffsetX(1);
|
||||||
|
const int aay = ay + rcGetDirOffsetY(1);
|
||||||
|
const int aai = (int)chf.cells[aax+aay*w].index + rcGetCon(as, 1);
|
||||||
|
nd = (unsigned char)rcMin((int)dist[aai]+3, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rcGetCon(s, 1) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
// (0,1)
|
||||||
|
const int ax = x + rcGetDirOffsetX(1);
|
||||||
|
const int ay = y + rcGetDirOffsetY(1);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 1);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
nd = (unsigned char)rcMin((int)dist[ai]+2, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
|
||||||
|
// (-1,1)
|
||||||
|
if (rcGetCon(as, 0) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int aax = ax + rcGetDirOffsetX(0);
|
||||||
|
const int aay = ay + rcGetDirOffsetY(0);
|
||||||
|
const int aai = (int)chf.cells[aax+aay*w].index + rcGetCon(as, 0);
|
||||||
|
nd = (unsigned char)rcMin((int)dist[aai]+3, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsigned char thr = (unsigned char)(radius*2);
|
||||||
|
for (int i = 0; i < chf.spanCount; ++i)
|
||||||
|
if (dist[i] < thr)
|
||||||
|
chf.areas[i] = RC_NULL_AREA;
|
||||||
|
|
||||||
|
rcFree(dist);
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_ERODE_AREA);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void insertSort(unsigned char* a, const int n)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
for (i = 1; i < n; i++)
|
||||||
|
{
|
||||||
|
const unsigned char value = a[i];
|
||||||
|
for (j = i - 1; j >= 0 && a[j] > value; j--)
|
||||||
|
a[j+1] = a[j];
|
||||||
|
a[j+1] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// This filter is usually applied after applying area id's using functions
|
||||||
|
/// such as #rcMarkBoxArea, #rcMarkConvexPolyArea, and #rcMarkCylinderArea.
|
||||||
|
///
|
||||||
|
/// @see rcCompactHeightfield
|
||||||
|
bool rcMedianFilterWalkableArea(rcContext* ctx, rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
const int w = chf.width;
|
||||||
|
const int h = chf.height;
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_MEDIAN_AREA);
|
||||||
|
|
||||||
|
unsigned char* areas = (unsigned char*)rcAlloc(sizeof(unsigned char)*chf.spanCount, RC_ALLOC_TEMP);
|
||||||
|
if (!areas)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "medianFilterWalkableArea: Out of memory 'areas' (%d).", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init distance.
|
||||||
|
memset(areas, 0xff, sizeof(unsigned char)*chf.spanCount);
|
||||||
|
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (chf.areas[i] == RC_NULL_AREA)
|
||||||
|
{
|
||||||
|
areas[i] = chf.areas[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char nei[9];
|
||||||
|
for (int j = 0; j < 9; ++j)
|
||||||
|
nei[j] = chf.areas[i];
|
||||||
|
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, dir);
|
||||||
|
if (chf.areas[ai] != RC_NULL_AREA)
|
||||||
|
nei[dir*2+0] = chf.areas[ai];
|
||||||
|
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
const int dir2 = (dir+1) & 0x3;
|
||||||
|
if (rcGetCon(as, dir2) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax2 = ax + rcGetDirOffsetX(dir2);
|
||||||
|
const int ay2 = ay + rcGetDirOffsetY(dir2);
|
||||||
|
const int ai2 = (int)chf.cells[ax2+ay2*w].index + rcGetCon(as, dir2);
|
||||||
|
if (chf.areas[ai2] != RC_NULL_AREA)
|
||||||
|
nei[dir*2+1] = chf.areas[ai2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
insertSort(nei, 9);
|
||||||
|
areas[i] = nei[4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(chf.areas, areas, sizeof(unsigned char)*chf.spanCount);
|
||||||
|
|
||||||
|
rcFree(areas);
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_MEDIAN_AREA);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// The value of spacial parameters are in world units.
|
||||||
|
///
|
||||||
|
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
||||||
|
void rcMarkBoxArea(rcContext* ctx, const float* bmin, const float* bmax, unsigned char areaId,
|
||||||
|
rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_MARK_BOX_AREA);
|
||||||
|
|
||||||
|
int minx = (int)((bmin[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int miny = (int)((bmin[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int minz = (int)((bmin[2]-chf.bmin[2])/chf.cs);
|
||||||
|
int maxx = (int)((bmax[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int maxy = (int)((bmax[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int maxz = (int)((bmax[2]-chf.bmin[2])/chf.cs);
|
||||||
|
|
||||||
|
if (maxx < 0) return;
|
||||||
|
if (minx >= chf.width) return;
|
||||||
|
if (maxz < 0) return;
|
||||||
|
if (minz >= chf.height) return;
|
||||||
|
|
||||||
|
if (minx < 0) minx = 0;
|
||||||
|
if (maxx >= chf.width) maxx = chf.width-1;
|
||||||
|
if (minz < 0) minz = 0;
|
||||||
|
if (maxz >= chf.height) maxz = chf.height-1;
|
||||||
|
|
||||||
|
for (int z = minz; z <= maxz; ++z)
|
||||||
|
{
|
||||||
|
for (int x = minx; x <= maxx; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+z*chf.width];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
rcCompactSpan& s = chf.spans[i];
|
||||||
|
if ((int)s.y >= miny && (int)s.y <= maxy)
|
||||||
|
{
|
||||||
|
if (chf.areas[i] != RC_NULL_AREA)
|
||||||
|
chf.areas[i] = areaId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_MARK_BOX_AREA);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int pointInPoly(int nvert, const float* verts, const float* p)
|
||||||
|
{
|
||||||
|
int i, j, c = 0;
|
||||||
|
for (i = 0, j = nvert-1; i < nvert; j = i++)
|
||||||
|
{
|
||||||
|
const float* vi = &verts[i*3];
|
||||||
|
const float* vj = &verts[j*3];
|
||||||
|
if (((vi[2] > p[2]) != (vj[2] > p[2])) &&
|
||||||
|
(p[0] < (vj[0]-vi[0]) * (p[2]-vi[2]) / (vj[2]-vi[2]) + vi[0]) )
|
||||||
|
c = !c;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// The value of spacial parameters are in world units.
|
||||||
|
///
|
||||||
|
/// The y-values of the polygon vertices are ignored. So the polygon is effectively
|
||||||
|
/// projected onto the xz-plane at @p hmin, then extruded to @p hmax.
|
||||||
|
///
|
||||||
|
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
||||||
|
void rcMarkConvexPolyArea(rcContext* ctx, const float* verts, const int nverts,
|
||||||
|
const float hmin, const float hmax, unsigned char areaId,
|
||||||
|
rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_MARK_CONVEXPOLY_AREA);
|
||||||
|
|
||||||
|
float bmin[3], bmax[3];
|
||||||
|
rcVcopy(bmin, verts);
|
||||||
|
rcVcopy(bmax, verts);
|
||||||
|
for (int i = 1; i < nverts; ++i)
|
||||||
|
{
|
||||||
|
rcVmin(bmin, &verts[i*3]);
|
||||||
|
rcVmax(bmax, &verts[i*3]);
|
||||||
|
}
|
||||||
|
bmin[1] = hmin;
|
||||||
|
bmax[1] = hmax;
|
||||||
|
|
||||||
|
int minx = (int)((bmin[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int miny = (int)((bmin[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int minz = (int)((bmin[2]-chf.bmin[2])/chf.cs);
|
||||||
|
int maxx = (int)((bmax[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int maxy = (int)((bmax[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int maxz = (int)((bmax[2]-chf.bmin[2])/chf.cs);
|
||||||
|
|
||||||
|
if (maxx < 0) return;
|
||||||
|
if (minx >= chf.width) return;
|
||||||
|
if (maxz < 0) return;
|
||||||
|
if (minz >= chf.height) return;
|
||||||
|
|
||||||
|
if (minx < 0) minx = 0;
|
||||||
|
if (maxx >= chf.width) maxx = chf.width-1;
|
||||||
|
if (minz < 0) minz = 0;
|
||||||
|
if (maxz >= chf.height) maxz = chf.height-1;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Optimize.
|
||||||
|
for (int z = minz; z <= maxz; ++z)
|
||||||
|
{
|
||||||
|
for (int x = minx; x <= maxx; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+z*chf.width];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (chf.areas[i] == RC_NULL_AREA)
|
||||||
|
continue;
|
||||||
|
if ((int)s.y >= miny && (int)s.y <= maxy)
|
||||||
|
{
|
||||||
|
float p[3];
|
||||||
|
p[0] = chf.bmin[0] + (x+0.5f)*chf.cs;
|
||||||
|
p[1] = 0;
|
||||||
|
p[2] = chf.bmin[2] + (z+0.5f)*chf.cs;
|
||||||
|
|
||||||
|
if (pointInPoly(nverts, verts, p))
|
||||||
|
{
|
||||||
|
chf.areas[i] = areaId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_MARK_CONVEXPOLY_AREA);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rcOffsetPoly(const float* verts, const int nverts, const float offset,
|
||||||
|
float* outVerts, const int maxOutVerts)
|
||||||
|
{
|
||||||
|
const float MITER_LIMIT = 1.20f;
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < nverts; i++)
|
||||||
|
{
|
||||||
|
const int a = (i+nverts-1) % nverts;
|
||||||
|
const int b = i;
|
||||||
|
const int c = (i+1) % nverts;
|
||||||
|
const float* va = &verts[a*3];
|
||||||
|
const float* vb = &verts[b*3];
|
||||||
|
const float* vc = &verts[c*3];
|
||||||
|
float dx0 = vb[0] - va[0];
|
||||||
|
float dy0 = vb[2] - va[2];
|
||||||
|
float d0 = dx0*dx0 + dy0*dy0;
|
||||||
|
if (d0 > 1e-6f)
|
||||||
|
{
|
||||||
|
d0 = 1.0f/rcSqrt(d0);
|
||||||
|
dx0 *= d0;
|
||||||
|
dy0 *= d0;
|
||||||
|
}
|
||||||
|
float dx1 = vc[0] - vb[0];
|
||||||
|
float dy1 = vc[2] - vb[2];
|
||||||
|
float d1 = dx1*dx1 + dy1*dy1;
|
||||||
|
if (d1 > 1e-6f)
|
||||||
|
{
|
||||||
|
d1 = 1.0f/rcSqrt(d1);
|
||||||
|
dx1 *= d1;
|
||||||
|
dy1 *= d1;
|
||||||
|
}
|
||||||
|
const float dlx0 = -dy0;
|
||||||
|
const float dly0 = dx0;
|
||||||
|
const float dlx1 = -dy1;
|
||||||
|
const float dly1 = dx1;
|
||||||
|
float cross = dx1*dy0 - dx0*dy1;
|
||||||
|
float dmx = (dlx0 + dlx1) * 0.5f;
|
||||||
|
float dmy = (dly0 + dly1) * 0.5f;
|
||||||
|
float dmr2 = dmx*dmx + dmy*dmy;
|
||||||
|
bool bevel = dmr2 * MITER_LIMIT*MITER_LIMIT < 1.0f;
|
||||||
|
if (dmr2 > 1e-6f)
|
||||||
|
{
|
||||||
|
const float scale = 1.0f / dmr2;
|
||||||
|
dmx *= scale;
|
||||||
|
dmy *= scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bevel && cross < 0.0f)
|
||||||
|
{
|
||||||
|
if (n+2 >= maxOutVerts)
|
||||||
|
return 0;
|
||||||
|
float d = (1.0f - (dx0*dx1 + dy0*dy1))*0.5f;
|
||||||
|
outVerts[n*3+0] = vb[0] + (-dlx0+dx0*d)*offset;
|
||||||
|
outVerts[n*3+1] = vb[1];
|
||||||
|
outVerts[n*3+2] = vb[2] + (-dly0+dy0*d)*offset;
|
||||||
|
n++;
|
||||||
|
outVerts[n*3+0] = vb[0] + (-dlx1-dx1*d)*offset;
|
||||||
|
outVerts[n*3+1] = vb[1];
|
||||||
|
outVerts[n*3+2] = vb[2] + (-dly1-dy1*d)*offset;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (n+1 >= maxOutVerts)
|
||||||
|
return 0;
|
||||||
|
outVerts[n*3+0] = vb[0] - dmx*offset;
|
||||||
|
outVerts[n*3+1] = vb[1];
|
||||||
|
outVerts[n*3+2] = vb[2] - dmy*offset;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// The value of spacial parameters are in world units.
|
||||||
|
///
|
||||||
|
/// @see rcCompactHeightfield, rcMedianFilterWalkableArea
|
||||||
|
void rcMarkCylinderArea(rcContext* ctx, const float* pos,
|
||||||
|
const float r, const float h, unsigned char areaId,
|
||||||
|
rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_MARK_CYLINDER_AREA);
|
||||||
|
|
||||||
|
float bmin[3], bmax[3];
|
||||||
|
bmin[0] = pos[0] - r;
|
||||||
|
bmin[1] = pos[1];
|
||||||
|
bmin[2] = pos[2] - r;
|
||||||
|
bmax[0] = pos[0] + r;
|
||||||
|
bmax[1] = pos[1] + h;
|
||||||
|
bmax[2] = pos[2] + r;
|
||||||
|
const float r2 = r*r;
|
||||||
|
|
||||||
|
int minx = (int)((bmin[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int miny = (int)((bmin[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int minz = (int)((bmin[2]-chf.bmin[2])/chf.cs);
|
||||||
|
int maxx = (int)((bmax[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int maxy = (int)((bmax[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int maxz = (int)((bmax[2]-chf.bmin[2])/chf.cs);
|
||||||
|
|
||||||
|
if (maxx < 0) return;
|
||||||
|
if (minx >= chf.width) return;
|
||||||
|
if (maxz < 0) return;
|
||||||
|
if (minz >= chf.height) return;
|
||||||
|
|
||||||
|
if (minx < 0) minx = 0;
|
||||||
|
if (maxx >= chf.width) maxx = chf.width-1;
|
||||||
|
if (minz < 0) minz = 0;
|
||||||
|
if (maxz >= chf.height) maxz = chf.height-1;
|
||||||
|
|
||||||
|
|
||||||
|
for (int z = minz; z <= maxz; ++z)
|
||||||
|
{
|
||||||
|
for (int x = minx; x <= maxx; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+z*chf.width];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
|
if (chf.areas[i] == RC_NULL_AREA)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((int)s.y >= miny && (int)s.y <= maxy)
|
||||||
|
{
|
||||||
|
const float sx = chf.bmin[0] + (x+0.5f)*chf.cs;
|
||||||
|
const float sz = chf.bmin[2] + (z+0.5f)*chf.cs;
|
||||||
|
const float dx = sx - pos[0];
|
||||||
|
const float dz = sz - pos[2];
|
||||||
|
|
||||||
|
if (dx*dx + dz*dz < r2)
|
||||||
|
{
|
||||||
|
chf.areas[i] = areaId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_MARK_CYLINDER_AREA);
|
||||||
|
}
|
||||||
851
KREngine/3rdparty/recast/source/RecastContour.cpp
vendored
Executable file
851
KREngine/3rdparty/recast/source/RecastContour.cpp
vendored
Executable file
@@ -0,0 +1,851 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int getCornerHeight(int x, int y, int i, int dir,
|
||||||
|
const rcCompactHeightfield& chf,
|
||||||
|
bool& isBorderVertex)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
int ch = (int)s.y;
|
||||||
|
int dirp = (dir+1) & 0x3;
|
||||||
|
|
||||||
|
unsigned int regs[4] = {0,0,0,0};
|
||||||
|
|
||||||
|
// Combine region and area codes in order to prevent
|
||||||
|
// border vertices which are in between two areas to be removed.
|
||||||
|
regs[0] = chf.spans[i].reg | (chf.areas[i] << 16);
|
||||||
|
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*chf.width].index + rcGetCon(s, dir);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
ch = rcMax(ch, (int)as.y);
|
||||||
|
regs[1] = chf.spans[ai].reg | (chf.areas[ai] << 16);
|
||||||
|
if (rcGetCon(as, dirp) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax2 = ax + rcGetDirOffsetX(dirp);
|
||||||
|
const int ay2 = ay + rcGetDirOffsetY(dirp);
|
||||||
|
const int ai2 = (int)chf.cells[ax2+ay2*chf.width].index + rcGetCon(as, dirp);
|
||||||
|
const rcCompactSpan& as2 = chf.spans[ai2];
|
||||||
|
ch = rcMax(ch, (int)as2.y);
|
||||||
|
regs[2] = chf.spans[ai2].reg | (chf.areas[ai2] << 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rcGetCon(s, dirp) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dirp);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dirp);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*chf.width].index + rcGetCon(s, dirp);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
ch = rcMax(ch, (int)as.y);
|
||||||
|
regs[3] = chf.spans[ai].reg | (chf.areas[ai] << 16);
|
||||||
|
if (rcGetCon(as, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax2 = ax + rcGetDirOffsetX(dir);
|
||||||
|
const int ay2 = ay + rcGetDirOffsetY(dir);
|
||||||
|
const int ai2 = (int)chf.cells[ax2+ay2*chf.width].index + rcGetCon(as, dir);
|
||||||
|
const rcCompactSpan& as2 = chf.spans[ai2];
|
||||||
|
ch = rcMax(ch, (int)as2.y);
|
||||||
|
regs[2] = chf.spans[ai2].reg | (chf.areas[ai2] << 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the vertex is special edge vertex, these vertices will be removed later.
|
||||||
|
for (int j = 0; j < 4; ++j)
|
||||||
|
{
|
||||||
|
const int a = j;
|
||||||
|
const int b = (j+1) & 0x3;
|
||||||
|
const int c = (j+2) & 0x3;
|
||||||
|
const int d = (j+3) & 0x3;
|
||||||
|
|
||||||
|
// The vertex is a border vertex there are two same exterior cells in a row,
|
||||||
|
// followed by two interior cells and none of the regions are out of bounds.
|
||||||
|
const bool twoSameExts = (regs[a] & regs[b] & RC_BORDER_REG) != 0 && regs[a] == regs[b];
|
||||||
|
const bool twoInts = ((regs[c] | regs[d]) & RC_BORDER_REG) == 0;
|
||||||
|
const bool intsSameArea = (regs[c]>>16) == (regs[d]>>16);
|
||||||
|
const bool noZeros = regs[a] != 0 && regs[b] != 0 && regs[c] != 0 && regs[d] != 0;
|
||||||
|
if (twoSameExts && twoInts && intsSameArea && noZeros)
|
||||||
|
{
|
||||||
|
isBorderVertex = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void walkContour(int x, int y, int i,
|
||||||
|
rcCompactHeightfield& chf,
|
||||||
|
unsigned char* flags, rcIntArray& points)
|
||||||
|
{
|
||||||
|
// Choose the first non-connected edge
|
||||||
|
unsigned char dir = 0;
|
||||||
|
while ((flags[i] & (1 << dir)) == 0)
|
||||||
|
dir++;
|
||||||
|
|
||||||
|
unsigned char startDir = dir;
|
||||||
|
int starti = i;
|
||||||
|
|
||||||
|
const unsigned char area = chf.areas[i];
|
||||||
|
|
||||||
|
int iter = 0;
|
||||||
|
while (++iter < 40000)
|
||||||
|
{
|
||||||
|
if (flags[i] & (1 << dir))
|
||||||
|
{
|
||||||
|
// Choose the edge corner
|
||||||
|
bool isBorderVertex = false;
|
||||||
|
bool isAreaBorder = false;
|
||||||
|
int px = x;
|
||||||
|
int py = getCornerHeight(x, y, i, dir, chf, isBorderVertex);
|
||||||
|
int pz = y;
|
||||||
|
switch(dir)
|
||||||
|
{
|
||||||
|
case 0: pz++; break;
|
||||||
|
case 1: px++; pz++; break;
|
||||||
|
case 2: px++; break;
|
||||||
|
}
|
||||||
|
int r = 0;
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*chf.width].index + rcGetCon(s, dir);
|
||||||
|
r = (int)chf.spans[ai].reg;
|
||||||
|
if (area != chf.areas[ai])
|
||||||
|
isAreaBorder = true;
|
||||||
|
}
|
||||||
|
if (isBorderVertex)
|
||||||
|
r |= RC_BORDER_VERTEX;
|
||||||
|
if (isAreaBorder)
|
||||||
|
r |= RC_AREA_BORDER;
|
||||||
|
points.push(px);
|
||||||
|
points.push(py);
|
||||||
|
points.push(pz);
|
||||||
|
points.push(r);
|
||||||
|
|
||||||
|
flags[i] &= ~(1 << dir); // Remove visited edges
|
||||||
|
dir = (dir+1) & 0x3; // Rotate CW
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int ni = -1;
|
||||||
|
const int nx = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ny = y + rcGetDirOffsetY(dir);
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const rcCompactCell& nc = chf.cells[nx+ny*chf.width];
|
||||||
|
ni = (int)nc.index + rcGetCon(s, dir);
|
||||||
|
}
|
||||||
|
if (ni == -1)
|
||||||
|
{
|
||||||
|
// Should not happen.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
x = nx;
|
||||||
|
y = ny;
|
||||||
|
i = ni;
|
||||||
|
dir = (dir+3) & 0x3; // Rotate CCW
|
||||||
|
}
|
||||||
|
|
||||||
|
if (starti == i && startDir == dir)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static float distancePtSeg(const int x, const int z,
|
||||||
|
const int px, const int pz,
|
||||||
|
const int qx, const int qz)
|
||||||
|
{
|
||||||
|
/* float pqx = (float)(qx - px);
|
||||||
|
float pqy = (float)(qy - py);
|
||||||
|
float pqz = (float)(qz - pz);
|
||||||
|
float dx = (float)(x - px);
|
||||||
|
float dy = (float)(y - py);
|
||||||
|
float dz = (float)(z - pz);
|
||||||
|
float d = pqx*pqx + pqy*pqy + pqz*pqz;
|
||||||
|
float t = pqx*dx + pqy*dy + pqz*dz;
|
||||||
|
if (d > 0)
|
||||||
|
t /= d;
|
||||||
|
if (t < 0)
|
||||||
|
t = 0;
|
||||||
|
else if (t > 1)
|
||||||
|
t = 1;
|
||||||
|
|
||||||
|
dx = px + t*pqx - x;
|
||||||
|
dy = py + t*pqy - y;
|
||||||
|
dz = pz + t*pqz - z;
|
||||||
|
|
||||||
|
return dx*dx + dy*dy + dz*dz;*/
|
||||||
|
|
||||||
|
float pqx = (float)(qx - px);
|
||||||
|
float pqz = (float)(qz - pz);
|
||||||
|
float dx = (float)(x - px);
|
||||||
|
float dz = (float)(z - pz);
|
||||||
|
float d = pqx*pqx + pqz*pqz;
|
||||||
|
float t = pqx*dx + pqz*dz;
|
||||||
|
if (d > 0)
|
||||||
|
t /= d;
|
||||||
|
if (t < 0)
|
||||||
|
t = 0;
|
||||||
|
else if (t > 1)
|
||||||
|
t = 1;
|
||||||
|
|
||||||
|
dx = px + t*pqx - x;
|
||||||
|
dz = pz + t*pqz - z;
|
||||||
|
|
||||||
|
return dx*dx + dz*dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||||
|
const float maxError, const int maxEdgeLen, const int buildFlags)
|
||||||
|
{
|
||||||
|
// Add initial points.
|
||||||
|
bool hasConnections = false;
|
||||||
|
for (int i = 0; i < points.size(); i += 4)
|
||||||
|
{
|
||||||
|
if ((points[i+3] & RC_CONTOUR_REG_MASK) != 0)
|
||||||
|
{
|
||||||
|
hasConnections = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasConnections)
|
||||||
|
{
|
||||||
|
// The contour has some portals to other regions.
|
||||||
|
// Add a new point to every location where the region changes.
|
||||||
|
for (int i = 0, ni = points.size()/4; i < ni; ++i)
|
||||||
|
{
|
||||||
|
int ii = (i+1) % ni;
|
||||||
|
const bool differentRegs = (points[i*4+3] & RC_CONTOUR_REG_MASK) != (points[ii*4+3] & RC_CONTOUR_REG_MASK);
|
||||||
|
const bool areaBorders = (points[i*4+3] & RC_AREA_BORDER) != (points[ii*4+3] & RC_AREA_BORDER);
|
||||||
|
if (differentRegs || areaBorders)
|
||||||
|
{
|
||||||
|
simplified.push(points[i*4+0]);
|
||||||
|
simplified.push(points[i*4+1]);
|
||||||
|
simplified.push(points[i*4+2]);
|
||||||
|
simplified.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (simplified.size() == 0)
|
||||||
|
{
|
||||||
|
// If there is no connections at all,
|
||||||
|
// create some initial points for the simplification process.
|
||||||
|
// Find lower-left and upper-right vertices of the contour.
|
||||||
|
int llx = points[0];
|
||||||
|
int lly = points[1];
|
||||||
|
int llz = points[2];
|
||||||
|
int lli = 0;
|
||||||
|
int urx = points[0];
|
||||||
|
int ury = points[1];
|
||||||
|
int urz = points[2];
|
||||||
|
int uri = 0;
|
||||||
|
for (int i = 0; i < points.size(); i += 4)
|
||||||
|
{
|
||||||
|
int x = points[i+0];
|
||||||
|
int y = points[i+1];
|
||||||
|
int z = points[i+2];
|
||||||
|
if (x < llx || (x == llx && z < llz))
|
||||||
|
{
|
||||||
|
llx = x;
|
||||||
|
lly = y;
|
||||||
|
llz = z;
|
||||||
|
lli = i/4;
|
||||||
|
}
|
||||||
|
if (x > urx || (x == urx && z > urz))
|
||||||
|
{
|
||||||
|
urx = x;
|
||||||
|
ury = y;
|
||||||
|
urz = z;
|
||||||
|
uri = i/4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
simplified.push(llx);
|
||||||
|
simplified.push(lly);
|
||||||
|
simplified.push(llz);
|
||||||
|
simplified.push(lli);
|
||||||
|
|
||||||
|
simplified.push(urx);
|
||||||
|
simplified.push(ury);
|
||||||
|
simplified.push(urz);
|
||||||
|
simplified.push(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add points until all raw points are within
|
||||||
|
// error tolerance to the simplified shape.
|
||||||
|
const int pn = points.size()/4;
|
||||||
|
for (int i = 0; i < simplified.size()/4; )
|
||||||
|
{
|
||||||
|
int ii = (i+1) % (simplified.size()/4);
|
||||||
|
|
||||||
|
const int ax = simplified[i*4+0];
|
||||||
|
const int az = simplified[i*4+2];
|
||||||
|
const int ai = simplified[i*4+3];
|
||||||
|
|
||||||
|
const int bx = simplified[ii*4+0];
|
||||||
|
const int bz = simplified[ii*4+2];
|
||||||
|
const int bi = simplified[ii*4+3];
|
||||||
|
|
||||||
|
// Find maximum deviation from the segment.
|
||||||
|
float maxd = 0;
|
||||||
|
int maxi = -1;
|
||||||
|
int ci, cinc, endi;
|
||||||
|
|
||||||
|
// Traverse the segment in lexilogical order so that the
|
||||||
|
// max deviation is calculated similarly when traversing
|
||||||
|
// opposite segments.
|
||||||
|
if (bx > ax || (bx == ax && bz > az))
|
||||||
|
{
|
||||||
|
cinc = 1;
|
||||||
|
ci = (ai+cinc) % pn;
|
||||||
|
endi = bi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cinc = pn-1;
|
||||||
|
ci = (bi+cinc) % pn;
|
||||||
|
endi = ai;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tessellate only outer edges or edges between areas.
|
||||||
|
if ((points[ci*4+3] & RC_CONTOUR_REG_MASK) == 0 ||
|
||||||
|
(points[ci*4+3] & RC_AREA_BORDER))
|
||||||
|
{
|
||||||
|
while (ci != endi)
|
||||||
|
{
|
||||||
|
float d = distancePtSeg(points[ci*4+0], points[ci*4+2], ax, az, bx, bz);
|
||||||
|
if (d > maxd)
|
||||||
|
{
|
||||||
|
maxd = d;
|
||||||
|
maxi = ci;
|
||||||
|
}
|
||||||
|
ci = (ci+cinc) % pn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If the max deviation is larger than accepted error,
|
||||||
|
// add new point, else continue to next segment.
|
||||||
|
if (maxi != -1 && maxd > (maxError*maxError))
|
||||||
|
{
|
||||||
|
// Add space for the new point.
|
||||||
|
simplified.resize(simplified.size()+4);
|
||||||
|
const int n = simplified.size()/4;
|
||||||
|
for (int j = n-1; j > i; --j)
|
||||||
|
{
|
||||||
|
simplified[j*4+0] = simplified[(j-1)*4+0];
|
||||||
|
simplified[j*4+1] = simplified[(j-1)*4+1];
|
||||||
|
simplified[j*4+2] = simplified[(j-1)*4+2];
|
||||||
|
simplified[j*4+3] = simplified[(j-1)*4+3];
|
||||||
|
}
|
||||||
|
// Add the point.
|
||||||
|
simplified[(i+1)*4+0] = points[maxi*4+0];
|
||||||
|
simplified[(i+1)*4+1] = points[maxi*4+1];
|
||||||
|
simplified[(i+1)*4+2] = points[maxi*4+2];
|
||||||
|
simplified[(i+1)*4+3] = maxi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split too long edges.
|
||||||
|
if (maxEdgeLen > 0 && (buildFlags & (RC_CONTOUR_TESS_WALL_EDGES|RC_CONTOUR_TESS_AREA_EDGES)) != 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < simplified.size()/4; )
|
||||||
|
{
|
||||||
|
const int ii = (i+1) % (simplified.size()/4);
|
||||||
|
|
||||||
|
const int ax = simplified[i*4+0];
|
||||||
|
const int az = simplified[i*4+2];
|
||||||
|
const int ai = simplified[i*4+3];
|
||||||
|
|
||||||
|
const int bx = simplified[ii*4+0];
|
||||||
|
const int bz = simplified[ii*4+2];
|
||||||
|
const int bi = simplified[ii*4+3];
|
||||||
|
|
||||||
|
// Find maximum deviation from the segment.
|
||||||
|
int maxi = -1;
|
||||||
|
int ci = (ai+1) % pn;
|
||||||
|
|
||||||
|
// Tessellate only outer edges or edges between areas.
|
||||||
|
bool tess = false;
|
||||||
|
// Wall edges.
|
||||||
|
if ((buildFlags & RC_CONTOUR_TESS_WALL_EDGES) && (points[ci*4+3] & RC_CONTOUR_REG_MASK) == 0)
|
||||||
|
tess = true;
|
||||||
|
// Edges between areas.
|
||||||
|
if ((buildFlags & RC_CONTOUR_TESS_AREA_EDGES) && (points[ci*4+3] & RC_AREA_BORDER))
|
||||||
|
tess = true;
|
||||||
|
|
||||||
|
if (tess)
|
||||||
|
{
|
||||||
|
int dx = bx - ax;
|
||||||
|
int dz = bz - az;
|
||||||
|
if (dx*dx + dz*dz > maxEdgeLen*maxEdgeLen)
|
||||||
|
{
|
||||||
|
// Round based on the segments in lexilogical order so that the
|
||||||
|
// max tesselation is consistent regardles in which direction
|
||||||
|
// segments are traversed.
|
||||||
|
const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
|
||||||
|
if (n > 1)
|
||||||
|
{
|
||||||
|
if (bx > ax || (bx == ax && bz > az))
|
||||||
|
maxi = (ai + n/2) % pn;
|
||||||
|
else
|
||||||
|
maxi = (ai + (n+1)/2) % pn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the max deviation is larger than accepted error,
|
||||||
|
// add new point, else continue to next segment.
|
||||||
|
if (maxi != -1)
|
||||||
|
{
|
||||||
|
// Add space for the new point.
|
||||||
|
simplified.resize(simplified.size()+4);
|
||||||
|
const int n = simplified.size()/4;
|
||||||
|
for (int j = n-1; j > i; --j)
|
||||||
|
{
|
||||||
|
simplified[j*4+0] = simplified[(j-1)*4+0];
|
||||||
|
simplified[j*4+1] = simplified[(j-1)*4+1];
|
||||||
|
simplified[j*4+2] = simplified[(j-1)*4+2];
|
||||||
|
simplified[j*4+3] = simplified[(j-1)*4+3];
|
||||||
|
}
|
||||||
|
// Add the point.
|
||||||
|
simplified[(i+1)*4+0] = points[maxi*4+0];
|
||||||
|
simplified[(i+1)*4+1] = points[maxi*4+1];
|
||||||
|
simplified[(i+1)*4+2] = points[maxi*4+2];
|
||||||
|
simplified[(i+1)*4+3] = maxi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < simplified.size()/4; ++i)
|
||||||
|
{
|
||||||
|
// The edge vertex flag is take from the current raw point,
|
||||||
|
// and the neighbour region is take from the next raw point.
|
||||||
|
const int ai = (simplified[i*4+3]+1) % pn;
|
||||||
|
const int bi = simplified[i*4+3];
|
||||||
|
simplified[i*4+3] = (points[ai*4+3] & (RC_CONTOUR_REG_MASK|RC_AREA_BORDER)) | (points[bi*4+3] & RC_BORDER_VERTEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void removeDegenerateSegments(rcIntArray& simplified)
|
||||||
|
{
|
||||||
|
// Remove adjacent vertices which are equal on xz-plane,
|
||||||
|
// or else the triangulator will get confused.
|
||||||
|
for (int i = 0; i < simplified.size()/4; ++i)
|
||||||
|
{
|
||||||
|
int ni = i+1;
|
||||||
|
if (ni >= (simplified.size()/4))
|
||||||
|
ni = 0;
|
||||||
|
|
||||||
|
if (simplified[i*4+0] == simplified[ni*4+0] &&
|
||||||
|
simplified[i*4+2] == simplified[ni*4+2])
|
||||||
|
{
|
||||||
|
// Degenerate segment, remove.
|
||||||
|
for (int j = i; j < simplified.size()/4-1; ++j)
|
||||||
|
{
|
||||||
|
simplified[j*4+0] = simplified[(j+1)*4+0];
|
||||||
|
simplified[j*4+1] = simplified[(j+1)*4+1];
|
||||||
|
simplified[j*4+2] = simplified[(j+1)*4+2];
|
||||||
|
simplified[j*4+3] = simplified[(j+1)*4+3];
|
||||||
|
}
|
||||||
|
simplified.resize(simplified.size()-4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int calcAreaOfPolygon2D(const int* verts, const int nverts)
|
||||||
|
{
|
||||||
|
int area = 0;
|
||||||
|
for (int i = 0, j = nverts-1; i < nverts; j=i++)
|
||||||
|
{
|
||||||
|
const int* vi = &verts[i*4];
|
||||||
|
const int* vj = &verts[j*4];
|
||||||
|
area += vi[0] * vj[2] - vj[0] * vi[2];
|
||||||
|
}
|
||||||
|
return (area+1) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool ileft(const int* a, const int* b, const int* c)
|
||||||
|
{
|
||||||
|
return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]) <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void getClosestIndices(const int* vertsa, const int nvertsa,
|
||||||
|
const int* vertsb, const int nvertsb,
|
||||||
|
int& ia, int& ib)
|
||||||
|
{
|
||||||
|
int closestDist = 0xfffffff;
|
||||||
|
ia = -1, ib = -1;
|
||||||
|
for (int i = 0; i < nvertsa; ++i)
|
||||||
|
{
|
||||||
|
const int in = (i+1) % nvertsa;
|
||||||
|
const int ip = (i+nvertsa-1) % nvertsa;
|
||||||
|
const int* va = &vertsa[i*4];
|
||||||
|
const int* van = &vertsa[in*4];
|
||||||
|
const int* vap = &vertsa[ip*4];
|
||||||
|
|
||||||
|
for (int j = 0; j < nvertsb; ++j)
|
||||||
|
{
|
||||||
|
const int* vb = &vertsb[j*4];
|
||||||
|
// vb must be "infront" of va.
|
||||||
|
if (ileft(vap,va,vb) && ileft(va,van,vb))
|
||||||
|
{
|
||||||
|
const int dx = vb[0] - va[0];
|
||||||
|
const int dz = vb[2] - va[2];
|
||||||
|
const int d = dx*dx + dz*dz;
|
||||||
|
if (d < closestDist)
|
||||||
|
{
|
||||||
|
ia = i;
|
||||||
|
ib = j;
|
||||||
|
closestDist = d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool mergeContours(rcContour& ca, rcContour& cb, int ia, int ib)
|
||||||
|
{
|
||||||
|
const int maxVerts = ca.nverts + cb.nverts + 2;
|
||||||
|
int* verts = (int*)rcAlloc(sizeof(int)*maxVerts*4, RC_ALLOC_PERM);
|
||||||
|
if (!verts)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int nv = 0;
|
||||||
|
|
||||||
|
// Copy contour A.
|
||||||
|
for (int i = 0; i <= ca.nverts; ++i)
|
||||||
|
{
|
||||||
|
int* dst = &verts[nv*4];
|
||||||
|
const int* src = &ca.verts[((ia+i)%ca.nverts)*4];
|
||||||
|
dst[0] = src[0];
|
||||||
|
dst[1] = src[1];
|
||||||
|
dst[2] = src[2];
|
||||||
|
dst[3] = src[3];
|
||||||
|
nv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy contour B
|
||||||
|
for (int i = 0; i <= cb.nverts; ++i)
|
||||||
|
{
|
||||||
|
int* dst = &verts[nv*4];
|
||||||
|
const int* src = &cb.verts[((ib+i)%cb.nverts)*4];
|
||||||
|
dst[0] = src[0];
|
||||||
|
dst[1] = src[1];
|
||||||
|
dst[2] = src[2];
|
||||||
|
dst[3] = src[3];
|
||||||
|
nv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rcFree(ca.verts);
|
||||||
|
ca.verts = verts;
|
||||||
|
ca.nverts = nv;
|
||||||
|
|
||||||
|
rcFree(cb.verts);
|
||||||
|
cb.verts = 0;
|
||||||
|
cb.nverts = 0;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// The raw contours will match the region outlines exactly. The @p maxError and @p maxEdgeLen
|
||||||
|
/// parameters control how closely the simplified contours will match the raw contours.
|
||||||
|
///
|
||||||
|
/// Simplified contours are generated such that the vertices for portals between areas match up.
|
||||||
|
/// (They are considered mandatory vertices.)
|
||||||
|
///
|
||||||
|
/// Setting @p maxEdgeLength to zero will disabled the edge length feature.
|
||||||
|
///
|
||||||
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
|
///
|
||||||
|
/// @see rcAllocContourSet, rcCompactHeightfield, rcContourSet, rcConfig
|
||||||
|
bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
|
const float maxError, const int maxEdgeLen,
|
||||||
|
rcContourSet& cset, const int buildFlags)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
const int w = chf.width;
|
||||||
|
const int h = chf.height;
|
||||||
|
const int borderSize = chf.borderSize;
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_CONTOURS);
|
||||||
|
|
||||||
|
rcVcopy(cset.bmin, chf.bmin);
|
||||||
|
rcVcopy(cset.bmax, chf.bmax);
|
||||||
|
if (borderSize > 0)
|
||||||
|
{
|
||||||
|
// If the heightfield was build with bordersize, remove the offset.
|
||||||
|
const float pad = borderSize*chf.cs;
|
||||||
|
cset.bmin[0] += pad;
|
||||||
|
cset.bmin[2] += pad;
|
||||||
|
cset.bmax[0] -= pad;
|
||||||
|
cset.bmax[2] -= pad;
|
||||||
|
}
|
||||||
|
cset.cs = chf.cs;
|
||||||
|
cset.ch = chf.ch;
|
||||||
|
cset.width = chf.width - chf.borderSize*2;
|
||||||
|
cset.height = chf.height - chf.borderSize*2;
|
||||||
|
cset.borderSize = chf.borderSize;
|
||||||
|
|
||||||
|
int maxContours = rcMax((int)chf.maxRegions, 8);
|
||||||
|
cset.conts = (rcContour*)rcAlloc(sizeof(rcContour)*maxContours, RC_ALLOC_PERM);
|
||||||
|
if (!cset.conts)
|
||||||
|
return false;
|
||||||
|
cset.nconts = 0;
|
||||||
|
|
||||||
|
rcScopedDelete<unsigned char> flags = (unsigned char*)rcAlloc(sizeof(unsigned char)*chf.spanCount, RC_ALLOC_TEMP);
|
||||||
|
if (!flags)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildContours: Out of memory 'flags' (%d).", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_CONTOURS_TRACE);
|
||||||
|
|
||||||
|
// Mark boundaries.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
unsigned char res = 0;
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (!chf.spans[i].reg || (chf.spans[i].reg & RC_BORDER_REG))
|
||||||
|
{
|
||||||
|
flags[i] = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
unsigned short r = 0;
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, dir);
|
||||||
|
r = chf.spans[ai].reg;
|
||||||
|
}
|
||||||
|
if (r == chf.spans[i].reg)
|
||||||
|
res |= (1 << dir);
|
||||||
|
}
|
||||||
|
flags[i] = res ^ 0xf; // Inverse, mark non connected edges.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_CONTOURS_TRACE);
|
||||||
|
|
||||||
|
rcIntArray verts(256);
|
||||||
|
rcIntArray simplified(64);
|
||||||
|
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
if (flags[i] == 0 || flags[i] == 0xf)
|
||||||
|
{
|
||||||
|
flags[i] = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const unsigned short reg = chf.spans[i].reg;
|
||||||
|
if (!reg || (reg & RC_BORDER_REG))
|
||||||
|
continue;
|
||||||
|
const unsigned char area = chf.areas[i];
|
||||||
|
|
||||||
|
verts.resize(0);
|
||||||
|
simplified.resize(0);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_CONTOURS_TRACE);
|
||||||
|
walkContour(x, y, i, chf, flags, verts);
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_CONTOURS_TRACE);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_CONTOURS_SIMPLIFY);
|
||||||
|
simplifyContour(verts, simplified, maxError, maxEdgeLen, buildFlags);
|
||||||
|
removeDegenerateSegments(simplified);
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_CONTOURS_SIMPLIFY);
|
||||||
|
|
||||||
|
|
||||||
|
// Store region->contour remap info.
|
||||||
|
// Create contour.
|
||||||
|
if (simplified.size()/4 >= 3)
|
||||||
|
{
|
||||||
|
if (cset.nconts >= maxContours)
|
||||||
|
{
|
||||||
|
// Allocate more contours.
|
||||||
|
// This can happen when there are tiny holes in the heightfield.
|
||||||
|
const int oldMax = maxContours;
|
||||||
|
maxContours *= 2;
|
||||||
|
rcContour* newConts = (rcContour*)rcAlloc(sizeof(rcContour)*maxContours, RC_ALLOC_PERM);
|
||||||
|
for (int j = 0; j < cset.nconts; ++j)
|
||||||
|
{
|
||||||
|
newConts[j] = cset.conts[j];
|
||||||
|
// Reset source pointers to prevent data deletion.
|
||||||
|
cset.conts[j].verts = 0;
|
||||||
|
cset.conts[j].rverts = 0;
|
||||||
|
}
|
||||||
|
rcFree(cset.conts);
|
||||||
|
cset.conts = newConts;
|
||||||
|
|
||||||
|
ctx->log(RC_LOG_WARNING, "rcBuildContours: Expanding max contours from %d to %d.", oldMax, maxContours);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcContour* cont = &cset.conts[cset.nconts++];
|
||||||
|
|
||||||
|
cont->nverts = simplified.size()/4;
|
||||||
|
cont->verts = (int*)rcAlloc(sizeof(int)*cont->nverts*4, RC_ALLOC_PERM);
|
||||||
|
if (!cont->verts)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildContours: Out of memory 'verts' (%d).", cont->nverts);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memcpy(cont->verts, &simplified[0], sizeof(int)*cont->nverts*4);
|
||||||
|
if (borderSize > 0)
|
||||||
|
{
|
||||||
|
// If the heightfield was build with bordersize, remove the offset.
|
||||||
|
for (int j = 0; j < cont->nverts; ++j)
|
||||||
|
{
|
||||||
|
int* v = &cont->verts[j*4];
|
||||||
|
v[0] -= borderSize;
|
||||||
|
v[2] -= borderSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cont->nrverts = verts.size()/4;
|
||||||
|
cont->rverts = (int*)rcAlloc(sizeof(int)*cont->nrverts*4, RC_ALLOC_PERM);
|
||||||
|
if (!cont->rverts)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildContours: Out of memory 'rverts' (%d).", cont->nrverts);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memcpy(cont->rverts, &verts[0], sizeof(int)*cont->nrverts*4);
|
||||||
|
if (borderSize > 0)
|
||||||
|
{
|
||||||
|
// If the heightfield was build with bordersize, remove the offset.
|
||||||
|
for (int j = 0; j < cont->nrverts; ++j)
|
||||||
|
{
|
||||||
|
int* v = &cont->rverts[j*4];
|
||||||
|
v[0] -= borderSize;
|
||||||
|
v[2] -= borderSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cont->cx = cont->cy = cont->cz = 0;
|
||||||
|
for (int i = 0; i < cont->nverts; ++i)
|
||||||
|
{
|
||||||
|
cont->cx += cont->verts[i*4+0];
|
||||||
|
cont->cy += cont->verts[i*4+1];
|
||||||
|
cont->cz += cont->verts[i*4+2];
|
||||||
|
}
|
||||||
|
cont->cx /= cont->nverts;
|
||||||
|
cont->cy /= cont->nverts;
|
||||||
|
cont->cz /= cont->nverts;*/
|
||||||
|
|
||||||
|
cont->reg = reg;
|
||||||
|
cont->area = area;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check and merge droppings.
|
||||||
|
// Sometimes the previous algorithms can fail and create several contours
|
||||||
|
// per area. This pass will try to merge the holes into the main region.
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
rcContour& cont = cset.conts[i];
|
||||||
|
// Check if the contour is would backwards.
|
||||||
|
if (calcAreaOfPolygon2D(cont.verts, cont.nverts) < 0)
|
||||||
|
{
|
||||||
|
// Find another contour which has the same region ID.
|
||||||
|
int mergeIdx = -1;
|
||||||
|
for (int j = 0; j < cset.nconts; ++j)
|
||||||
|
{
|
||||||
|
if (i == j) continue;
|
||||||
|
if (cset.conts[j].nverts && cset.conts[j].reg == cont.reg)
|
||||||
|
{
|
||||||
|
// Make sure the polygon is correctly oriented.
|
||||||
|
if (calcAreaOfPolygon2D(cset.conts[j].verts, cset.conts[j].nverts))
|
||||||
|
{
|
||||||
|
mergeIdx = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mergeIdx == -1)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_WARNING, "rcBuildContours: Could not find merge target for bad contour %d.", i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rcContour& mcont = cset.conts[mergeIdx];
|
||||||
|
// Merge by closest points.
|
||||||
|
int ia = 0, ib = 0;
|
||||||
|
getClosestIndices(mcont.verts, mcont.nverts, cont.verts, cont.nverts, ia, ib);
|
||||||
|
if (ia == -1 || ib == -1)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_WARNING, "rcBuildContours: Failed to find merge points for %d and %d.", i, mergeIdx);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!mergeContours(mcont, cont, ia, ib))
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_WARNING, "rcBuildContours: Failed to merge contours %d and %d.", i, mergeIdx);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_CONTOURS);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
207
KREngine/3rdparty/recast/source/RecastFilter.cpp
vendored
Executable file
207
KREngine/3rdparty/recast/source/RecastFilter.cpp
vendored
Executable file
@@ -0,0 +1,207 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Allows the formation of walkable regions that will flow over low lying
|
||||||
|
/// objects such as curbs, and up structures such as stairways.
|
||||||
|
///
|
||||||
|
/// Two neighboring spans are walkable if: <tt>rcAbs(currentSpan.smax - neighborSpan.smax) < waklableClimb</tt>
|
||||||
|
///
|
||||||
|
/// @warning Will override the effect of #rcFilterLedgeSpans. So if both filters are used, call
|
||||||
|
/// #rcFilterLedgeSpans after calling this filter.
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield, rcConfig
|
||||||
|
void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb, rcHeightfield& solid)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_FILTER_LOW_OBSTACLES);
|
||||||
|
|
||||||
|
const int w = solid.width;
|
||||||
|
const int h = solid.height;
|
||||||
|
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
rcSpan* ps = 0;
|
||||||
|
bool previousWalkable = false;
|
||||||
|
unsigned char previousArea = RC_NULL_AREA;
|
||||||
|
|
||||||
|
for (rcSpan* s = solid.spans[x + y*w]; s; ps = s, s = s->next)
|
||||||
|
{
|
||||||
|
const bool walkable = s->area != RC_NULL_AREA;
|
||||||
|
// If current span is not walkable, but there is walkable
|
||||||
|
// span just below it, mark the span above it walkable too.
|
||||||
|
if (!walkable && previousWalkable)
|
||||||
|
{
|
||||||
|
if (rcAbs((int)s->smax - (int)ps->smax) <= walkableClimb)
|
||||||
|
s->area = previousArea;
|
||||||
|
}
|
||||||
|
// Copy walkable flag so that it cannot propagate
|
||||||
|
// past multiple non-walkable objects.
|
||||||
|
previousWalkable = walkable;
|
||||||
|
previousArea = s->area;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_FILTER_LOW_OBSTACLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// A ledge is a span with one or more neighbors whose maximum is further away than @p walkableClimb
|
||||||
|
/// from the current span's maximum.
|
||||||
|
/// This method removes the impact of the overestimation of conservative voxelization
|
||||||
|
/// so the resulting mesh will not have regions hanging in the air over ledges.
|
||||||
|
///
|
||||||
|
/// A span is a ledge if: <tt>rcAbs(currentSpan.smax - neighborSpan.smax) > walkableClimb</tt>
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield, rcConfig
|
||||||
|
void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight, const int walkableClimb,
|
||||||
|
rcHeightfield& solid)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_FILTER_BORDER);
|
||||||
|
|
||||||
|
const int w = solid.width;
|
||||||
|
const int h = solid.height;
|
||||||
|
const int MAX_HEIGHT = 0xffff;
|
||||||
|
|
||||||
|
// Mark border spans.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
for (rcSpan* s = solid.spans[x + y*w]; s; s = s->next)
|
||||||
|
{
|
||||||
|
// Skip non walkable spans.
|
||||||
|
if (s->area == RC_NULL_AREA)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const int bot = (int)(s->smax);
|
||||||
|
const int top = s->next ? (int)(s->next->smin) : MAX_HEIGHT;
|
||||||
|
|
||||||
|
// Find neighbours minimum height.
|
||||||
|
int minh = MAX_HEIGHT;
|
||||||
|
|
||||||
|
// Min and max height of accessible neighbours.
|
||||||
|
int asmin = s->smax;
|
||||||
|
int asmax = s->smax;
|
||||||
|
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
int dx = x + rcGetDirOffsetX(dir);
|
||||||
|
int dy = y + rcGetDirOffsetY(dir);
|
||||||
|
// Skip neighbours which are out of bounds.
|
||||||
|
if (dx < 0 || dy < 0 || dx >= w || dy >= h)
|
||||||
|
{
|
||||||
|
minh = rcMin(minh, -walkableClimb - bot);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// From minus infinity to the first span.
|
||||||
|
rcSpan* ns = solid.spans[dx + dy*w];
|
||||||
|
int nbot = -walkableClimb;
|
||||||
|
int ntop = ns ? (int)ns->smin : MAX_HEIGHT;
|
||||||
|
// Skip neightbour if the gap between the spans is too small.
|
||||||
|
if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
|
||||||
|
minh = rcMin(minh, nbot - bot);
|
||||||
|
|
||||||
|
// Rest of the spans.
|
||||||
|
for (ns = solid.spans[dx + dy*w]; ns; ns = ns->next)
|
||||||
|
{
|
||||||
|
nbot = (int)ns->smax;
|
||||||
|
ntop = ns->next ? (int)ns->next->smin : MAX_HEIGHT;
|
||||||
|
// Skip neightbour if the gap between the spans is too small.
|
||||||
|
if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
|
||||||
|
{
|
||||||
|
minh = rcMin(minh, nbot - bot);
|
||||||
|
|
||||||
|
// Find min/max accessible neighbour height.
|
||||||
|
if (rcAbs(nbot - bot) <= walkableClimb)
|
||||||
|
{
|
||||||
|
if (nbot < asmin) asmin = nbot;
|
||||||
|
if (nbot > asmax) asmax = nbot;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The current span is close to a ledge if the drop to any
|
||||||
|
// neighbour span is less than the walkableClimb.
|
||||||
|
if (minh < -walkableClimb)
|
||||||
|
s->area = RC_NULL_AREA;
|
||||||
|
|
||||||
|
// If the difference between all neighbours is too large,
|
||||||
|
// we are at steep slope, mark the span as ledge.
|
||||||
|
if ((asmax - asmin) > walkableClimb)
|
||||||
|
{
|
||||||
|
s->area = RC_NULL_AREA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_FILTER_BORDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// For this filter, the clearance above the span is the distance from the span's
|
||||||
|
/// maximum to the next higher span's minimum. (Same grid column.)
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield, rcConfig
|
||||||
|
void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeightfield& solid)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_FILTER_WALKABLE);
|
||||||
|
|
||||||
|
const int w = solid.width;
|
||||||
|
const int h = solid.height;
|
||||||
|
const int MAX_HEIGHT = 0xffff;
|
||||||
|
|
||||||
|
// Remove walkable flag from spans which do not have enough
|
||||||
|
// space above them for the agent to stand there.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
for (rcSpan* s = solid.spans[x + y*w]; s; s = s->next)
|
||||||
|
{
|
||||||
|
const int bot = (int)(s->smax);
|
||||||
|
const int top = s->next ? (int)(s->next->smin) : MAX_HEIGHT;
|
||||||
|
if ((top - bot) <= walkableHeight)
|
||||||
|
s->area = RC_NULL_AREA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_FILTER_WALKABLE);
|
||||||
|
}
|
||||||
620
KREngine/3rdparty/recast/source/RecastLayers.cpp
vendored
Executable file
620
KREngine/3rdparty/recast/source/RecastLayers.cpp
vendored
Executable file
@@ -0,0 +1,620 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const int RC_MAX_LAYERS = RC_NOT_CONNECTED;
|
||||||
|
static const int RC_MAX_NEIS = 16;
|
||||||
|
|
||||||
|
struct rcLayerRegion
|
||||||
|
{
|
||||||
|
unsigned char layers[RC_MAX_LAYERS];
|
||||||
|
unsigned char neis[RC_MAX_NEIS];
|
||||||
|
unsigned short ymin, ymax;
|
||||||
|
unsigned char layerId; // Layer ID
|
||||||
|
unsigned char nlayers; // Layer count
|
||||||
|
unsigned char nneis; // Neighbour count
|
||||||
|
unsigned char base; // Flag indicating if the region is hte base of merged regions.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void addUnique(unsigned char* a, unsigned char& an, unsigned char v)
|
||||||
|
{
|
||||||
|
const int n = (int)an;
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
if (a[i] == v)
|
||||||
|
return;
|
||||||
|
a[an] = v;
|
||||||
|
an++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool contains(const unsigned char* a, const unsigned char an, const unsigned char v)
|
||||||
|
{
|
||||||
|
const int n = (int)an;
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
if (a[i] == v)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool overlapRange(const unsigned short amin, const unsigned short amax,
|
||||||
|
const unsigned short bmin, const unsigned short bmax)
|
||||||
|
{
|
||||||
|
return (amin > bmax || amax < bmin) ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct rcLayerSweepSpan
|
||||||
|
{
|
||||||
|
unsigned short ns; // number samples
|
||||||
|
unsigned char id; // region id
|
||||||
|
unsigned char nei; // neighbour id
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
|
///
|
||||||
|
/// @see rcAllocHeightfieldLayerSet, rcCompactHeightfield, rcHeightfieldLayerSet, rcConfig
|
||||||
|
bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
|
const int borderSize, const int walkableHeight,
|
||||||
|
rcHeightfieldLayerSet& lset)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_LAYERS);
|
||||||
|
|
||||||
|
const int w = chf.width;
|
||||||
|
const int h = chf.height;
|
||||||
|
|
||||||
|
rcScopedDelete<unsigned char> srcReg = (unsigned char*)rcAlloc(sizeof(unsigned char)*chf.spanCount, RC_ALLOC_TEMP);
|
||||||
|
if (!srcReg)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Out of memory 'srcReg' (%d).", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(srcReg,0xff,sizeof(unsigned char)*chf.spanCount);
|
||||||
|
|
||||||
|
const int nsweeps = chf.width;
|
||||||
|
rcScopedDelete<rcLayerSweepSpan> sweeps = (rcLayerSweepSpan*)rcAlloc(sizeof(rcLayerSweepSpan)*nsweeps, RC_ALLOC_TEMP);
|
||||||
|
if (!sweeps)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Out of memory 'sweeps' (%d).", nsweeps);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Partition walkable area into monotone regions.
|
||||||
|
int prevCount[256];
|
||||||
|
unsigned char regId = 0;
|
||||||
|
|
||||||
|
for (int y = borderSize; y < h-borderSize; ++y)
|
||||||
|
{
|
||||||
|
memset(prevCount,0,sizeof(int)*regId);
|
||||||
|
unsigned char sweepId = 0;
|
||||||
|
|
||||||
|
for (int x = borderSize; x < w-borderSize; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (chf.areas[i] == RC_NULL_AREA) continue;
|
||||||
|
|
||||||
|
unsigned char sid = 0xff;
|
||||||
|
|
||||||
|
// -x
|
||||||
|
if (rcGetCon(s, 0) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(0);
|
||||||
|
const int ay = y + rcGetDirOffsetY(0);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 0);
|
||||||
|
if (chf.areas[ai] != RC_NULL_AREA && srcReg[ai] != 0xff)
|
||||||
|
sid = srcReg[ai];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sid == 0xff)
|
||||||
|
{
|
||||||
|
sid = sweepId++;
|
||||||
|
sweeps[sid].nei = 0xff;
|
||||||
|
sweeps[sid].ns = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -y
|
||||||
|
if (rcGetCon(s,3) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(3);
|
||||||
|
const int ay = y + rcGetDirOffsetY(3);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 3);
|
||||||
|
const unsigned char nr = srcReg[ai];
|
||||||
|
if (nr != 0xff)
|
||||||
|
{
|
||||||
|
// Set neighbour when first valid neighbour is encoutered.
|
||||||
|
if (sweeps[sid].ns == 0)
|
||||||
|
sweeps[sid].nei = nr;
|
||||||
|
|
||||||
|
if (sweeps[sid].nei == nr)
|
||||||
|
{
|
||||||
|
// Update existing neighbour
|
||||||
|
sweeps[sid].ns++;
|
||||||
|
prevCount[nr]++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This is hit if there is nore than one neighbour.
|
||||||
|
// Invalidate the neighbour.
|
||||||
|
sweeps[sid].nei = 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
srcReg[i] = sid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create unique ID.
|
||||||
|
for (int i = 0; i < sweepId; ++i)
|
||||||
|
{
|
||||||
|
// If the neighbour is set and there is only one continuous connection to it,
|
||||||
|
// the sweep will be merged with the previous one, else new region is created.
|
||||||
|
if (sweeps[i].nei != 0xff && prevCount[sweeps[i].nei] == (int)sweeps[i].ns)
|
||||||
|
{
|
||||||
|
sweeps[i].id = sweeps[i].nei;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (regId == 255)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Region ID overflow.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sweeps[i].id = regId++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remap local sweep ids to region ids.
|
||||||
|
for (int x = borderSize; x < w-borderSize; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
if (srcReg[i] != 0xff)
|
||||||
|
srcReg[i] = sweeps[srcReg[i]].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allocate and init layer regions.
|
||||||
|
const int nregs = (int)regId;
|
||||||
|
rcScopedDelete<rcLayerRegion> regs = (rcLayerRegion*)rcAlloc(sizeof(rcLayerRegion)*nregs, RC_ALLOC_TEMP);
|
||||||
|
if (!regs)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Out of memory 'regs' (%d).", nregs);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(regs, 0, sizeof(rcLayerRegion)*nregs);
|
||||||
|
for (int i = 0; i < nregs; ++i)
|
||||||
|
{
|
||||||
|
regs[i].layerId = 0xff;
|
||||||
|
regs[i].ymin = 0xffff;
|
||||||
|
regs[i].ymax = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find region neighbours and overlapping regions.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
|
||||||
|
unsigned char lregs[RC_MAX_LAYERS];
|
||||||
|
int nlregs = 0;
|
||||||
|
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
const unsigned char ri = srcReg[i];
|
||||||
|
if (ri == 0xff) continue;
|
||||||
|
|
||||||
|
regs[ri].ymin = rcMin(regs[ri].ymin, s.y);
|
||||||
|
regs[ri].ymax = rcMax(regs[ri].ymax, s.y);
|
||||||
|
|
||||||
|
// Collect all region layers.
|
||||||
|
if (nlregs < RC_MAX_LAYERS)
|
||||||
|
lregs[nlregs++] = ri;
|
||||||
|
|
||||||
|
// Update neighbours
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, dir);
|
||||||
|
const unsigned char rai = srcReg[ai];
|
||||||
|
if (rai != 0xff && rai != ri)
|
||||||
|
addUnique(regs[ri].neis, regs[ri].nneis, rai);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update overlapping regions.
|
||||||
|
for (int i = 0; i < nlregs-1; ++i)
|
||||||
|
{
|
||||||
|
for (int j = i+1; j < nlregs; ++j)
|
||||||
|
{
|
||||||
|
if (lregs[i] != lregs[j])
|
||||||
|
{
|
||||||
|
rcLayerRegion& ri = regs[lregs[i]];
|
||||||
|
rcLayerRegion& rj = regs[lregs[j]];
|
||||||
|
addUnique(ri.layers, ri.nlayers, lregs[j]);
|
||||||
|
addUnique(rj.layers, rj.nlayers, lregs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create 2D layers from regions.
|
||||||
|
unsigned char layerId = 0;
|
||||||
|
|
||||||
|
static const int MAX_STACK = 64;
|
||||||
|
unsigned char stack[MAX_STACK];
|
||||||
|
int nstack = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < nregs; ++i)
|
||||||
|
{
|
||||||
|
rcLayerRegion& root = regs[i];
|
||||||
|
// Skip alreadu visited.
|
||||||
|
if (root.layerId != 0xff)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Start search.
|
||||||
|
root.layerId = layerId;
|
||||||
|
root.base = 1;
|
||||||
|
|
||||||
|
nstack = 0;
|
||||||
|
stack[nstack++] = (unsigned char)i;
|
||||||
|
|
||||||
|
while (nstack)
|
||||||
|
{
|
||||||
|
// Pop front
|
||||||
|
rcLayerRegion& reg = regs[stack[0]];
|
||||||
|
nstack--;
|
||||||
|
for (int j = 0; j < nstack; ++j)
|
||||||
|
stack[j] = stack[j+1];
|
||||||
|
|
||||||
|
const int nneis = (int)reg.nneis;
|
||||||
|
for (int j = 0; j < nneis; ++j)
|
||||||
|
{
|
||||||
|
const unsigned char nei = reg.neis[j];
|
||||||
|
rcLayerRegion& regn = regs[nei];
|
||||||
|
// Skip already visited.
|
||||||
|
if (regn.layerId != 0xff)
|
||||||
|
continue;
|
||||||
|
// Skip if the neighbour is overlapping root region.
|
||||||
|
if (contains(root.layers, root.nlayers, nei))
|
||||||
|
continue;
|
||||||
|
// Skip if the height range would become too large.
|
||||||
|
const int ymin = rcMin(root.ymin, regn.ymin);
|
||||||
|
const int ymax = rcMax(root.ymax, regn.ymax);
|
||||||
|
if ((ymax - ymin) >= 255)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (nstack < MAX_STACK)
|
||||||
|
{
|
||||||
|
// Deepen
|
||||||
|
stack[nstack++] = (unsigned char)nei;
|
||||||
|
|
||||||
|
// Mark layer id
|
||||||
|
regn.layerId = layerId;
|
||||||
|
// Merge current layers to root.
|
||||||
|
for (int k = 0; k < regn.nlayers; ++k)
|
||||||
|
addUnique(root.layers, root.nlayers, regn.layers[k]);
|
||||||
|
root.ymin = rcMin(root.ymin, regn.ymin);
|
||||||
|
root.ymax = rcMax(root.ymax, regn.ymax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layerId++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge non-overlapping regions that are close in height.
|
||||||
|
const unsigned short mergeHeight = (unsigned short)walkableHeight * 4;
|
||||||
|
|
||||||
|
for (int i = 0; i < nregs; ++i)
|
||||||
|
{
|
||||||
|
rcLayerRegion& ri = regs[i];
|
||||||
|
if (!ri.base) continue;
|
||||||
|
|
||||||
|
unsigned char newId = ri.layerId;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
unsigned char oldId = 0xff;
|
||||||
|
|
||||||
|
for (int j = 0; j < nregs; ++j)
|
||||||
|
{
|
||||||
|
if (i == j) continue;
|
||||||
|
rcLayerRegion& rj = regs[j];
|
||||||
|
if (!rj.base) continue;
|
||||||
|
|
||||||
|
// Skip if teh regions are not close to each other.
|
||||||
|
if (!overlapRange(ri.ymin,ri.ymax+mergeHeight, rj.ymin,rj.ymax+mergeHeight))
|
||||||
|
continue;
|
||||||
|
// Skip if the height range would become too large.
|
||||||
|
const int ymin = rcMin(ri.ymin, rj.ymin);
|
||||||
|
const int ymax = rcMax(ri.ymax, rj.ymax);
|
||||||
|
if ((ymax - ymin) >= 255)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Make sure that there is no overlap when mergin 'ri' and 'rj'.
|
||||||
|
bool overlap = false;
|
||||||
|
// Iterate over all regions which have the same layerId as 'rj'
|
||||||
|
for (int k = 0; k < nregs; ++k)
|
||||||
|
{
|
||||||
|
if (regs[k].layerId != rj.layerId)
|
||||||
|
continue;
|
||||||
|
// Check if region 'k' is overlapping region 'ri'
|
||||||
|
// Index to 'regs' is the same as region id.
|
||||||
|
if (contains(ri.layers,ri.nlayers, (unsigned char)k))
|
||||||
|
{
|
||||||
|
overlap = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Cannot merge of regions overlap.
|
||||||
|
if (overlap)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Can merge i and j.
|
||||||
|
oldId = rj.layerId;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Could not find anything to merge with, stop.
|
||||||
|
if (oldId == 0xff)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Merge
|
||||||
|
for (int j = 0; j < nregs; ++j)
|
||||||
|
{
|
||||||
|
rcLayerRegion& rj = regs[j];
|
||||||
|
if (rj.layerId == oldId)
|
||||||
|
{
|
||||||
|
rj.base = 0;
|
||||||
|
// Remap layerIds.
|
||||||
|
rj.layerId = newId;
|
||||||
|
// Add overlaid layers from 'rj' to 'ri'.
|
||||||
|
for (int k = 0; k < rj.nlayers; ++k)
|
||||||
|
addUnique(ri.layers, ri.nlayers, rj.layers[k]);
|
||||||
|
// Update heigh bounds.
|
||||||
|
ri.ymin = rcMin(ri.ymin, rj.ymin);
|
||||||
|
ri.ymax = rcMax(ri.ymax, rj.ymax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compact layerIds
|
||||||
|
unsigned char remap[256];
|
||||||
|
memset(remap, 0, 256);
|
||||||
|
|
||||||
|
// Find number of unique layers.
|
||||||
|
layerId = 0;
|
||||||
|
for (int i = 0; i < nregs; ++i)
|
||||||
|
remap[regs[i].layerId] = 1;
|
||||||
|
for (int i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
if (remap[i])
|
||||||
|
remap[i] = layerId++;
|
||||||
|
else
|
||||||
|
remap[i] = 0xff;
|
||||||
|
}
|
||||||
|
// Remap ids.
|
||||||
|
for (int i = 0; i < nregs; ++i)
|
||||||
|
regs[i].layerId = remap[regs[i].layerId];
|
||||||
|
|
||||||
|
// No layers, return empty.
|
||||||
|
if (layerId == 0)
|
||||||
|
{
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_LAYERS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create layers.
|
||||||
|
rcAssert(lset.layers == 0);
|
||||||
|
|
||||||
|
const int lw = w - borderSize*2;
|
||||||
|
const int lh = h - borderSize*2;
|
||||||
|
|
||||||
|
// Build contracted bbox for layers.
|
||||||
|
float bmin[3], bmax[3];
|
||||||
|
rcVcopy(bmin, chf.bmin);
|
||||||
|
rcVcopy(bmax, chf.bmax);
|
||||||
|
bmin[0] += borderSize*chf.cs;
|
||||||
|
bmin[2] += borderSize*chf.cs;
|
||||||
|
bmax[0] -= borderSize*chf.cs;
|
||||||
|
bmax[2] -= borderSize*chf.cs;
|
||||||
|
|
||||||
|
lset.nlayers = (int)layerId;
|
||||||
|
|
||||||
|
lset.layers = (rcHeightfieldLayer*)rcAlloc(sizeof(rcHeightfieldLayer)*lset.nlayers, RC_ALLOC_PERM);
|
||||||
|
if (!lset.layers)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Out of memory 'layers' (%d).", lset.nlayers);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(lset.layers, 0, sizeof(rcHeightfieldLayer)*lset.nlayers);
|
||||||
|
|
||||||
|
|
||||||
|
// Store layers.
|
||||||
|
for (int i = 0; i < lset.nlayers; ++i)
|
||||||
|
{
|
||||||
|
unsigned char curId = (unsigned char)i;
|
||||||
|
|
||||||
|
// Allocate memory for the current layer.
|
||||||
|
rcHeightfieldLayer* layer = &lset.layers[i];
|
||||||
|
memset(layer, 0, sizeof(rcHeightfieldLayer));
|
||||||
|
|
||||||
|
const int gridSize = sizeof(unsigned char)*lw*lh;
|
||||||
|
|
||||||
|
layer->heights = (unsigned char*)rcAlloc(gridSize, RC_ALLOC_PERM);
|
||||||
|
if (!layer->heights)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Out of memory 'heights' (%d).", gridSize);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(layer->heights, 0xff, gridSize);
|
||||||
|
|
||||||
|
layer->areas = (unsigned char*)rcAlloc(gridSize, RC_ALLOC_PERM);
|
||||||
|
if (!layer->areas)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Out of memory 'areas' (%d).", gridSize);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(layer->areas, 0, gridSize);
|
||||||
|
|
||||||
|
layer->cons = (unsigned char*)rcAlloc(gridSize, RC_ALLOC_PERM);
|
||||||
|
if (!layer->cons)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Out of memory 'cons' (%d).", gridSize);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(layer->cons, 0, gridSize);
|
||||||
|
|
||||||
|
// Find layer height bounds.
|
||||||
|
int hmin = 0, hmax = 0;
|
||||||
|
for (int j = 0; j < nregs; ++j)
|
||||||
|
{
|
||||||
|
if (regs[j].base && regs[j].layerId == curId)
|
||||||
|
{
|
||||||
|
hmin = (int)regs[j].ymin;
|
||||||
|
hmax = (int)regs[j].ymax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layer->width = lw;
|
||||||
|
layer->height = lh;
|
||||||
|
layer->cs = chf.cs;
|
||||||
|
layer->ch = chf.ch;
|
||||||
|
|
||||||
|
// Adjust the bbox to fit the heighfield.
|
||||||
|
rcVcopy(layer->bmin, bmin);
|
||||||
|
rcVcopy(layer->bmax, bmax);
|
||||||
|
layer->bmin[1] = bmin[1] + hmin*chf.ch;
|
||||||
|
layer->bmax[1] = bmin[1] + hmax*chf.ch;
|
||||||
|
layer->hmin = hmin;
|
||||||
|
layer->hmax = hmax;
|
||||||
|
|
||||||
|
// Update usable data region.
|
||||||
|
layer->minx = layer->width;
|
||||||
|
layer->maxx = 0;
|
||||||
|
layer->miny = layer->height;
|
||||||
|
layer->maxy = 0;
|
||||||
|
|
||||||
|
// Copy height and area from compact heighfield.
|
||||||
|
for (int y = 0; y < lh; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < lw; ++x)
|
||||||
|
{
|
||||||
|
const int cx = borderSize+x;
|
||||||
|
const int cy = borderSize+y;
|
||||||
|
const rcCompactCell& c = chf.cells[cx+cy*w];
|
||||||
|
for (int j = (int)c.index, nj = (int)(c.index+c.count); j < nj; ++j)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[j];
|
||||||
|
// Skip unassigned regions.
|
||||||
|
if (srcReg[j] == 0xff)
|
||||||
|
continue;
|
||||||
|
// Skip of does nto belong to current layer.
|
||||||
|
unsigned char lid = regs[srcReg[j]].layerId;
|
||||||
|
if (lid != curId)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Update data bounds.
|
||||||
|
layer->minx = rcMin(layer->minx, x);
|
||||||
|
layer->maxx = rcMax(layer->maxx, x);
|
||||||
|
layer->miny = rcMin(layer->miny, y);
|
||||||
|
layer->maxy = rcMax(layer->maxy, y);
|
||||||
|
|
||||||
|
// Store height and area type.
|
||||||
|
const int idx = x+y*lw;
|
||||||
|
layer->heights[idx] = (unsigned char)(s.y - hmin);
|
||||||
|
layer->areas[idx] = chf.areas[j];
|
||||||
|
|
||||||
|
// Check connection.
|
||||||
|
unsigned char portal = 0;
|
||||||
|
unsigned char con = 0;
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = cx + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = cy + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, dir);
|
||||||
|
unsigned char alid = srcReg[ai] != 0xff ? regs[srcReg[ai]].layerId : 0xff;
|
||||||
|
// Portal mask
|
||||||
|
if (chf.areas[ai] != RC_NULL_AREA && lid != alid)
|
||||||
|
{
|
||||||
|
portal |= (unsigned char)(1<<dir);
|
||||||
|
// Update height so that it matches on both sides of the portal.
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
if (as.y > hmin)
|
||||||
|
layer->heights[idx] = rcMax(layer->heights[idx], (unsigned char)(as.y - hmin));
|
||||||
|
}
|
||||||
|
// Valid connection mask
|
||||||
|
if (chf.areas[ai] != RC_NULL_AREA && lid == alid)
|
||||||
|
{
|
||||||
|
const int nx = ax - borderSize;
|
||||||
|
const int ny = ay - borderSize;
|
||||||
|
if (nx >= 0 && ny >= 0 && nx < lw && ny < lh)
|
||||||
|
con |= (unsigned char)(1<<dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layer->cons[idx] = (portal << 4) | con;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (layer->minx > layer->maxx)
|
||||||
|
layer->minx = layer->maxx = 0;
|
||||||
|
if (layer->miny > layer->maxy)
|
||||||
|
layer->miny = layer->maxy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_LAYERS);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
1433
KREngine/3rdparty/recast/source/RecastMesh.cpp
vendored
Executable file
1433
KREngine/3rdparty/recast/source/RecastMesh.cpp
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1245
KREngine/3rdparty/recast/source/RecastMeshDetail.cpp
vendored
Executable file
1245
KREngine/3rdparty/recast/source/RecastMeshDetail.cpp
vendored
Executable file
File diff suppressed because it is too large
Load Diff
387
KREngine/3rdparty/recast/source/RecastRasterization.cpp
vendored
Executable file
387
KREngine/3rdparty/recast/source/RecastRasterization.cpp
vendored
Executable file
@@ -0,0 +1,387 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would be
|
||||||
|
// appreciated but is not required.
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
// misrepresented as being the original software.
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
inline bool overlapBounds(const float* amin, const float* amax, const float* bmin, const float* bmax)
|
||||||
|
{
|
||||||
|
bool overlap = true;
|
||||||
|
overlap = (amin[0] > bmax[0] || amax[0] < bmin[0]) ? false : overlap;
|
||||||
|
overlap = (amin[1] > bmax[1] || amax[1] < bmin[1]) ? false : overlap;
|
||||||
|
overlap = (amin[2] > bmax[2] || amax[2] < bmin[2]) ? false : overlap;
|
||||||
|
return overlap;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool overlapInterval(unsigned short amin, unsigned short amax,
|
||||||
|
unsigned short bmin, unsigned short bmax)
|
||||||
|
{
|
||||||
|
if (amax < bmin) return false;
|
||||||
|
if (amin > bmax) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static rcSpan* allocSpan(rcHeightfield& hf)
|
||||||
|
{
|
||||||
|
// If running out of memory, allocate new page and update the freelist.
|
||||||
|
if (!hf.freelist || !hf.freelist->next)
|
||||||
|
{
|
||||||
|
// Create new page.
|
||||||
|
// Allocate memory for the new pool.
|
||||||
|
rcSpanPool* pool = (rcSpanPool*)rcAlloc(sizeof(rcSpanPool), RC_ALLOC_PERM);
|
||||||
|
if (!pool) return 0;
|
||||||
|
pool->next = 0;
|
||||||
|
// Add the pool into the list of pools.
|
||||||
|
pool->next = hf.pools;
|
||||||
|
hf.pools = pool;
|
||||||
|
// Add new items to the free list.
|
||||||
|
rcSpan* freelist = hf.freelist;
|
||||||
|
rcSpan* head = &pool->items[0];
|
||||||
|
rcSpan* it = &pool->items[RC_SPANS_PER_POOL];
|
||||||
|
do
|
||||||
|
{
|
||||||
|
--it;
|
||||||
|
it->next = freelist;
|
||||||
|
freelist = it;
|
||||||
|
}
|
||||||
|
while (it != head);
|
||||||
|
hf.freelist = it;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pop item from in front of the free list.
|
||||||
|
rcSpan* it = hf.freelist;
|
||||||
|
hf.freelist = hf.freelist->next;
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void freeSpan(rcHeightfield& hf, rcSpan* ptr)
|
||||||
|
{
|
||||||
|
if (!ptr) return;
|
||||||
|
// Add the node in front of the free list.
|
||||||
|
ptr->next = hf.freelist;
|
||||||
|
hf.freelist = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void addSpan(rcHeightfield& hf, const int x, const int y,
|
||||||
|
const unsigned short smin, const unsigned short smax,
|
||||||
|
const unsigned char area, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
|
||||||
|
int idx = x + y*hf.width;
|
||||||
|
|
||||||
|
rcSpan* s = allocSpan(hf);
|
||||||
|
s->smin = smin;
|
||||||
|
s->smax = smax;
|
||||||
|
s->area = area;
|
||||||
|
s->next = 0;
|
||||||
|
|
||||||
|
// Empty cell, add he first span.
|
||||||
|
if (!hf.spans[idx])
|
||||||
|
{
|
||||||
|
hf.spans[idx] = s;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rcSpan* prev = 0;
|
||||||
|
rcSpan* cur = hf.spans[idx];
|
||||||
|
|
||||||
|
// Insert and merge spans.
|
||||||
|
while (cur)
|
||||||
|
{
|
||||||
|
if (cur->smin > s->smax)
|
||||||
|
{
|
||||||
|
// Current span is further than the new span, break.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (cur->smax < s->smin)
|
||||||
|
{
|
||||||
|
// Current span is before the new span advance.
|
||||||
|
prev = cur;
|
||||||
|
cur = cur->next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Merge spans.
|
||||||
|
if (cur->smin < s->smin)
|
||||||
|
s->smin = cur->smin;
|
||||||
|
if (cur->smax > s->smax)
|
||||||
|
s->smax = cur->smax;
|
||||||
|
|
||||||
|
// Merge flags.
|
||||||
|
if (rcAbs((int)s->smax - (int)cur->smax) <= flagMergeThr)
|
||||||
|
s->area = rcMax(s->area, cur->area);
|
||||||
|
|
||||||
|
// Remove current span.
|
||||||
|
rcSpan* next = cur->next;
|
||||||
|
freeSpan(hf, cur);
|
||||||
|
if (prev)
|
||||||
|
prev->next = next;
|
||||||
|
else
|
||||||
|
hf.spans[idx] = next;
|
||||||
|
cur = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert new span.
|
||||||
|
if (prev)
|
||||||
|
{
|
||||||
|
s->next = prev->next;
|
||||||
|
prev->next = s;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s->next = hf.spans[idx];
|
||||||
|
hf.spans[idx] = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// The span addition can be set to favor flags. If the span is merged to
|
||||||
|
/// another span and the new @p smax is within @p flagMergeThr units
|
||||||
|
/// from the existing span, the span flags are merged.
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield, rcSpan.
|
||||||
|
void rcAddSpan(rcContext* /*ctx*/, rcHeightfield& hf, const int x, const int y,
|
||||||
|
const unsigned short smin, const unsigned short smax,
|
||||||
|
const unsigned char area, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
// rcAssert(ctx);
|
||||||
|
addSpan(hf, x,y, smin, smax, area, flagMergeThr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int clipPoly(const float* in, int n, float* out, float pnx, float pnz, float pd)
|
||||||
|
{
|
||||||
|
float d[12];
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
d[i] = pnx*in[i*3+0] + pnz*in[i*3+2] + pd;
|
||||||
|
|
||||||
|
int m = 0;
|
||||||
|
for (int i = 0, j = n-1; i < n; j=i, ++i)
|
||||||
|
{
|
||||||
|
bool ina = d[j] >= 0;
|
||||||
|
bool inb = d[i] >= 0;
|
||||||
|
if (ina != inb)
|
||||||
|
{
|
||||||
|
float s = d[j] / (d[j] - d[i]);
|
||||||
|
out[m*3+0] = in[j*3+0] + (in[i*3+0] - in[j*3+0])*s;
|
||||||
|
out[m*3+1] = in[j*3+1] + (in[i*3+1] - in[j*3+1])*s;
|
||||||
|
out[m*3+2] = in[j*3+2] + (in[i*3+2] - in[j*3+2])*s;
|
||||||
|
m++;
|
||||||
|
}
|
||||||
|
if (inb)
|
||||||
|
{
|
||||||
|
out[m*3+0] = in[i*3+0];
|
||||||
|
out[m*3+1] = in[i*3+1];
|
||||||
|
out[m*3+2] = in[i*3+2];
|
||||||
|
m++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rasterizeTri(const float* v0, const float* v1, const float* v2,
|
||||||
|
const unsigned char area, rcHeightfield& hf,
|
||||||
|
const float* bmin, const float* bmax,
|
||||||
|
const float cs, const float ics, const float ich,
|
||||||
|
const int flagMergeThr)
|
||||||
|
{
|
||||||
|
const int w = hf.width;
|
||||||
|
const int h = hf.height;
|
||||||
|
float tmin[3], tmax[3];
|
||||||
|
const float by = bmax[1] - bmin[1];
|
||||||
|
|
||||||
|
// Calculate the bounding box of the triangle.
|
||||||
|
rcVcopy(tmin, v0);
|
||||||
|
rcVcopy(tmax, v0);
|
||||||
|
rcVmin(tmin, v1);
|
||||||
|
rcVmin(tmin, v2);
|
||||||
|
rcVmax(tmax, v1);
|
||||||
|
rcVmax(tmax, v2);
|
||||||
|
|
||||||
|
// If the triangle does not touch the bbox of the heightfield, skip the triagle.
|
||||||
|
if (!overlapBounds(bmin, bmax, tmin, tmax))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Calculate the footpring of the triangle on the grid.
|
||||||
|
int x0 = (int)((tmin[0] - bmin[0])*ics);
|
||||||
|
int y0 = (int)((tmin[2] - bmin[2])*ics);
|
||||||
|
int x1 = (int)((tmax[0] - bmin[0])*ics);
|
||||||
|
int y1 = (int)((tmax[2] - bmin[2])*ics);
|
||||||
|
x0 = rcClamp(x0, 0, w-1);
|
||||||
|
y0 = rcClamp(y0, 0, h-1);
|
||||||
|
x1 = rcClamp(x1, 0, w-1);
|
||||||
|
y1 = rcClamp(y1, 0, h-1);
|
||||||
|
|
||||||
|
// Clip the triangle into all grid cells it touches.
|
||||||
|
float in[7*3], out[7*3], inrow[7*3];
|
||||||
|
|
||||||
|
for (int y = y0; y <= y1; ++y)
|
||||||
|
{
|
||||||
|
// Clip polygon to row.
|
||||||
|
rcVcopy(&in[0], v0);
|
||||||
|
rcVcopy(&in[1*3], v1);
|
||||||
|
rcVcopy(&in[2*3], v2);
|
||||||
|
int nvrow = 3;
|
||||||
|
const float cz = bmin[2] + y*cs;
|
||||||
|
nvrow = clipPoly(in, nvrow, out, 0, 1, -cz);
|
||||||
|
if (nvrow < 3) continue;
|
||||||
|
nvrow = clipPoly(out, nvrow, inrow, 0, -1, cz+cs);
|
||||||
|
if (nvrow < 3) continue;
|
||||||
|
|
||||||
|
for (int x = x0; x <= x1; ++x)
|
||||||
|
{
|
||||||
|
// Clip polygon to column.
|
||||||
|
int nv = nvrow;
|
||||||
|
const float cx = bmin[0] + x*cs;
|
||||||
|
nv = clipPoly(inrow, nv, out, 1, 0, -cx);
|
||||||
|
if (nv < 3) continue;
|
||||||
|
nv = clipPoly(out, nv, in, -1, 0, cx+cs);
|
||||||
|
if (nv < 3) continue;
|
||||||
|
|
||||||
|
// Calculate min and max of the span.
|
||||||
|
float smin = in[1], smax = in[1];
|
||||||
|
for (int i = 1; i < nv; ++i)
|
||||||
|
{
|
||||||
|
smin = rcMin(smin, in[i*3+1]);
|
||||||
|
smax = rcMax(smax, in[i*3+1]);
|
||||||
|
}
|
||||||
|
smin -= bmin[1];
|
||||||
|
smax -= bmin[1];
|
||||||
|
// Skip the span if it is outside the heightfield bbox
|
||||||
|
if (smax < 0.0f) continue;
|
||||||
|
if (smin > by) continue;
|
||||||
|
// Clamp the span to the heightfield bbox.
|
||||||
|
if (smin < 0.0f) smin = 0;
|
||||||
|
if (smax > by) smax = by;
|
||||||
|
|
||||||
|
// Snap the span to the heightfield height grid.
|
||||||
|
unsigned short ismin = (unsigned short)rcClamp((int)floorf(smin * ich), 0, RC_SPAN_MAX_HEIGHT);
|
||||||
|
unsigned short ismax = (unsigned short)rcClamp((int)ceilf(smax * ich), (int)ismin+1, RC_SPAN_MAX_HEIGHT);
|
||||||
|
|
||||||
|
addSpan(hf, x, y, ismin, ismax, area, flagMergeThr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// No spans will be added if the triangle does not overlap the heightfield grid.
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield
|
||||||
|
void rcRasterizeTriangle(rcContext* ctx, const float* v0, const float* v1, const float* v2,
|
||||||
|
const unsigned char area, rcHeightfield& solid,
|
||||||
|
const int flagMergeThr)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
rasterizeTri(v0, v1, v2, area, solid, solid.bmin, solid.bmax, solid.cs, ics, ich, flagMergeThr);
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Spans will only be added for triangles that overlap the heightfield grid.
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int /*nv*/,
|
||||||
|
const int* tris, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
// Rasterize triangles.
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const float* v0 = &verts[tris[i*3+0]*3];
|
||||||
|
const float* v1 = &verts[tris[i*3+1]*3];
|
||||||
|
const float* v2 = &verts[tris[i*3+2]*3];
|
||||||
|
// Rasterize.
|
||||||
|
rasterizeTri(v0, v1, v2, areas[i], solid, solid.bmin, solid.bmax, solid.cs, ics, ich, flagMergeThr);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Spans will only be added for triangles that overlap the heightfield grid.
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int /*nv*/,
|
||||||
|
const unsigned short* tris, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
// Rasterize triangles.
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const float* v0 = &verts[tris[i*3+0]*3];
|
||||||
|
const float* v1 = &verts[tris[i*3+1]*3];
|
||||||
|
const float* v2 = &verts[tris[i*3+2]*3];
|
||||||
|
// Rasterize.
|
||||||
|
rasterizeTri(v0, v1, v2, areas[i], solid, solid.bmin, solid.bmax, solid.cs, ics, ich, flagMergeThr);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @par
|
||||||
|
///
|
||||||
|
/// Spans will only be added for triangles that overlap the heightfield grid.
|
||||||
|
///
|
||||||
|
/// @see rcHeightfield
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
// Rasterize triangles.
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const float* v0 = &verts[(i*3+0)*3];
|
||||||
|
const float* v1 = &verts[(i*3+1)*3];
|
||||||
|
const float* v2 = &verts[(i*3+2)*3];
|
||||||
|
// Rasterize.
|
||||||
|
rasterizeTri(v0, v1, v2, areas[i], solid, solid.bmin, solid.bmax, solid.cs, ics, ich, flagMergeThr);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
}
|
||||||
1337
KREngine/3rdparty/recast/source/RecastRegion.cpp
vendored
Executable file
1337
KREngine/3rdparty/recast/source/RecastRegion.cpp
vendored
Executable file
File diff suppressed because it is too large
Load Diff
@@ -44,6 +44,32 @@
|
|||||||
E416AA9A16713749000F6786 /* KRAnimationCurveManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E416AA9816713749000F6786 /* KRAnimationCurveManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
E416AA9A16713749000F6786 /* KRAnimationCurveManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E416AA9816713749000F6786 /* KRAnimationCurveManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
E416AA9C1671375C000F6786 /* KRAnimationCurveManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416AA9B1671375C000F6786 /* KRAnimationCurveManager.cpp */; };
|
E416AA9C1671375C000F6786 /* KRAnimationCurveManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416AA9B1671375C000F6786 /* KRAnimationCurveManager.cpp */; };
|
||||||
E416AA9D1671375C000F6786 /* KRAnimationCurveManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416AA9B1671375C000F6786 /* KRAnimationCurveManager.cpp */; };
|
E416AA9D1671375C000F6786 /* KRAnimationCurveManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416AA9B1671375C000F6786 /* KRAnimationCurveManager.cpp */; };
|
||||||
|
E416E4881879111300FC2EEB /* Recast.h in Headers */ = {isa = PBXBuildFile; fileRef = E416E4851879111300FC2EEB /* Recast.h */; };
|
||||||
|
E416E4891879111300FC2EEB /* Recast.h in Headers */ = {isa = PBXBuildFile; fileRef = E416E4851879111300FC2EEB /* Recast.h */; };
|
||||||
|
E416E48A1879111300FC2EEB /* RecastAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = E416E4861879111300FC2EEB /* RecastAlloc.h */; };
|
||||||
|
E416E48B1879111300FC2EEB /* RecastAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = E416E4861879111300FC2EEB /* RecastAlloc.h */; };
|
||||||
|
E416E48C1879111300FC2EEB /* RecastAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = E416E4871879111300FC2EEB /* RecastAssert.h */; };
|
||||||
|
E416E48D1879111300FC2EEB /* RecastAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = E416E4871879111300FC2EEB /* RecastAssert.h */; };
|
||||||
|
E416E4981879112700FC2EEB /* Recast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E48E1879112700FC2EEB /* Recast.cpp */; };
|
||||||
|
E416E4991879112700FC2EEB /* Recast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E48E1879112700FC2EEB /* Recast.cpp */; };
|
||||||
|
E416E49A1879112700FC2EEB /* RecastAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E48F1879112700FC2EEB /* RecastAlloc.cpp */; };
|
||||||
|
E416E49B1879112700FC2EEB /* RecastAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E48F1879112700FC2EEB /* RecastAlloc.cpp */; };
|
||||||
|
E416E49C1879112700FC2EEB /* RecastArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4901879112700FC2EEB /* RecastArea.cpp */; };
|
||||||
|
E416E49D1879112700FC2EEB /* RecastArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4901879112700FC2EEB /* RecastArea.cpp */; };
|
||||||
|
E416E49E1879112700FC2EEB /* RecastContour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4911879112700FC2EEB /* RecastContour.cpp */; };
|
||||||
|
E416E49F1879112700FC2EEB /* RecastContour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4911879112700FC2EEB /* RecastContour.cpp */; };
|
||||||
|
E416E4A01879112700FC2EEB /* RecastFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4921879112700FC2EEB /* RecastFilter.cpp */; };
|
||||||
|
E416E4A11879112700FC2EEB /* RecastFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4921879112700FC2EEB /* RecastFilter.cpp */; };
|
||||||
|
E416E4A21879112700FC2EEB /* RecastLayers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4931879112700FC2EEB /* RecastLayers.cpp */; };
|
||||||
|
E416E4A31879112700FC2EEB /* RecastLayers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4931879112700FC2EEB /* RecastLayers.cpp */; };
|
||||||
|
E416E4A41879112700FC2EEB /* RecastMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4941879112700FC2EEB /* RecastMesh.cpp */; };
|
||||||
|
E416E4A51879112700FC2EEB /* RecastMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4941879112700FC2EEB /* RecastMesh.cpp */; };
|
||||||
|
E416E4A61879112700FC2EEB /* RecastMeshDetail.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4951879112700FC2EEB /* RecastMeshDetail.cpp */; };
|
||||||
|
E416E4A71879112700FC2EEB /* RecastMeshDetail.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4951879112700FC2EEB /* RecastMeshDetail.cpp */; };
|
||||||
|
E416E4A81879112700FC2EEB /* RecastRasterization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4961879112700FC2EEB /* RecastRasterization.cpp */; };
|
||||||
|
E416E4A91879112700FC2EEB /* RecastRasterization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4961879112700FC2EEB /* RecastRasterization.cpp */; };
|
||||||
|
E416E4AA1879112700FC2EEB /* RecastRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4971879112700FC2EEB /* RecastRegion.cpp */; };
|
||||||
|
E416E4AB1879112700FC2EEB /* RecastRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E416E4971879112700FC2EEB /* RecastRegion.cpp */; };
|
||||||
E41843921678704000DBD6CF /* KRCollider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 104A335C1672D31B001C8BA6 /* KRCollider.cpp */; };
|
E41843921678704000DBD6CF /* KRCollider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 104A335C1672D31B001C8BA6 /* KRCollider.cpp */; };
|
||||||
E41B6BA816BE436100B510EB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41B6BA716BE436100B510EB /* CoreAudio.framework */; };
|
E41B6BA816BE436100B510EB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41B6BA716BE436100B510EB /* CoreAudio.framework */; };
|
||||||
E41B6BAA16BE437800B510EB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41B6BA916BE437800B510EB /* CoreAudio.framework */; };
|
E41B6BAA16BE437800B510EB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41B6BA916BE437800B510EB /* CoreAudio.framework */; };
|
||||||
@@ -112,6 +138,28 @@
|
|||||||
E45134B91746A4A300443C21 /* KRBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = E45134B51746A4A300443C21 /* KRBehavior.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
E45134B91746A4A300443C21 /* KRBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = E45134B51746A4A300443C21 /* KRBehavior.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
E459040416C30CC5002B00A0 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E459040316C30CC5002B00A0 /* AudioUnit.framework */; };
|
E459040416C30CC5002B00A0 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E459040316C30CC5002B00A0 /* AudioUnit.framework */; };
|
||||||
E459040616C30CD9002B00A0 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E459040516C30CD9002B00A0 /* AudioUnit.framework */; };
|
E459040616C30CD9002B00A0 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E459040516C30CD9002B00A0 /* AudioUnit.framework */; };
|
||||||
|
E45E03B118790DD1006DA23F /* PVRTArray.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03A418790DD1006DA23F /* PVRTArray.h */; };
|
||||||
|
E45E03B218790DD1006DA23F /* PVRTDecompress.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03A518790DD1006DA23F /* PVRTDecompress.h */; };
|
||||||
|
E45E03B318790DD1006DA23F /* PVRTError.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03A618790DD1006DA23F /* PVRTError.h */; };
|
||||||
|
E45E03B418790DD1006DA23F /* PVRTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03A718790DD1006DA23F /* PVRTexture.h */; };
|
||||||
|
E45E03B518790DD1006DA23F /* PVRTextureDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03A818790DD1006DA23F /* PVRTextureDefines.h */; };
|
||||||
|
E45E03B618790DD1006DA23F /* PVRTextureFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03A918790DD1006DA23F /* PVRTextureFormat.h */; };
|
||||||
|
E45E03B718790DD1006DA23F /* PVRTextureHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03AA18790DD1006DA23F /* PVRTextureHeader.h */; };
|
||||||
|
E45E03B818790DD1006DA23F /* PVRTextureUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03AB18790DD1006DA23F /* PVRTextureUtilities.h */; };
|
||||||
|
E45E03B918790DD1006DA23F /* PVRTextureVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03AC18790DD1006DA23F /* PVRTextureVersion.h */; };
|
||||||
|
E45E03BA18790DD1006DA23F /* PVRTGlobal.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03AD18790DD1006DA23F /* PVRTGlobal.h */; };
|
||||||
|
E45E03BB18790DD1006DA23F /* PVRTMap.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03AE18790DD1006DA23F /* PVRTMap.h */; };
|
||||||
|
E45E03BC18790DD1006DA23F /* PVRTString.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03AF18790DD1006DA23F /* PVRTString.h */; };
|
||||||
|
E45E03BD18790DD1006DA23F /* PVRTTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03B018790DD1006DA23F /* PVRTTexture.h */; };
|
||||||
|
E45E03C018790DF5006DA23F /* libPVRTexLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E45E03BF18790DF5006DA23F /* libPVRTexLib.a */; };
|
||||||
|
E45E03C718790EC0006DA23F /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45E03C418790EC0006DA23F /* tinyxml2.cpp */; };
|
||||||
|
E45E03C818790EC0006DA23F /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45E03C418790EC0006DA23F /* tinyxml2.cpp */; };
|
||||||
|
E45E03C918790EC0006DA23F /* tinyxml2.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03C518790EC0006DA23F /* tinyxml2.h */; };
|
||||||
|
E45E03CA18790EC0006DA23F /* tinyxml2.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03C518790EC0006DA23F /* tinyxml2.h */; };
|
||||||
|
E45E03CD18790EFF006DA23F /* forsyth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45E03CB18790EFF006DA23F /* forsyth.cpp */; };
|
||||||
|
E45E03CE18790EFF006DA23F /* forsyth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E45E03CB18790EFF006DA23F /* forsyth.cpp */; };
|
||||||
|
E45E03CF18790EFF006DA23F /* forsyth.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03CC18790EFF006DA23F /* forsyth.h */; };
|
||||||
|
E45E03D018790EFF006DA23F /* forsyth.h in Headers */ = {isa = PBXBuildFile; fileRef = E45E03CC18790EFF006DA23F /* forsyth.h */; };
|
||||||
E460292616681CFF00261BB9 /* KRTextureAnimated.h in Headers */ = {isa = PBXBuildFile; fileRef = E460292516681CFE00261BB9 /* KRTextureAnimated.h */; settings = {ATTRIBUTES = (); }; };
|
E460292616681CFF00261BB9 /* KRTextureAnimated.h in Headers */ = {isa = PBXBuildFile; fileRef = E460292516681CFE00261BB9 /* KRTextureAnimated.h */; settings = {ATTRIBUTES = (); }; };
|
||||||
E460292816681D1000261BB9 /* KRTextureAnimated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E460292716681D1000261BB9 /* KRTextureAnimated.cpp */; };
|
E460292816681D1000261BB9 /* KRTextureAnimated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E460292716681D1000261BB9 /* KRTextureAnimated.cpp */; };
|
||||||
E460292B16682BF700261BB9 /* libfbxsdk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E460292916682BD900261BB9 /* libfbxsdk.a */; };
|
E460292B16682BF700261BB9 /* libfbxsdk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E460292916682BD900261BB9 /* libfbxsdk.a */; };
|
||||||
@@ -139,10 +187,6 @@
|
|||||||
E468448217FFDF51001F1FA1 /* KRLocator.h in Headers */ = {isa = PBXBuildFile; fileRef = E468447E17FFDF51001F1FA1 /* KRLocator.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
E468448217FFDF51001F1FA1 /* KRLocator.h in Headers */ = {isa = PBXBuildFile; fileRef = E468447E17FFDF51001F1FA1 /* KRLocator.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
E46A6B6D1559E97D000DBD37 /* KRResource+blend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46A6B6C1559E97D000DBD37 /* KRResource+blend.cpp */; };
|
E46A6B6D1559E97D000DBD37 /* KRResource+blend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46A6B6C1559E97D000DBD37 /* KRResource+blend.cpp */; };
|
||||||
E46A6B701559EF0A000DBD37 /* KRResource+blend.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A6B6F1559EF0A000DBD37 /* KRResource+blend.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
E46A6B701559EF0A000DBD37 /* KRResource+blend.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A6B6F1559EF0A000DBD37 /* KRResource+blend.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
E46C214515364BC8009CABF3 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46C214215364BC8009CABF3 /* tinyxml2.cpp */; };
|
|
||||||
E46C214615364BC8009CABF3 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46C214215364BC8009CABF3 /* tinyxml2.cpp */; };
|
|
||||||
E46C214715364BC8009CABF3 /* tinyxml2.h in Headers */ = {isa = PBXBuildFile; fileRef = E46C214315364BC8009CABF3 /* tinyxml2.h */; settings = {ATTRIBUTES = (); }; };
|
|
||||||
E46C214815364BC8009CABF3 /* tinyxml2.h in Headers */ = {isa = PBXBuildFile; fileRef = E46C214315364BC8009CABF3 /* tinyxml2.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
E46C214B15364DEC009CABF3 /* KRSceneManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46C214A15364DEC009CABF3 /* KRSceneManager.cpp */; };
|
E46C214B15364DEC009CABF3 /* KRSceneManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46C214A15364DEC009CABF3 /* KRSceneManager.cpp */; };
|
||||||
E46C214C15364DEC009CABF3 /* KRSceneManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46C214A15364DEC009CABF3 /* KRSceneManager.cpp */; };
|
E46C214C15364DEC009CABF3 /* KRSceneManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46C214A15364DEC009CABF3 /* KRSceneManager.cpp */; };
|
||||||
E46DBE7F1512AF0200D59F86 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E46DBE7D1512AD4900D59F86 /* OpenGL.framework */; };
|
E46DBE7F1512AF0200D59F86 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E46DBE7D1512AD4900D59F86 /* OpenGL.framework */; };
|
||||||
@@ -350,7 +394,6 @@
|
|||||||
E4E6F6BE16BA5E0A00E410F8 /* volumetric_fog_downsampled_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F62816BA5D8300E410F8 /* volumetric_fog_downsampled_osx.vsh */; };
|
E4E6F6BE16BA5E0A00E410F8 /* volumetric_fog_downsampled_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F62816BA5D8300E410F8 /* volumetric_fog_downsampled_osx.vsh */; };
|
||||||
E4E6F6BF16BA5E0A00E410F8 /* volumetric_fog_osx.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F62916BA5D8300E410F8 /* volumetric_fog_osx.fsh */; };
|
E4E6F6BF16BA5E0A00E410F8 /* volumetric_fog_osx.fsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F62916BA5D8300E410F8 /* volumetric_fog_osx.fsh */; };
|
||||||
E4E6F6C016BA5E0A00E410F8 /* volumetric_fog_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F62A16BA5D8300E410F8 /* volumetric_fog_osx.vsh */; };
|
E4E6F6C016BA5E0A00E410F8 /* volumetric_fog_osx.vsh in Resources */ = {isa = PBXBuildFile; fileRef = E4E6F62A16BA5D8300E410F8 /* volumetric_fog_osx.vsh */; };
|
||||||
E4EC73B8171F32780065299F /* forsyth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FE6AAA16B21D7E0058B8CE /* forsyth.cpp */; };
|
|
||||||
E4EC73C11720B1FF0065299F /* KRVector4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4EC73BF1720B1FF0065299F /* KRVector4.cpp */; };
|
E4EC73C11720B1FF0065299F /* KRVector4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4EC73BF1720B1FF0065299F /* KRVector4.cpp */; };
|
||||||
E4EC73C21720B1FF0065299F /* KRVector4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4EC73BF1720B1FF0065299F /* KRVector4.cpp */; };
|
E4EC73C21720B1FF0065299F /* KRVector4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4EC73BF1720B1FF0065299F /* KRVector4.cpp */; };
|
||||||
E4EC73C31720B1FF0065299F /* KRVector4.h in Headers */ = {isa = PBXBuildFile; fileRef = E4EC73C01720B1FF0065299F /* KRVector4.h */; };
|
E4EC73C31720B1FF0065299F /* KRVector4.h in Headers */ = {isa = PBXBuildFile; fileRef = E4EC73C01720B1FF0065299F /* KRVector4.h */; };
|
||||||
@@ -391,9 +434,6 @@
|
|||||||
E4F97552153633EF00FD60B2 /* KRMaterialManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E491018413C99BDC0098455B /* KRMaterialManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
E4F97552153633EF00FD60B2 /* KRMaterialManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E491018413C99BDC0098455B /* KRMaterialManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
E4F975531536340000FD60B2 /* KRTexture2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E491018113C99BDC0098455B /* KRTexture2D.cpp */; };
|
E4F975531536340000FD60B2 /* KRTexture2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E491018113C99BDC0098455B /* KRTexture2D.cpp */; };
|
||||||
E4F975541536340400FD60B2 /* KRTexture2D.h in Headers */ = {isa = PBXBuildFile; fileRef = E491018613C99BDC0098455B /* KRTexture2D.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
E4F975541536340400FD60B2 /* KRTexture2D.h in Headers */ = {isa = PBXBuildFile; fileRef = E491018613C99BDC0098455B /* KRTexture2D.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
E4FE6AA816B21D660058B8CE /* forsyth.h in Headers */ = {isa = PBXBuildFile; fileRef = E4FE6AA716B21D660058B8CE /* forsyth.h */; settings = {ATTRIBUTES = (); }; };
|
|
||||||
E4FE6AA916B21D660058B8CE /* forsyth.h in Headers */ = {isa = PBXBuildFile; fileRef = E4FE6AA716B21D660058B8CE /* forsyth.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
E4FE6AAB16B21D7E0058B8CE /* forsyth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FE6AAA16B21D7E0058B8CE /* forsyth.cpp */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXBuildRule section */
|
/* Begin PBXBuildRule section */
|
||||||
@@ -411,7 +451,6 @@
|
|||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
104A335C1672D31B001C8BA6 /* KRCollider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = KRCollider.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
104A335C1672D31B001C8BA6 /* KRCollider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = KRCollider.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||||
104A335D1672D31C001C8BA6 /* KRCollider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRCollider.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
104A335D1672D31C001C8BA6 /* KRCollider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRCollider.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
10CC33A3168530A300BB9846 /* libPVRTexLib.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPVRTexLib.a; path = Utilities/PVRTexLib/MacOS/libPVRTexLib.a; sourceTree = PVRSDK; };
|
|
||||||
E4030E4B160A3CF000592648 /* KRStockGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRStockGeometry.h; sourceTree = "<group>"; };
|
E4030E4B160A3CF000592648 /* KRStockGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRStockGeometry.h; sourceTree = "<group>"; };
|
||||||
E404701E18695DD200F01F42 /* KRTextureKTX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRTextureKTX.cpp; sourceTree = "<group>"; };
|
E404701E18695DD200F01F42 /* KRTextureKTX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRTextureKTX.cpp; sourceTree = "<group>"; };
|
||||||
E404701F18695DD200F01F42 /* KRTextureKTX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRTextureKTX.h; sourceTree = "<group>"; };
|
E404701F18695DD200F01F42 /* KRTextureKTX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRTextureKTX.h; sourceTree = "<group>"; };
|
||||||
@@ -431,6 +470,19 @@
|
|||||||
E414F9AB1694DA37000B3D58 /* KRUnknown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRUnknown.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
E414F9AB1694DA37000B3D58 /* KRUnknown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRUnknown.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
E416AA9816713749000F6786 /* KRAnimationCurveManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRAnimationCurveManager.h; sourceTree = "<group>"; };
|
E416AA9816713749000F6786 /* KRAnimationCurveManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRAnimationCurveManager.h; sourceTree = "<group>"; };
|
||||||
E416AA9B1671375C000F6786 /* KRAnimationCurveManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRAnimationCurveManager.cpp; sourceTree = "<group>"; };
|
E416AA9B1671375C000F6786 /* KRAnimationCurveManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRAnimationCurveManager.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4851879111300FC2EEB /* Recast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Recast.h; sourceTree = "<group>"; };
|
||||||
|
E416E4861879111300FC2EEB /* RecastAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecastAlloc.h; sourceTree = "<group>"; };
|
||||||
|
E416E4871879111300FC2EEB /* RecastAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecastAssert.h; sourceTree = "<group>"; };
|
||||||
|
E416E48E1879112700FC2EEB /* Recast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Recast.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E48F1879112700FC2EEB /* RecastAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastAlloc.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4901879112700FC2EEB /* RecastArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastArea.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4911879112700FC2EEB /* RecastContour.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastContour.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4921879112700FC2EEB /* RecastFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastFilter.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4931879112700FC2EEB /* RecastLayers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastLayers.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4941879112700FC2EEB /* RecastMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastMesh.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4951879112700FC2EEB /* RecastMeshDetail.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastMeshDetail.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4961879112700FC2EEB /* RecastRasterization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastRasterization.cpp; sourceTree = "<group>"; };
|
||||||
|
E416E4971879112700FC2EEB /* RecastRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastRegion.cpp; sourceTree = "<group>"; };
|
||||||
E41AE1DD16B124CA00980428 /* font.tga */ = {isa = PBXFileReference; lastKnownFileType = file; path = font.tga; sourceTree = "<group>"; };
|
E41AE1DD16B124CA00980428 /* font.tga */ = {isa = PBXFileReference; lastKnownFileType = file; path = font.tga; sourceTree = "<group>"; };
|
||||||
E41B6BA716BE436100B510EB /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
|
E41B6BA716BE436100B510EB /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
|
||||||
E41B6BA916BE437800B510EB /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/CoreAudio.framework; sourceTree = DEVELOPER_DIR; };
|
E41B6BA916BE437800B510EB /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/CoreAudio.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
@@ -471,6 +523,25 @@
|
|||||||
E45134B51746A4A300443C21 /* KRBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRBehavior.h; sourceTree = "<group>"; };
|
E45134B51746A4A300443C21 /* KRBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRBehavior.h; sourceTree = "<group>"; };
|
||||||
E459040316C30CC5002B00A0 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AudioUnit.framework; sourceTree = DEVELOPER_DIR; };
|
E459040316C30CC5002B00A0 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AudioUnit.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
E459040516C30CD9002B00A0 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
|
E459040516C30CD9002B00A0 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
|
||||||
|
E45E03A418790DD1006DA23F /* PVRTArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTArray.h; sourceTree = "<group>"; };
|
||||||
|
E45E03A518790DD1006DA23F /* PVRTDecompress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTDecompress.h; sourceTree = "<group>"; };
|
||||||
|
E45E03A618790DD1006DA23F /* PVRTError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTError.h; sourceTree = "<group>"; };
|
||||||
|
E45E03A718790DD1006DA23F /* PVRTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTexture.h; sourceTree = "<group>"; };
|
||||||
|
E45E03A818790DD1006DA23F /* PVRTextureDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTextureDefines.h; sourceTree = "<group>"; };
|
||||||
|
E45E03A918790DD1006DA23F /* PVRTextureFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTextureFormat.h; sourceTree = "<group>"; };
|
||||||
|
E45E03AA18790DD1006DA23F /* PVRTextureHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTextureHeader.h; sourceTree = "<group>"; };
|
||||||
|
E45E03AB18790DD1006DA23F /* PVRTextureUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTextureUtilities.h; sourceTree = "<group>"; };
|
||||||
|
E45E03AC18790DD1006DA23F /* PVRTextureVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTextureVersion.h; sourceTree = "<group>"; };
|
||||||
|
E45E03AD18790DD1006DA23F /* PVRTGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTGlobal.h; sourceTree = "<group>"; };
|
||||||
|
E45E03AE18790DD1006DA23F /* PVRTMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTMap.h; sourceTree = "<group>"; };
|
||||||
|
E45E03AF18790DD1006DA23F /* PVRTString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTString.h; sourceTree = "<group>"; };
|
||||||
|
E45E03B018790DD1006DA23F /* PVRTTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRTTexture.h; sourceTree = "<group>"; };
|
||||||
|
E45E03BF18790DF5006DA23F /* libPVRTexLib.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libPVRTexLib.a; sourceTree = "<group>"; };
|
||||||
|
E45E03C318790EC0006DA23F /* tinyxml2_readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tinyxml2_readme.txt; sourceTree = "<group>"; };
|
||||||
|
E45E03C418790EC0006DA23F /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyxml2.cpp; sourceTree = "<group>"; };
|
||||||
|
E45E03C518790EC0006DA23F /* tinyxml2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyxml2.h; sourceTree = "<group>"; };
|
||||||
|
E45E03CB18790EFF006DA23F /* forsyth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = forsyth.cpp; sourceTree = "<group>"; };
|
||||||
|
E45E03CC18790EFF006DA23F /* forsyth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = forsyth.h; sourceTree = "<group>"; };
|
||||||
E460292516681CFE00261BB9 /* KRTextureAnimated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRTextureAnimated.h; sourceTree = "<group>"; };
|
E460292516681CFE00261BB9 /* KRTextureAnimated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRTextureAnimated.h; sourceTree = "<group>"; };
|
||||||
E460292716681D1000261BB9 /* KRTextureAnimated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRTextureAnimated.cpp; sourceTree = "<group>"; };
|
E460292716681D1000261BB9 /* KRTextureAnimated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRTextureAnimated.cpp; sourceTree = "<group>"; };
|
||||||
E460292916682BD900261BB9 /* libfbxsdk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfbxsdk.a; path = "../../FBX SDK/2014.2/lib/ios-i386/release/libfbxsdk.a"; sourceTree = FBXSDK; };
|
E460292916682BD900261BB9 /* libfbxsdk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfbxsdk.a; path = "../../FBX SDK/2014.2/lib/ios-i386/release/libfbxsdk.a"; sourceTree = FBXSDK; };
|
||||||
@@ -486,9 +557,6 @@
|
|||||||
E468447E17FFDF51001F1FA1 /* KRLocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRLocator.h; sourceTree = "<group>"; };
|
E468447E17FFDF51001F1FA1 /* KRLocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KRLocator.h; sourceTree = "<group>"; };
|
||||||
E46A6B6C1559E97D000DBD37 /* KRResource+blend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "KRResource+blend.cpp"; sourceTree = "<group>"; };
|
E46A6B6C1559E97D000DBD37 /* KRResource+blend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "KRResource+blend.cpp"; sourceTree = "<group>"; };
|
||||||
E46A6B6F1559EF0A000DBD37 /* KRResource+blend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KRResource+blend.h"; sourceTree = "<group>"; };
|
E46A6B6F1559EF0A000DBD37 /* KRResource+blend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KRResource+blend.h"; sourceTree = "<group>"; };
|
||||||
E46C214115364BC8009CABF3 /* tinyxml2_readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tinyxml2_readme.txt; sourceTree = "<group>"; };
|
|
||||||
E46C214215364BC8009CABF3 /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyxml2.cpp; sourceTree = "<group>"; };
|
|
||||||
E46C214315364BC8009CABF3 /* tinyxml2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyxml2.h; sourceTree = "<group>"; };
|
|
||||||
E46C214915364DDB009CABF3 /* KRSceneManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KRSceneManager.h; sourceTree = "<group>"; };
|
E46C214915364DDB009CABF3 /* KRSceneManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KRSceneManager.h; sourceTree = "<group>"; };
|
||||||
E46C214A15364DEC009CABF3 /* KRSceneManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRSceneManager.cpp; sourceTree = "<group>"; };
|
E46C214A15364DEC009CABF3 /* KRSceneManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRSceneManager.cpp; sourceTree = "<group>"; };
|
||||||
E46DBE7D1512AD4900D59F86 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = ../../../../MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
E46DBE7D1512AD4900D59F86 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = ../../../../MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
||||||
@@ -658,8 +726,6 @@
|
|||||||
E4F027F91698116000D4427D /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
|
E4F027F91698116000D4427D /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
|
||||||
E4F975311536220900FD60B2 /* KRNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRNode.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
E4F975311536220900FD60B2 /* KRNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = KRNode.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||||
E4F975351536221C00FD60B2 /* KRNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = KRNode.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
E4F975351536221C00FD60B2 /* KRNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = KRNode.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||||
E4FE6AA716B21D660058B8CE /* forsyth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = forsyth.h; sourceTree = "<group>"; };
|
|
||||||
E4FE6AAA16B21D7E0058B8CE /* forsyth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = forsyth.cpp; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -681,6 +747,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
E45E03C018790DF5006DA23F /* libPVRTexLib.a in Frameworks */,
|
||||||
E459040416C30CC5002B00A0 /* AudioUnit.framework in Frameworks */,
|
E459040416C30CC5002B00A0 /* AudioUnit.framework in Frameworks */,
|
||||||
E41B6BAA16BE437800B510EB /* CoreAudio.framework in Frameworks */,
|
E41B6BAA16BE437800B510EB /* CoreAudio.framework in Frameworks */,
|
||||||
E4F027F71698115600D4427D /* AudioToolbox.framework in Frameworks */,
|
E4F027F71698115600D4427D /* AudioToolbox.framework in Frameworks */,
|
||||||
@@ -736,6 +803,42 @@
|
|||||||
name = AnimationCurve;
|
name = AnimationCurve;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
E416E482187910DF00FC2EEB /* recast */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E416E484187910FB00FC2EEB /* include */,
|
||||||
|
E416E483187910ED00FC2EEB /* source */,
|
||||||
|
);
|
||||||
|
path = recast;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E416E483187910ED00FC2EEB /* source */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E416E48E1879112700FC2EEB /* Recast.cpp */,
|
||||||
|
E416E48F1879112700FC2EEB /* RecastAlloc.cpp */,
|
||||||
|
E416E4901879112700FC2EEB /* RecastArea.cpp */,
|
||||||
|
E416E4911879112700FC2EEB /* RecastContour.cpp */,
|
||||||
|
E416E4921879112700FC2EEB /* RecastFilter.cpp */,
|
||||||
|
E416E4931879112700FC2EEB /* RecastLayers.cpp */,
|
||||||
|
E416E4941879112700FC2EEB /* RecastMesh.cpp */,
|
||||||
|
E416E4951879112700FC2EEB /* RecastMeshDetail.cpp */,
|
||||||
|
E416E4961879112700FC2EEB /* RecastRasterization.cpp */,
|
||||||
|
E416E4971879112700FC2EEB /* RecastRegion.cpp */,
|
||||||
|
);
|
||||||
|
path = source;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E416E484187910FB00FC2EEB /* include */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E416E4851879111300FC2EEB /* Recast.h */,
|
||||||
|
E416E4861879111300FC2EEB /* RecastAlloc.h */,
|
||||||
|
E416E4871879111300FC2EEB /* RecastAssert.h */,
|
||||||
|
);
|
||||||
|
path = include;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
E41AE1DF16B125EC00980428 /* Shaders */ = {
|
E41AE1DF16B125EC00980428 /* Shaders */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -809,6 +912,73 @@
|
|||||||
path = kraken_standard_assets;
|
path = kraken_standard_assets;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
E45E03A118790D92006DA23F /* 3rdparty */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E416E482187910DF00FC2EEB /* recast */,
|
||||||
|
E45E03C218790E55006DA23F /* tinyxml2 */,
|
||||||
|
E45E03C118790E4F006DA23F /* forsyth */,
|
||||||
|
E45E03A218790DA3006DA23F /* pvrtexlib */,
|
||||||
|
);
|
||||||
|
path = 3rdparty;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E45E03A218790DA3006DA23F /* pvrtexlib */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E45E03BE18790DDB006DA23F /* static_osx */,
|
||||||
|
E45E03A318790DB8006DA23F /* include */,
|
||||||
|
);
|
||||||
|
path = pvrtexlib;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E45E03A318790DB8006DA23F /* include */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E45E03A418790DD1006DA23F /* PVRTArray.h */,
|
||||||
|
E45E03A518790DD1006DA23F /* PVRTDecompress.h */,
|
||||||
|
E45E03A618790DD1006DA23F /* PVRTError.h */,
|
||||||
|
E45E03A718790DD1006DA23F /* PVRTexture.h */,
|
||||||
|
E45E03A818790DD1006DA23F /* PVRTextureDefines.h */,
|
||||||
|
E45E03A918790DD1006DA23F /* PVRTextureFormat.h */,
|
||||||
|
E45E03AA18790DD1006DA23F /* PVRTextureHeader.h */,
|
||||||
|
E45E03AB18790DD1006DA23F /* PVRTextureUtilities.h */,
|
||||||
|
E45E03AC18790DD1006DA23F /* PVRTextureVersion.h */,
|
||||||
|
E45E03AD18790DD1006DA23F /* PVRTGlobal.h */,
|
||||||
|
E45E03AE18790DD1006DA23F /* PVRTMap.h */,
|
||||||
|
E45E03AF18790DD1006DA23F /* PVRTString.h */,
|
||||||
|
E45E03B018790DD1006DA23F /* PVRTTexture.h */,
|
||||||
|
);
|
||||||
|
path = include;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E45E03BE18790DDB006DA23F /* static_osx */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E45E03BF18790DF5006DA23F /* libPVRTexLib.a */,
|
||||||
|
);
|
||||||
|
path = static_osx;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E45E03C118790E4F006DA23F /* forsyth */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E45E03CB18790EFF006DA23F /* forsyth.cpp */,
|
||||||
|
E45E03CC18790EFF006DA23F /* forsyth.h */,
|
||||||
|
);
|
||||||
|
path = forsyth;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
E45E03C218790E55006DA23F /* tinyxml2 */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
E45E03C318790EC0006DA23F /* tinyxml2_readme.txt */,
|
||||||
|
E45E03C418790EC0006DA23F /* tinyxml2.cpp */,
|
||||||
|
E45E03C518790EC0006DA23F /* tinyxml2.h */,
|
||||||
|
);
|
||||||
|
path = tinyxml2;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
E461A170152E598200F2044A /* Resources */ = {
|
E461A170152E598200F2044A /* Resources */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -858,16 +1028,6 @@
|
|||||||
name = Math;
|
name = Math;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
E46C214015364BB8009CABF3 /* tinyxml2 */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
E46C214115364BC8009CABF3 /* tinyxml2_readme.txt */,
|
|
||||||
E46C214215364BC8009CABF3 /* tinyxml2.cpp */,
|
|
||||||
E46C214315364BC8009CABF3 /* tinyxml2.h */,
|
|
||||||
);
|
|
||||||
name = tinyxml2;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
E488399915F92BA300BD66D5 /* Managers */ = {
|
E488399915F92BA300BD66D5 /* Managers */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -1040,6 +1200,7 @@
|
|||||||
E491015613C99B9D0098455B = {
|
E491015613C99B9D0098455B = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
E45E03A118790D92006DA23F /* 3rdparty */,
|
||||||
E437849616C4881A0037FD43 /* kraken_standard_assets */,
|
E437849616C4881A0037FD43 /* kraken_standard_assets */,
|
||||||
E491016613C99B9E0098455B /* kraken */,
|
E491016613C99B9E0098455B /* kraken */,
|
||||||
E4C8E50C16B9B5ED0031DDCB /* kraken_ios */,
|
E4C8E50C16B9B5ED0031DDCB /* kraken_ios */,
|
||||||
@@ -1064,7 +1225,6 @@
|
|||||||
E491016613C99B9E0098455B /* kraken */ = {
|
E491016613C99B9E0098455B /* kraken */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
E4F9753815362A5200FD60B2 /* 3rdparty */,
|
|
||||||
E488399915F92BA300BD66D5 /* Managers */,
|
E488399915F92BA300BD66D5 /* Managers */,
|
||||||
E461A173152E59DF00F2044A /* Math */,
|
E461A173152E59DF00F2044A /* Math */,
|
||||||
E461A170152E598200F2044A /* Resources */,
|
E461A170152E598200F2044A /* Resources */,
|
||||||
@@ -1120,7 +1280,6 @@
|
|||||||
children = (
|
children = (
|
||||||
E459040316C30CC5002B00A0 /* AudioUnit.framework */,
|
E459040316C30CC5002B00A0 /* AudioUnit.framework */,
|
||||||
E41B6BA916BE437800B510EB /* CoreAudio.framework */,
|
E41B6BA916BE437800B510EB /* CoreAudio.framework */,
|
||||||
10CC33A3168530A300BB9846 /* libPVRTexLib.a */,
|
|
||||||
E460292916682BD900261BB9 /* libfbxsdk.a */,
|
E460292916682BD900261BB9 /* libfbxsdk.a */,
|
||||||
E4BBBB9A1512A48200F43B5B /* Foundation.framework */,
|
E4BBBB9A1512A48200F43B5B /* Foundation.framework */,
|
||||||
E46DBE7D1512AD4900D59F86 /* OpenGL.framework */,
|
E46DBE7D1512AD4900D59F86 /* OpenGL.framework */,
|
||||||
@@ -1219,24 +1378,6 @@
|
|||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
E4F9753815362A5200FD60B2 /* 3rdparty */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
E4FE6AA516B21D330058B8CE /* forsyth */,
|
|
||||||
E46C214015364BB8009CABF3 /* tinyxml2 */,
|
|
||||||
);
|
|
||||||
name = 3rdparty;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
E4FE6AA516B21D330058B8CE /* forsyth */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
E4FE6AA716B21D660058B8CE /* forsyth.h */,
|
|
||||||
E4FE6AAA16B21D7E0058B8CE /* forsyth.cpp */,
|
|
||||||
);
|
|
||||||
name = forsyth;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXHeadersBuildPhase section */
|
/* Begin PBXHeadersBuildPhase section */
|
||||||
@@ -1252,6 +1393,7 @@
|
|||||||
E491018A13C99BDC0098455B /* KREngine.h in Headers */,
|
E491018A13C99BDC0098455B /* KREngine.h in Headers */,
|
||||||
E491018E13C99BDC0098455B /* KRMat4.h in Headers */,
|
E491018E13C99BDC0098455B /* KRMat4.h in Headers */,
|
||||||
E491019B13C99BDC0098455B /* KRMeshManager.h in Headers */,
|
E491019B13C99BDC0098455B /* KRMeshManager.h in Headers */,
|
||||||
|
E416E48C1879111300FC2EEB /* RecastAssert.h in Headers */,
|
||||||
E491019213C99BDC0098455B /* KRMesh.h in Headers */,
|
E491019213C99BDC0098455B /* KRMesh.h in Headers */,
|
||||||
E491019613C99BDC0098455B /* KRVector3.h in Headers */,
|
E491019613C99BDC0098455B /* KRVector3.h in Headers */,
|
||||||
E47C25A213F4F65A00FF4370 /* KRShaderManager.h in Headers */,
|
E47C25A213F4F65A00FF4370 /* KRShaderManager.h in Headers */,
|
||||||
@@ -1260,6 +1402,7 @@
|
|||||||
E414BAE7143557D200A668C4 /* KRScene.h in Headers */,
|
E414BAE7143557D200A668C4 /* KRScene.h in Headers */,
|
||||||
E48B3CBD14393DF5000C50E2 /* KRCamera.h in Headers */,
|
E48B3CBD14393DF5000C50E2 /* KRCamera.h in Headers */,
|
||||||
E40F982E184A7A2700CFA4D8 /* KRMeshQuad.h in Headers */,
|
E40F982E184A7A2700CFA4D8 /* KRMeshQuad.h in Headers */,
|
||||||
|
E45E03CF18790EFF006DA23F /* forsyth.h in Headers */,
|
||||||
E497B94A151BCEE900D3DC67 /* KRResource.h in Headers */,
|
E497B94A151BCEE900D3DC67 /* KRResource.h in Headers */,
|
||||||
E461A152152E54B500F2044A /* KRLight.h in Headers */,
|
E461A152152E54B500F2044A /* KRLight.h in Headers */,
|
||||||
E461A15C152E563100F2044A /* KRDirectionalLight.h in Headers */,
|
E461A15C152E563100F2044A /* KRDirectionalLight.h in Headers */,
|
||||||
@@ -1267,7 +1410,6 @@
|
|||||||
E468448117FFDF51001F1FA1 /* KRLocator.h in Headers */,
|
E468448117FFDF51001F1FA1 /* KRLocator.h in Headers */,
|
||||||
E43F70E71824D9AB00136169 /* KRTextureStreamer.h in Headers */,
|
E43F70E71824D9AB00136169 /* KRTextureStreamer.h in Headers */,
|
||||||
E4F975321536220900FD60B2 /* KRNode.h in Headers */,
|
E4F975321536220900FD60B2 /* KRNode.h in Headers */,
|
||||||
E46C214715364BC8009CABF3 /* tinyxml2.h in Headers */,
|
|
||||||
E48C696F15374F5B00232E28 /* KRContext.h in Headers */,
|
E48C696F15374F5B00232E28 /* KRContext.h in Headers */,
|
||||||
E46F4A0B155E002100CCF8B8 /* KRDataBlock.h in Headers */,
|
E46F4A0B155E002100CCF8B8 /* KRDataBlock.h in Headers */,
|
||||||
E42CB1EC158446940066E0D8 /* KRQuaternion.h in Headers */,
|
E42CB1EC158446940066E0D8 /* KRQuaternion.h in Headers */,
|
||||||
@@ -1280,6 +1422,7 @@
|
|||||||
E488399E15F92BE000BD66D5 /* KRBundleManager.h in Headers */,
|
E488399E15F92BE000BD66D5 /* KRBundleManager.h in Headers */,
|
||||||
E4030E4C160A3CF000592648 /* KRStockGeometry.h in Headers */,
|
E4030E4C160A3CF000592648 /* KRStockGeometry.h in Headers */,
|
||||||
E4B175AE161F5A1000B8FB80 /* KRTexture.h in Headers */,
|
E4B175AE161F5A1000B8FB80 /* KRTexture.h in Headers */,
|
||||||
|
E416E48A1879111300FC2EEB /* RecastAlloc.h in Headers */,
|
||||||
E4B175B4161F5FAF00B8FB80 /* KRTextureCube.h in Headers */,
|
E4B175B4161F5FAF00B8FB80 /* KRTextureCube.h in Headers */,
|
||||||
E4CA10E51637BD0A005D9400 /* KRTexturePVR.h in Headers */,
|
E4CA10E51637BD0A005D9400 /* KRTexturePVR.h in Headers */,
|
||||||
E4CA10EC1637BD47005D9400 /* KRTextureTGA.h in Headers */,
|
E4CA10EC1637BD47005D9400 /* KRTextureTGA.h in Headers */,
|
||||||
@@ -1310,9 +1453,10 @@
|
|||||||
E499BF2016AE755B007FCDBE /* KRPointLight.h in Headers */,
|
E499BF2016AE755B007FCDBE /* KRPointLight.h in Headers */,
|
||||||
E499BF2116AE75A7007FCDBE /* KREngine-common.h in Headers */,
|
E499BF2116AE75A7007FCDBE /* KREngine-common.h in Headers */,
|
||||||
E404702218695DD200F01F42 /* KRTextureKTX.h in Headers */,
|
E404702218695DD200F01F42 /* KRTextureKTX.h in Headers */,
|
||||||
|
E45E03C918790EC0006DA23F /* tinyxml2.h in Headers */,
|
||||||
E4F027D016979CE200D4427D /* KRAudioSample.h in Headers */,
|
E4F027D016979CE200D4427D /* KRAudioSample.h in Headers */,
|
||||||
E450273B16E0491D00FDEC5C /* KRReverbZone.h in Headers */,
|
E450273B16E0491D00FDEC5C /* KRReverbZone.h in Headers */,
|
||||||
E4FE6AA816B21D660058B8CE /* forsyth.h in Headers */,
|
E416E4881879111300FC2EEB /* Recast.h in Headers */,
|
||||||
E4AE635F1704FB0A00B460CD /* KRLODGroup.h in Headers */,
|
E4AE635F1704FB0A00B460CD /* KRLODGroup.h in Headers */,
|
||||||
E4EC73C31720B1FF0065299F /* KRVector4.h in Headers */,
|
E4EC73C31720B1FF0065299F /* KRVector4.h in Headers */,
|
||||||
E48CF944173453990005EBBB /* KRFloat.h in Headers */,
|
E48CF944173453990005EBBB /* KRFloat.h in Headers */,
|
||||||
@@ -1325,11 +1469,14 @@
|
|||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
E45E03BD18790DD1006DA23F /* PVRTTexture.h in Headers */,
|
||||||
E497B948151BB89D00D3DC67 /* KRVector2.h in Headers */,
|
E497B948151BB89D00D3DC67 /* KRVector2.h in Headers */,
|
||||||
E4D0683F1512A790005FFBEB /* KRVector3.h in Headers */,
|
E4D0683F1512A790005FFBEB /* KRVector3.h in Headers */,
|
||||||
E461A177152E5C6600F2044A /* KRMat4.h in Headers */,
|
E461A177152E5C6600F2044A /* KRMat4.h in Headers */,
|
||||||
E4F975461536327C00FD60B2 /* KRMeshManager.h in Headers */,
|
E4F975461536327C00FD60B2 /* KRMeshManager.h in Headers */,
|
||||||
|
E45E03B618790DD1006DA23F /* PVRTextureFormat.h in Headers */,
|
||||||
E497B94B151BCEE900D3DC67 /* KRResource.h in Headers */,
|
E497B94B151BCEE900D3DC67 /* KRResource.h in Headers */,
|
||||||
|
E45E03B318790DD1006DA23F /* PVRTError.h in Headers */,
|
||||||
E43B0AD915DDCA0F00A5CB9F /* KRContextObject.h in Headers */,
|
E43B0AD915DDCA0F00A5CB9F /* KRContextObject.h in Headers */,
|
||||||
E4F975331536220900FD60B2 /* KRNode.h in Headers */,
|
E4F975331536220900FD60B2 /* KRNode.h in Headers */,
|
||||||
E4B2A4391523B027004CB0EC /* KRMaterial.h in Headers */,
|
E4B2A4391523B027004CB0EC /* KRMaterial.h in Headers */,
|
||||||
@@ -1341,6 +1488,7 @@
|
|||||||
E46DBE851512B9FA00D59F86 /* KREngine-common.h in Headers */,
|
E46DBE851512B9FA00D59F86 /* KREngine-common.h in Headers */,
|
||||||
E488399715F928CA00BD66D5 /* KRBundle.h in Headers */,
|
E488399715F928CA00BD66D5 /* KRBundle.h in Headers */,
|
||||||
E4F9754C153632F000FD60B2 /* KRCamera.h in Headers */,
|
E4F9754C153632F000FD60B2 /* KRCamera.h in Headers */,
|
||||||
|
E45E03BA18790DD1006DA23F /* PVRTGlobal.h in Headers */,
|
||||||
E4F975501536333500FD60B2 /* KRMesh.h in Headers */,
|
E4F975501536333500FD60B2 /* KRMesh.h in Headers */,
|
||||||
E488399F15F92BE000BD66D5 /* KRBundleManager.h in Headers */,
|
E488399F15F92BE000BD66D5 /* KRBundleManager.h in Headers */,
|
||||||
E4AFC6BC15F7C95D00DDB4C8 /* KRSceneManager.h in Headers */,
|
E4AFC6BC15F7C95D00DDB4C8 /* KRSceneManager.h in Headers */,
|
||||||
@@ -1354,47 +1502,59 @@
|
|||||||
E428C3051669627900A16EDF /* KRAnimationCurve.h in Headers */,
|
E428C3051669627900A16EDF /* KRAnimationCurve.h in Headers */,
|
||||||
E48C697015374F5B00232E28 /* KRContext.h in Headers */,
|
E48C697015374F5B00232E28 /* KRContext.h in Headers */,
|
||||||
E46F4A10155E004100CCF8B8 /* KRDataBlock.cpp in Headers */,
|
E46F4A10155E004100CCF8B8 /* KRDataBlock.cpp in Headers */,
|
||||||
E46C214815364BC8009CABF3 /* tinyxml2.h in Headers */,
|
E45E03B418790DD1006DA23F /* PVRTexture.h in Headers */,
|
||||||
E4D13365153767FF0070068C /* KRShaderManager.h in Headers */,
|
E4D13365153767FF0070068C /* KRShaderManager.h in Headers */,
|
||||||
E40BA45715EFF79500D7C3DD /* KRAABB.h in Headers */,
|
E40BA45715EFF79500D7C3DD /* KRAABB.h in Headers */,
|
||||||
E428C312166971FF00A16EDF /* KRAnimationLayer.h in Headers */,
|
E428C312166971FF00A16EDF /* KRAnimationLayer.h in Headers */,
|
||||||
E4AFC6B615F7C46800DDB4C8 /* KRAABB.cpp in Headers */,
|
E4AFC6B615F7C46800DDB4C8 /* KRAABB.cpp in Headers */,
|
||||||
|
E45E03B818790DD1006DA23F /* PVRTextureUtilities.h in Headers */,
|
||||||
E428C3171669A24B00A16EDF /* KRAnimationAttribute.h in Headers */,
|
E428C3171669A24B00A16EDF /* KRAnimationAttribute.h in Headers */,
|
||||||
E4AFC6BE15F7C9E600DDB4C8 /* KROctreeNode.h in Headers */,
|
E4AFC6BE15F7C9E600DDB4C8 /* KROctreeNode.h in Headers */,
|
||||||
|
E416E48D1879111300FC2EEB /* RecastAssert.h in Headers */,
|
||||||
|
E45E03B918790DD1006DA23F /* PVRTextureVersion.h in Headers */,
|
||||||
E4AFC6BD15F7C9DA00DDB4C8 /* KROctree.h in Headers */,
|
E4AFC6BD15F7C9DA00DDB4C8 /* KROctree.h in Headers */,
|
||||||
E46A6B701559EF0A000DBD37 /* KRResource+blend.h in Headers */,
|
E46A6B701559EF0A000DBD37 /* KRResource+blend.h in Headers */,
|
||||||
E416AA9A16713749000F6786 /* KRAnimationCurveManager.h in Headers */,
|
E416AA9A16713749000F6786 /* KRAnimationCurveManager.h in Headers */,
|
||||||
|
E416E4891879111300FC2EEB /* Recast.h in Headers */,
|
||||||
E42CB1ED158446940066E0D8 /* KRQuaternion.h in Headers */,
|
E42CB1ED158446940066E0D8 /* KRQuaternion.h in Headers */,
|
||||||
E4030E4D160A3CF000592648 /* KRStockGeometry.h in Headers */,
|
E4030E4D160A3CF000592648 /* KRStockGeometry.h in Headers */,
|
||||||
E4B175AF161F5A1000B8FB80 /* KRTexture.h in Headers */,
|
E4B175AF161F5A1000B8FB80 /* KRTexture.h in Headers */,
|
||||||
E480BE691671C641004EC8AD /* KRBone.h in Headers */,
|
E480BE691671C641004EC8AD /* KRBone.h in Headers */,
|
||||||
E4B175B5161F5FAF00B8FB80 /* KRTextureCube.h in Headers */,
|
E4B175B5161F5FAF00B8FB80 /* KRTextureCube.h in Headers */,
|
||||||
|
E45E03B118790DD1006DA23F /* PVRTArray.h in Headers */,
|
||||||
|
E45E03CA18790EC0006DA23F /* tinyxml2.h in Headers */,
|
||||||
E4CA10E61637BD0A005D9400 /* KRTexturePVR.h in Headers */,
|
E4CA10E61637BD0A005D9400 /* KRTexturePVR.h in Headers */,
|
||||||
E4CA10ED1637BD47005D9400 /* KRTextureTGA.h in Headers */,
|
E4CA10ED1637BD47005D9400 /* KRTextureTGA.h in Headers */,
|
||||||
|
E45E03D018790EFF006DA23F /* forsyth.h in Headers */,
|
||||||
E4CA11751639CBD6005D9400 /* KRViewport.h in Headers */,
|
E4CA11751639CBD6005D9400 /* KRViewport.h in Headers */,
|
||||||
E461A15D152E563100F2044A /* KRDirectionalLight.h in Headers */,
|
E461A15D152E563100F2044A /* KRDirectionalLight.h in Headers */,
|
||||||
E461A169152E570700F2044A /* KRSpotLight.h in Headers */,
|
E461A169152E570700F2044A /* KRSpotLight.h in Headers */,
|
||||||
|
E45E03B218790DD1006DA23F /* PVRTDecompress.h in Headers */,
|
||||||
E4C454B9167BD236003586CD /* KRHitInfo.h in Headers */,
|
E4C454B9167BD236003586CD /* KRHitInfo.h in Headers */,
|
||||||
E4324BA516444C0D0043185B /* KRParticleSystem.h in Headers */,
|
E4324BA516444C0D0043185B /* KRParticleSystem.h in Headers */,
|
||||||
E4324BAC16444DEF0043185B /* KRParticleSystemNewtonian.h in Headers */,
|
E4324BAC16444DEF0043185B /* KRParticleSystemNewtonian.h in Headers */,
|
||||||
|
E45E03B518790DD1006DA23F /* PVRTextureDefines.h in Headers */,
|
||||||
E4C454AD167BB8EC003586CD /* KRMeshCube.h in Headers */,
|
E4C454AD167BB8EC003586CD /* KRMeshCube.h in Headers */,
|
||||||
E404702318695DD200F01F42 /* KRTextureKTX.h in Headers */,
|
E404702318695DD200F01F42 /* KRTextureKTX.h in Headers */,
|
||||||
E414F9A91694D977000B3D58 /* KRUnknownManager.h in Headers */,
|
E414F9A91694D977000B3D58 /* KRUnknownManager.h in Headers */,
|
||||||
E48B68181697794F00D99917 /* KRAudioSource.h in Headers */,
|
E48B68181697794F00D99917 /* KRAudioSource.h in Headers */,
|
||||||
E4F027CA16979CCD00D4427D /* KRAudioManager.h in Headers */,
|
E4F027CA16979CCD00D4427D /* KRAudioManager.h in Headers */,
|
||||||
E4F027D116979CE200D4427D /* KRAudioSample.h in Headers */,
|
E4F027D116979CE200D4427D /* KRAudioSample.h in Headers */,
|
||||||
|
E45E03B718790DD1006DA23F /* PVRTextureHeader.h in Headers */,
|
||||||
E4F027E11697BFFF00D4427D /* KRAudioBuffer.h in Headers */,
|
E4F027E11697BFFF00D4427D /* KRAudioBuffer.h in Headers */,
|
||||||
E4943234169E08D200BCB891 /* KRAmbientZone.h in Headers */,
|
E4943234169E08D200BCB891 /* KRAmbientZone.h in Headers */,
|
||||||
E414F9AF1694DA37000B3D58 /* KRUnknown.h in Headers */,
|
E414F9AF1694DA37000B3D58 /* KRUnknown.h in Headers */,
|
||||||
E499BF2216AE760F007FCDBE /* krengine_osx.h in Headers */,
|
E499BF2216AE760F007FCDBE /* krengine_osx.h in Headers */,
|
||||||
E4FE6AA916B21D660058B8CE /* forsyth.h in Headers */,
|
|
||||||
E4C454B3167BC04C003586CD /* KRMeshSphere.h in Headers */,
|
E4C454B3167BC04C003586CD /* KRMeshSphere.h in Headers */,
|
||||||
E450273C16E0491D00FDEC5C /* KRReverbZone.h in Headers */,
|
E450273C16E0491D00FDEC5C /* KRReverbZone.h in Headers */,
|
||||||
|
E45E03BB18790DD1006DA23F /* PVRTMap.h in Headers */,
|
||||||
E44F38251683B23000399B5D /* KRRenderSettings.h in Headers */,
|
E44F38251683B23000399B5D /* KRRenderSettings.h in Headers */,
|
||||||
|
E45E03BC18790DD1006DA23F /* PVRTString.h in Headers */,
|
||||||
E499BF1D16AE74FF007FCDBE /* KRTextureAnimated.h in Headers */,
|
E499BF1D16AE74FF007FCDBE /* KRTextureAnimated.h in Headers */,
|
||||||
E4EC73C41720B1FF0065299F /* KRVector4.h in Headers */,
|
E4EC73C41720B1FF0065299F /* KRVector4.h in Headers */,
|
||||||
E468448217FFDF51001F1FA1 /* KRLocator.h in Headers */,
|
E468448217FFDF51001F1FA1 /* KRLocator.h in Headers */,
|
||||||
E43F70DF181B20E400136169 /* KRLODSet.h in Headers */,
|
E43F70DF181B20E400136169 /* KRLODSet.h in Headers */,
|
||||||
|
E416E48B1879111300FC2EEB /* RecastAlloc.h in Headers */,
|
||||||
E4AE63601704FB0A00B460CD /* KRLODGroup.h in Headers */,
|
E4AE63601704FB0A00B460CD /* KRLODGroup.h in Headers */,
|
||||||
E45134B91746A4A300443C21 /* KRBehavior.h in Headers */,
|
E45134B91746A4A300443C21 /* KRBehavior.h in Headers */,
|
||||||
E43F71021824E73100136169 /* KRMeshStreamer.h in Headers */,
|
E43F71021824E73100136169 /* KRMeshStreamer.h in Headers */,
|
||||||
@@ -1608,41 +1768,52 @@
|
|||||||
E491019113C99BDC0098455B /* KRMesh.cpp in Sources */,
|
E491019113C99BDC0098455B /* KRMesh.cpp in Sources */,
|
||||||
E491019313C99BDC0098455B /* KRMaterialManager.cpp in Sources */,
|
E491019313C99BDC0098455B /* KRMaterialManager.cpp in Sources */,
|
||||||
E491019413C99BDC0098455B /* KRMaterial.cpp in Sources */,
|
E491019413C99BDC0098455B /* KRMaterial.cpp in Sources */,
|
||||||
|
E416E49E1879112700FC2EEB /* RecastContour.cpp in Sources */,
|
||||||
E491019713C99BDC0098455B /* KRVector3.cpp in Sources */,
|
E491019713C99BDC0098455B /* KRVector3.cpp in Sources */,
|
||||||
E491019813C99BDC0098455B /* KRTextureManager.cpp in Sources */,
|
E491019813C99BDC0098455B /* KRTextureManager.cpp in Sources */,
|
||||||
E491019913C99BDC0098455B /* KRTexture2D.cpp in Sources */,
|
E491019913C99BDC0098455B /* KRTexture2D.cpp in Sources */,
|
||||||
|
E416E4AA1879112700FC2EEB /* RecastRegion.cpp in Sources */,
|
||||||
E491019A13C99BDC0098455B /* KRMeshManager.cpp in Sources */,
|
E491019A13C99BDC0098455B /* KRMeshManager.cpp in Sources */,
|
||||||
|
E45E03C718790EC0006DA23F /* tinyxml2.cpp in Sources */,
|
||||||
|
E45E03CD18790EFF006DA23F /* forsyth.cpp in Sources */,
|
||||||
E47C25A713F4F6AB00FF4370 /* KRShaderManager.cpp in Sources */,
|
E47C25A713F4F6AB00FF4370 /* KRShaderManager.cpp in Sources */,
|
||||||
E47C25A913F4F6DD00FF4370 /* KRShader.cpp in Sources */,
|
E47C25A913F4F6DD00FF4370 /* KRShader.cpp in Sources */,
|
||||||
|
E416E4A41879112700FC2EEB /* RecastMesh.cpp in Sources */,
|
||||||
E43F70DC181B20E400136169 /* KRLODSet.cpp in Sources */,
|
E43F70DC181B20E400136169 /* KRLODSet.cpp in Sources */,
|
||||||
E414BAE51435558900A668C4 /* KRModel.cpp in Sources */,
|
E414BAE51435558900A668C4 /* KRModel.cpp in Sources */,
|
||||||
E414BAE91435585A00A668C4 /* KRScene.cpp in Sources */,
|
E414BAE91435585A00A668C4 /* KRScene.cpp in Sources */,
|
||||||
E48B3CC014393E30000C50E2 /* KRCamera.cpp in Sources */,
|
E48B3CC014393E30000C50E2 /* KRCamera.cpp in Sources */,
|
||||||
|
E416E4A61879112700FC2EEB /* RecastMeshDetail.cpp in Sources */,
|
||||||
E497B946151BA99500D3DC67 /* KRVector2.cpp in Sources */,
|
E497B946151BA99500D3DC67 /* KRVector2.cpp in Sources */,
|
||||||
E497B94D151BCF2500D3DC67 /* KRResource.cpp in Sources */,
|
E497B94D151BCF2500D3DC67 /* KRResource.cpp in Sources */,
|
||||||
|
E416E4981879112700FC2EEB /* Recast.cpp in Sources */,
|
||||||
E497B950151BD2CE00D3DC67 /* KRResource+obj.cpp in Sources */,
|
E497B950151BD2CE00D3DC67 /* KRResource+obj.cpp in Sources */,
|
||||||
E43F70FF1824E73100136169 /* KRMeshStreamer.mm in Sources */,
|
E43F70FF1824E73100136169 /* KRMeshStreamer.mm in Sources */,
|
||||||
E461A156152E54F800F2044A /* KRLight.cpp in Sources */,
|
E461A156152E54F800F2044A /* KRLight.cpp in Sources */,
|
||||||
E461A159152E557E00F2044A /* KRPointLight.cpp in Sources */,
|
E461A159152E557E00F2044A /* KRPointLight.cpp in Sources */,
|
||||||
E468447F17FFDF51001F1FA1 /* KRLocator.cpp in Sources */,
|
E468447F17FFDF51001F1FA1 /* KRLocator.cpp in Sources */,
|
||||||
E461A15F152E565700F2044A /* KRDirectionalLight.cpp in Sources */,
|
E461A15F152E565700F2044A /* KRDirectionalLight.cpp in Sources */,
|
||||||
|
E416E4A21879112700FC2EEB /* RecastLayers.cpp in Sources */,
|
||||||
E461A165152E56C000F2044A /* KRSpotLight.cpp in Sources */,
|
E461A165152E56C000F2044A /* KRSpotLight.cpp in Sources */,
|
||||||
E4F975361536221C00FD60B2 /* KRNode.cpp in Sources */,
|
E4F975361536221C00FD60B2 /* KRNode.cpp in Sources */,
|
||||||
E46C214515364BC8009CABF3 /* tinyxml2.cpp in Sources */,
|
|
||||||
E46C214B15364DEC009CABF3 /* KRSceneManager.cpp in Sources */,
|
E46C214B15364DEC009CABF3 /* KRSceneManager.cpp in Sources */,
|
||||||
E48C697215374F7E00232E28 /* KRContext.cpp in Sources */,
|
E48C697215374F7E00232E28 /* KRContext.cpp in Sources */,
|
||||||
E46F4A0E155E003000CCF8B8 /* KRDataBlock.cpp in Sources */,
|
E46F4A0E155E003000CCF8B8 /* KRDataBlock.cpp in Sources */,
|
||||||
|
E416E49A1879112700FC2EEB /* RecastAlloc.cpp in Sources */,
|
||||||
E42CB1F0158446AB0066E0D8 /* KRQuaternion.cpp in Sources */,
|
E42CB1F0158446AB0066E0D8 /* KRQuaternion.cpp in Sources */,
|
||||||
E43B0AD615DDCA0F00A5CB9F /* KRContextObject.cpp in Sources */,
|
E43B0AD615DDCA0F00A5CB9F /* KRContextObject.cpp in Sources */,
|
||||||
E4924C2615EE95E800B965C6 /* KROctree.cpp in Sources */,
|
E4924C2615EE95E800B965C6 /* KROctree.cpp in Sources */,
|
||||||
|
E416E4A81879112700FC2EEB /* RecastRasterization.cpp in Sources */,
|
||||||
E4924C2B15EE96AB00B965C6 /* KROctreeNode.cpp in Sources */,
|
E4924C2B15EE96AB00B965C6 /* KROctreeNode.cpp in Sources */,
|
||||||
E404702018695DD200F01F42 /* KRTextureKTX.cpp in Sources */,
|
E404702018695DD200F01F42 /* KRTextureKTX.cpp in Sources */,
|
||||||
E40BA45415EFF79500D7C3DD /* KRAABB.cpp in Sources */,
|
E40BA45415EFF79500D7C3DD /* KRAABB.cpp in Sources */,
|
||||||
|
E416E49C1879112700FC2EEB /* RecastArea.cpp in Sources */,
|
||||||
E488399415F928CA00BD66D5 /* KRBundle.cpp in Sources */,
|
E488399415F928CA00BD66D5 /* KRBundle.cpp in Sources */,
|
||||||
E488399C15F92BE000BD66D5 /* KRBundleManager.cpp in Sources */,
|
E488399C15F92BE000BD66D5 /* KRBundleManager.cpp in Sources */,
|
||||||
E4B175AC161F5A1000B8FB80 /* KRTexture.cpp in Sources */,
|
E4B175AC161F5A1000B8FB80 /* KRTexture.cpp in Sources */,
|
||||||
E4B175B2161F5FAF00B8FB80 /* KRTextureCube.cpp in Sources */,
|
E4B175B2161F5FAF00B8FB80 /* KRTextureCube.cpp in Sources */,
|
||||||
E4CA10E91637BD2B005D9400 /* KRTexturePVR.cpp in Sources */,
|
E4CA10E91637BD2B005D9400 /* KRTexturePVR.cpp in Sources */,
|
||||||
|
E416E4A01879112700FC2EEB /* RecastFilter.cpp in Sources */,
|
||||||
E4CA10EF1637BD58005D9400 /* KRTextureTGA.cpp in Sources */,
|
E4CA10EF1637BD58005D9400 /* KRTextureTGA.cpp in Sources */,
|
||||||
E4CA11781639CC90005D9400 /* KRViewport.cpp in Sources */,
|
E4CA11781639CC90005D9400 /* KRViewport.cpp in Sources */,
|
||||||
E4324BA816444C230043185B /* KRParticleSystem.cpp in Sources */,
|
E4324BA816444C230043185B /* KRParticleSystem.cpp in Sources */,
|
||||||
@@ -1670,7 +1841,6 @@
|
|||||||
E4F027CE16979CE200D4427D /* KRAudioSample.cpp in Sources */,
|
E4F027CE16979CE200D4427D /* KRAudioSample.cpp in Sources */,
|
||||||
E4F027DE1697BFFF00D4427D /* KRAudioBuffer.cpp in Sources */,
|
E4F027DE1697BFFF00D4427D /* KRAudioBuffer.cpp in Sources */,
|
||||||
E4943231169E08D200BCB891 /* KRAmbientZone.cpp in Sources */,
|
E4943231169E08D200BCB891 /* KRAmbientZone.cpp in Sources */,
|
||||||
E4FE6AAB16B21D7E0058B8CE /* forsyth.cpp in Sources */,
|
|
||||||
E450273916E0491D00FDEC5C /* KRReverbZone.cpp in Sources */,
|
E450273916E0491D00FDEC5C /* KRReverbZone.cpp in Sources */,
|
||||||
E4AE635D1704FB0A00B460CD /* KRLODGroup.cpp in Sources */,
|
E4AE635D1704FB0A00B460CD /* KRLODGroup.cpp in Sources */,
|
||||||
E4EC73C11720B1FF0065299F /* KRVector4.cpp in Sources */,
|
E4EC73C11720B1FF0065299F /* KRVector4.cpp in Sources */,
|
||||||
@@ -1683,7 +1853,6 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
E4EC73B8171F32780065299F /* forsyth.cpp in Sources */,
|
|
||||||
E499BF2516AE8C20007FCDBE /* KREngine.mm in Sources */,
|
E499BF2516AE8C20007FCDBE /* KREngine.mm in Sources */,
|
||||||
10CC33A5168534F000BB9846 /* KRCamera.cpp in Sources */,
|
10CC33A5168534F000BB9846 /* KRCamera.cpp in Sources */,
|
||||||
E460292C166834AB00261BB9 /* KRTextureAnimated.cpp in Sources */,
|
E460292C166834AB00261BB9 /* KRTextureAnimated.cpp in Sources */,
|
||||||
@@ -1691,6 +1860,7 @@
|
|||||||
E461A175152E5C4800F2044A /* KRLight.cpp in Sources */,
|
E461A175152E5C4800F2044A /* KRLight.cpp in Sources */,
|
||||||
E4BBBBA71512A6DC00F43B5B /* KRVector3.cpp in Sources */,
|
E4BBBBA71512A6DC00F43B5B /* KRVector3.cpp in Sources */,
|
||||||
E4B2A43B1523B02E004CB0EC /* KRMaterial.cpp in Sources */,
|
E4B2A43B1523B02E004CB0EC /* KRMaterial.cpp in Sources */,
|
||||||
|
E416E4A71879112700FC2EEB /* RecastMeshDetail.cpp in Sources */,
|
||||||
E4BBBB8E1512A40300F43B5B /* krengine_osx.mm in Sources */,
|
E4BBBB8E1512A40300F43B5B /* krengine_osx.mm in Sources */,
|
||||||
E468448017FFDF51001F1FA1 /* KRLocator.cpp in Sources */,
|
E468448017FFDF51001F1FA1 /* KRLocator.cpp in Sources */,
|
||||||
E497B947151BA99500D3DC67 /* KRVector2.cpp in Sources */,
|
E497B947151BA99500D3DC67 /* KRVector2.cpp in Sources */,
|
||||||
@@ -1698,18 +1868,23 @@
|
|||||||
E497B951151BD2CE00D3DC67 /* KRResource+obj.cpp in Sources */,
|
E497B951151BD2CE00D3DC67 /* KRResource+obj.cpp in Sources */,
|
||||||
E497B954151BEDA600D3DC67 /* KRResource+fbx.cpp in Sources */,
|
E497B954151BEDA600D3DC67 /* KRResource+fbx.cpp in Sources */,
|
||||||
E4F97551153633E200FD60B2 /* KRMaterialManager.cpp in Sources */,
|
E4F97551153633E200FD60B2 /* KRMaterialManager.cpp in Sources */,
|
||||||
|
E416E49F1879112700FC2EEB /* RecastContour.cpp in Sources */,
|
||||||
E461A15A152E557E00F2044A /* KRPointLight.cpp in Sources */,
|
E461A15A152E557E00F2044A /* KRPointLight.cpp in Sources */,
|
||||||
|
E45E03C818790EC0006DA23F /* tinyxml2.cpp in Sources */,
|
||||||
E4F9754F1536333200FD60B2 /* KRMesh.cpp in Sources */,
|
E4F9754F1536333200FD60B2 /* KRMesh.cpp in Sources */,
|
||||||
E4F9754B153632D800FD60B2 /* KRMeshManager.cpp in Sources */,
|
E4F9754B153632D800FD60B2 /* KRMeshManager.cpp in Sources */,
|
||||||
|
E416E4A31879112700FC2EEB /* RecastLayers.cpp in Sources */,
|
||||||
E461A160152E565700F2044A /* KRDirectionalLight.cpp in Sources */,
|
E461A160152E565700F2044A /* KRDirectionalLight.cpp in Sources */,
|
||||||
E4F975531536340000FD60B2 /* KRTexture2D.cpp in Sources */,
|
E4F975531536340000FD60B2 /* KRTexture2D.cpp in Sources */,
|
||||||
E4F9754015362CD400FD60B2 /* KRScene.cpp in Sources */,
|
E4F9754015362CD400FD60B2 /* KRScene.cpp in Sources */,
|
||||||
E461A166152E56C000F2044A /* KRSpotLight.cpp in Sources */,
|
E461A166152E56C000F2044A /* KRSpotLight.cpp in Sources */,
|
||||||
E4F9754315362D0F00FD60B2 /* KRModel.cpp in Sources */,
|
E4F9754315362D0F00FD60B2 /* KRModel.cpp in Sources */,
|
||||||
|
E416E4A11879112700FC2EEB /* RecastFilter.cpp in Sources */,
|
||||||
|
E45E03CE18790EFF006DA23F /* forsyth.cpp in Sources */,
|
||||||
|
E416E4991879112700FC2EEB /* Recast.cpp in Sources */,
|
||||||
E4F975371536221C00FD60B2 /* KRNode.cpp in Sources */,
|
E4F975371536221C00FD60B2 /* KRNode.cpp in Sources */,
|
||||||
E4F9754E1536331D00FD60B2 /* KRTextureManager.cpp in Sources */,
|
E4F9754E1536331D00FD60B2 /* KRTextureManager.cpp in Sources */,
|
||||||
E4D13367153768610070068C /* KRShader.cpp in Sources */,
|
E4D13367153768610070068C /* KRShader.cpp in Sources */,
|
||||||
E46C214615364BC8009CABF3 /* tinyxml2.cpp in Sources */,
|
|
||||||
E4D13364153767ED0070068C /* KRShaderManager.cpp in Sources */,
|
E4D13364153767ED0070068C /* KRShaderManager.cpp in Sources */,
|
||||||
E4AFC6B915F7C7B200DDB4C8 /* KROctree.cpp in Sources */,
|
E4AFC6B915F7C7B200DDB4C8 /* KROctree.cpp in Sources */,
|
||||||
E46C214C15364DEC009CABF3 /* KRSceneManager.cpp in Sources */,
|
E46C214C15364DEC009CABF3 /* KRSceneManager.cpp in Sources */,
|
||||||
@@ -1719,6 +1894,7 @@
|
|||||||
E46F4A0F155E003000CCF8B8 /* KRDataBlock.cpp in Sources */,
|
E46F4A0F155E003000CCF8B8 /* KRDataBlock.cpp in Sources */,
|
||||||
E42CB1F1158446AB0066E0D8 /* KRQuaternion.cpp in Sources */,
|
E42CB1F1158446AB0066E0D8 /* KRQuaternion.cpp in Sources */,
|
||||||
E4AFC6BB15F7C7D600DDB4C8 /* KROctreeNode.cpp in Sources */,
|
E4AFC6BB15F7C7D600DDB4C8 /* KROctreeNode.cpp in Sources */,
|
||||||
|
E416E4A51879112700FC2EEB /* RecastMesh.cpp in Sources */,
|
||||||
E43B0AD715DDCA0F00A5CB9F /* KRContextObject.cpp in Sources */,
|
E43B0AD715DDCA0F00A5CB9F /* KRContextObject.cpp in Sources */,
|
||||||
E40BA45515EFF79500D7C3DD /* KRAABB.cpp in Sources */,
|
E40BA45515EFF79500D7C3DD /* KRAABB.cpp in Sources */,
|
||||||
E488399515F928CA00BD66D5 /* KRBundle.cpp in Sources */,
|
E488399515F928CA00BD66D5 /* KRBundle.cpp in Sources */,
|
||||||
@@ -1726,6 +1902,7 @@
|
|||||||
E43F70DD181B20E400136169 /* KRLODSet.cpp in Sources */,
|
E43F70DD181B20E400136169 /* KRLODSet.cpp in Sources */,
|
||||||
E43F71001824E73100136169 /* KRMeshStreamer.mm in Sources */,
|
E43F71001824E73100136169 /* KRMeshStreamer.mm in Sources */,
|
||||||
E4B175AD161F5A1000B8FB80 /* KRTexture.cpp in Sources */,
|
E4B175AD161F5A1000B8FB80 /* KRTexture.cpp in Sources */,
|
||||||
|
E416E4AB1879112700FC2EEB /* RecastRegion.cpp in Sources */,
|
||||||
E4B175B3161F5FAF00B8FB80 /* KRTextureCube.cpp in Sources */,
|
E4B175B3161F5FAF00B8FB80 /* KRTextureCube.cpp in Sources */,
|
||||||
E40F9833184A7BAC00CFA4D8 /* KRSprite.cpp in Sources */,
|
E40F9833184A7BAC00CFA4D8 /* KRSprite.cpp in Sources */,
|
||||||
E4CA10EA1637BD2B005D9400 /* KRTexturePVR.cpp in Sources */,
|
E4CA10EA1637BD2B005D9400 /* KRTexturePVR.cpp in Sources */,
|
||||||
@@ -1752,11 +1929,14 @@
|
|||||||
E4F027C816979CCD00D4427D /* KRAudioManager.cpp in Sources */,
|
E4F027C816979CCD00D4427D /* KRAudioManager.cpp in Sources */,
|
||||||
E4F027CF16979CE200D4427D /* KRAudioSample.cpp in Sources */,
|
E4F027CF16979CE200D4427D /* KRAudioSample.cpp in Sources */,
|
||||||
E4F027DF1697BFFF00D4427D /* KRAudioBuffer.cpp in Sources */,
|
E4F027DF1697BFFF00D4427D /* KRAudioBuffer.cpp in Sources */,
|
||||||
|
E416E4A91879112700FC2EEB /* RecastRasterization.cpp in Sources */,
|
||||||
E4943232169E08D200BCB891 /* KRAmbientZone.cpp in Sources */,
|
E4943232169E08D200BCB891 /* KRAmbientZone.cpp in Sources */,
|
||||||
E404702118695DD200F01F42 /* KRTextureKTX.cpp in Sources */,
|
E404702118695DD200F01F42 /* KRTextureKTX.cpp in Sources */,
|
||||||
E450273A16E0491D00FDEC5C /* KRReverbZone.cpp in Sources */,
|
E450273A16E0491D00FDEC5C /* KRReverbZone.cpp in Sources */,
|
||||||
|
E416E49B1879112700FC2EEB /* RecastAlloc.cpp in Sources */,
|
||||||
E4AE635E1704FB0A00B460CD /* KRLODGroup.cpp in Sources */,
|
E4AE635E1704FB0A00B460CD /* KRLODGroup.cpp in Sources */,
|
||||||
E4EC73C21720B1FF0065299F /* KRVector4.cpp in Sources */,
|
E4EC73C21720B1FF0065299F /* KRVector4.cpp in Sources */,
|
||||||
|
E416E49D1879112700FC2EEB /* RecastArea.cpp in Sources */,
|
||||||
E48CF943173453990005EBBB /* KRFloat.cpp in Sources */,
|
E48CF943173453990005EBBB /* KRFloat.cpp in Sources */,
|
||||||
E45134B71746A4A300443C21 /* KRBehavior.cpp in Sources */,
|
E45134B71746A4A300443C21 /* KRBehavior.cpp in Sources */,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user