Switched to integer naming conventions from C++0x (e.g. uint16_t)

This commit is contained in:
David Williams
2009-03-30 21:44:23 +00:00
parent 47e0e66228
commit 5acbd012cf
44 changed files with 711 additions and 711 deletions

View File

@ -36,25 +36,25 @@ namespace PolyVox
//Make VolumeIterator a friend
friend class VolumeIterator<VoxelType>;
public:
BlockData(uint8 uSideLength);
BlockData(uint8_t uSideLength);
BlockData(const BlockData& rhs);
~BlockData();
BlockData& operator=(const BlockData& rhs);
uint16 getSideLength(void) const;
VoxelType getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const;
uint16_t getSideLength(void) const;
VoxelType getVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const;
VoxelType getVoxelAt(const Vector3DUint16& v3dPos) const;
void setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue);
void setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue);
void setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue);
void fill(VoxelType tValue);
bool isHomogeneous(void);
private:
uint16 m_uSideLength;
uint8 m_uSideLengthPower;
uint16_t m_uSideLength;
uint8_t m_uSideLengthPower;
VoxelType* m_tData;
};
}

View File

@ -33,7 +33,7 @@ namespace PolyVox
{
#pragma region Constructors/Destructors
template <typename VoxelType>
BlockData<VoxelType>::BlockData(uint8 uSideLength)
BlockData<VoxelType>::BlockData(uint8_t uSideLength)
:m_tData(0)
{
//Debug mode validation
@ -87,13 +87,13 @@ namespace PolyVox
#pragma region Getters
template <typename VoxelType>
uint16 BlockData<VoxelType>::getSideLength(void) const
uint16_t BlockData<VoxelType>::getSideLength(void) const
{
return m_uSideLength;
}
template <typename VoxelType>
VoxelType BlockData<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
VoxelType BlockData<VoxelType>::getVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const
{
assert(uXPos < m_uSideLength);
assert(uYPos < m_uSideLength);
@ -116,7 +116,7 @@ namespace PolyVox
#pragma region Setters
template <typename VoxelType>
void BlockData<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
void BlockData<VoxelType>::setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue)
{
assert(uXPos < m_uSideLength);
assert(uYPos < m_uSideLength);
@ -150,8 +150,8 @@ namespace PolyVox
VoxelType currentVoxel = m_tData;
VoxelType firstVal = *currentVoxel;
uint32 uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
for(uint32 ct = 1; ct < uNoOfVoxels; ++ct)
uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
for(uint32_t ct = 1; ct < uNoOfVoxels; ++ct)
{
++currentVoxel;
if(*currentVoxel != firstVal)

View File

@ -42,8 +42,8 @@ namespace PolyVox
template <typename VoxelType>
Vector3DFloat computeSmoothSobelGradient(VolumeIterator<VoxelType>& volIter);
POLYVOX_API void computeNormalsForVertices(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API Vector3DFloat computeNormal(Volume<uint8>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API void computeNormalsForVertices(Volume<uint8_t>* volumeData, IndexedSurfacePatch& isp, NormalGenerationMethod normalGenerationMethod);
POLYVOX_API Vector3DFloat computeNormal(Volume<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod);
}
#include "GradientEstimators.inl"

View File

@ -47,9 +47,9 @@ namespace PolyVox
template <typename VoxelType>
Vector3DFloat computeDecimatedCentralDifferenceGradient(const VolumeIterator<VoxelType>& volIter)
{
const uint16 x = volIter.getPosX();
const uint16 y = volIter.getPosY();
const uint16 z = volIter.getPosZ();
const uint16_t x = volIter.getPosX();
const uint16_t y = volIter.getPosY();
const uint16_t z = volIter.getPosZ();
//FIXME - bitwise way of doing this?
VoxelType voxel1nx = volIter.getVoxelAt(x-2, y ,z ) > 0 ? 1: 0;
@ -72,9 +72,9 @@ namespace PolyVox
template <typename VoxelType>
Vector3DFloat computeSmoothCentralDifferenceGradient(VolumeIterator<VoxelType>& volIter)
{
uint16 initialX = volIter.getPosX();
uint16 initialY = volIter.getPosY();
uint16 initialZ = volIter.getPosZ();
uint16_t initialX = volIter.getPosX();
uint16_t initialY = volIter.getPosY();
uint16_t initialZ = volIter.getPosZ();
//FIXME - bitwise way of doing this?
volIter.setPosition(initialX-1, initialY, initialZ);
@ -189,9 +189,9 @@ namespace PolyVox
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {
{3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } };
uint16 initialX = volIter.getPosX();
uint16 initialY = volIter.getPosY();
uint16 initialZ = volIter.getPosZ();
uint16_t initialX = volIter.getPosX();
uint16_t initialY = volIter.getPosY();
uint16_t initialZ = volIter.getPosZ();
volIter.setPosition(initialX-1, initialY-1, initialZ-1); const float pVoxel1nx1ny1nz = computeSmoothedVoxel(volIter);
volIter.setPosition(initialX-1, initialY-1, initialZ ); const float pVoxel1nx1ny0pz = computeSmoothedVoxel(volIter);

View File

@ -39,25 +39,25 @@ namespace PolyVox
IndexedSurfacePatch();
~IndexedSurfacePatch();
const std::vector<uint32>& getIndices(void) const;
uint32 getNoOfIndices(void) const;
uint32 getNoOfNonUniformTrianges(void) const;
uint32 getNoOfUniformTrianges(void) const;
uint32 getNoOfVertices(void) const;
const std::vector<uint32_t>& getIndices(void) const;
uint32_t getNoOfIndices(void) const;
uint32_t getNoOfNonUniformTrianges(void) const;
uint32_t getNoOfUniformTrianges(void) const;
uint32_t getNoOfVertices(void) const;
std::vector<SurfaceVertex>& getRawVertexData(void); //FIXME - this shoudl be removed
const std::vector<SurfaceVertex>& getVertices(void) const;
void addTriangle(uint32 index0, uint32 index1, uint32 index2);
uint32 addVertex(const SurfaceVertex& vertex);
void addTriangle(uint32_t index0, uint32_t index1, uint32_t index2);
uint32_t addVertex(const SurfaceVertex& vertex);
void clear(void);
const bool isEmpty(void) const;
Vector3DInt32 m_v3dRegionPosition; //FIXME - remove this?
int32 m_iTimeStamp;
int32_t m_iTimeStamp;
private:
std::vector<uint32> m_vecTriangleIndices;
std::vector<uint32_t> m_vecTriangleIndices;
std::vector<SurfaceVertex> m_vecVertices;
};

View File

@ -32,8 +32,8 @@ namespace PolyVox
//---------- Volume ----------
template <typename VoxelType> class Volume;
typedef Volume<float> FloatVolume;
typedef Volume<uint8> UInt8Volume;
typedef Volume<uint16> UInt16Volume;
typedef Volume<uint8_t> UInt8Volume;
typedef Volume<uint16_t> UInt16Volume;
//---------------------------------
class IndexedSurfacePatch;
@ -42,15 +42,15 @@ namespace PolyVox
class SurfaceVertex;
//---------- Vector ----------
template <uint32 Size, typename Type> class Vector;
template <uint32_t Size, typename Type> class Vector;
typedef Vector<3,float> Vector3DFloat;
typedef Vector<3,double> Vector3DDouble;
typedef Vector<3,int8> Vector3DInt8;
typedef Vector<3,uint8> Vector3DUint8;
typedef Vector<3,int16> Vector3DInt16;
typedef Vector<3,uint16> Vector3DUint16;
typedef Vector<3,int32> Vector3DInt32;
typedef Vector<3,uint32> Vector3DUint32;
typedef Vector<3,int8_t> Vector3DInt8;
typedef Vector<3,uint8_t> Vector3DUint8;
typedef Vector<3,int16_t> Vector3DInt16;
typedef Vector<3,uint16_t> Vector3DUint16;
typedef Vector<3,int32_t> Vector3DInt32;
typedef Vector<3,uint32_t> Vector3DUint32;
//----------------------------
template <typename VoxelType> class VolumeIterator;

View File

@ -28,12 +28,12 @@
//temporary work around until it's properly supported by C++ anyway...
namespace PolyVox
{
typedef POLYVOX_STD_NAMESPACE::int8_t int8;
typedef POLYVOX_STD_NAMESPACE::int16_t int16;
typedef POLYVOX_STD_NAMESPACE::int32_t int32;
typedef POLYVOX_STD_NAMESPACE::uint8_t uint8;
typedef POLYVOX_STD_NAMESPACE::uint16_t uint16;
typedef POLYVOX_STD_NAMESPACE::uint32_t uint32;
typedef POLYVOX_STD_NAMESPACE::int8_t int8_t;
typedef POLYVOX_STD_NAMESPACE::int16_t int16_t;
typedef POLYVOX_STD_NAMESPACE::int32_t int32_t;
typedef POLYVOX_STD_NAMESPACE::uint8_t uint8_t;
typedef POLYVOX_STD_NAMESPACE::uint16_t uint16_t;
typedef POLYVOX_STD_NAMESPACE::uint32_t uint32_t;
}
#endif

View File

@ -32,13 +32,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
uint32 getDecimatedIndex(uint32 x, uint32 y, uint32 regionWidth);
uint32_t getDecimatedIndex(uint32_t x, uint32_t y, uint32_t regionWidth);
void extractDecimatedSurfaceImpl(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
uint32 computeInitialDecimatedBitmaskForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
uint32 computeDecimatedBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
void generateDecimatedIndicesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[]);
void generateDecimatedVerticesForSlice(VolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
void extractDecimatedSurfaceImpl(Volume<uint8_t>* volumeData, uint8_t uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
uint32_t computeInitialDecimatedBitmaskForSlice(VolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8_t *bitmask);
uint32_t computeDecimatedBitmaskForSliceFromPrevious(VolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8_t *bitmask, uint8_t *previousBitmask);
void generateDecimatedIndicesForSlice(VolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, uint8_t* bitmask1, int32_t vertexIndicesX0[],int32_t vertexIndicesY0[],int32_t vertexIndicesZ0[], int32_t vertexIndicesX1[],int32_t vertexIndicesY1[],int32_t vertexIndicesZ1[]);
void generateDecimatedVerticesForSlice(VolumeIterator<uint8_t>& volIter, uint8_t uLevel, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32_t vertexIndicesX[],int32_t vertexIndicesY[],int32_t vertexIndicesZ[]);
}
#endif

View File

@ -32,12 +32,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
void extractFastSurfaceImpl(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
uint32 getIndex(uint32 x, uint32 y, uint32 regionWidth);
uint32 computeInitialRoughBitmaskForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
uint32 computeRoughBitmaskForSliceFromPrevious(VolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
void generateRoughIndicesForSlice(VolumeIterator<uint8>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8* bitmask0, uint8* bitmask1, int32 vertexIndicesX0[],int32 vertexIndicesY0[],int32 vertexIndicesZ0[], int32 vertexIndicesX1[],int32 vertexIndicesY1[],int32 vertexIndicesZ1[]);
void generateRoughVerticesForSlice(VolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
void extractFastSurfaceImpl(Volume<uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
uint32_t getIndex(uint32_t x, uint32_t y, uint32_t regionWidth);
uint32_t computeInitialRoughBitmaskForSlice(VolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t *bitmask);
uint32_t computeRoughBitmaskForSliceFromPrevious(VolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t *bitmask, uint8_t *previousBitmask);
void generateRoughIndicesForSlice(VolumeIterator<uint8_t>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, uint8_t* bitmask1, int32_t vertexIndicesX0[],int32_t vertexIndicesY0[],int32_t vertexIndicesZ0[], int32_t vertexIndicesX1[],int32_t vertexIndicesY1[],int32_t vertexIndicesZ1[]);
void generateRoughVerticesForSlice(VolumeIterator<uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32_t vertexIndicesX[],int32_t vertexIndicesY[],int32_t vertexIndicesZ[]);
}
#endif

View File

@ -35,11 +35,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
///A simple version of the surface extractor optimised for readability rather than speed.
void extractReferenceSurfaceImpl(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch); //FIXME - should pass variables by reference?
void extractReferenceSurfaceImpl(Volume<uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch); //FIXME - should pass variables by reference?
///Determines whether a vertex already exists for a given edge, and if so returns it's index.
int32 getIndexFor(const Vector3DFloat& pos, const Vector3DInt32& regionDimensions, const std::vector<int32>& vertexIndicesX, const std::vector<int32>& vertexIndicesY, const std::vector<int32>& vertexIndicesZ);
int32_t getIndexFor(const Vector3DFloat& pos, const Vector3DInt32& regionDimensions, const std::vector<int32_t>& vertexIndicesX, const std::vector<int32_t>& vertexIndicesY, const std::vector<int32_t>& vertexIndicesZ);
///Sets the index of an existing vertex for a given edge.
void setIndexFor(const Vector3DFloat& pos, const Vector3DInt32& regionDimensions, int32 newIndex, std::vector<int32>& vertexIndicesX, std::vector<int32>& vertexIndicesY, std::vector<int32>& vertexIndicesZ);
void setIndexFor(const Vector3DFloat& pos, const Vector3DInt32& regionDimensions, int32_t newIndex, std::vector<int32_t>& vertexIndicesX, std::vector<int32_t>& vertexIndicesY, std::vector<int32_t>& vertexIndicesZ);
}
#endif

View File

@ -42,15 +42,15 @@ namespace PolyVox
void setUpperCorner(const Vector3DInt32& v3dUpperCorner);
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
bool containsPoint(const Vector3DInt32& pos, uint8 boundary) const;
bool containsPoint(const Vector3DInt32& pos, uint8_t boundary) const;
void cropTo(const Region& other);
int32 depth(void) const;
int32 height(void) const;
int32_t depth(void) const;
int32_t height(void) const;
void shift(const Vector3DInt32& amount);
void shiftLowerCorner(const Vector3DInt32& amount);
void shiftUpperCorner(const Vector3DInt32& amount);
Vector3DInt32 dimensions(void);
int32 width(void) const;
int32_t width(void) const;
private:
Vector3DInt32 m_v3dLowerCorner;

View File

@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
POLYVOX_API void smoothRegionGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp);
POLYVOX_API void adjustDecimatedGeometry(Volume<uint8>* volumeData, IndexedSurfacePatch& isp, uint8 val);
POLYVOX_API void smoothRegionGeometry(Volume<uint8_t>* volumeData, IndexedSurfacePatch& isp);
POLYVOX_API void adjustDecimatedGeometry(Volume<uint8_t>* volumeData, IndexedSurfacePatch& isp, uint8_t val);
}
#endif

View File

@ -34,8 +34,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
POLYVOX_API void extractSurface(Volume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
POLYVOX_API void extractReferenceSurface(Volume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
POLYVOX_API void extractSurface(Volume<uint8_t>* volumeData, uint8_t uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
POLYVOX_API void extractReferenceSurface(Volume<uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
}
#endif

View File

@ -30,8 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
POLYVOX_API uint8 logBase2(uint32 uInput);
POLYVOX_API bool isPowerOf2(uint32 uInput);
POLYVOX_API uint8_t logBase2(uint32_t uInput);
POLYVOX_API bool isPowerOf2(uint32_t uInput);
template <typename Type>
Type trilinearlyInterpolate(

View File

@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
///Represents a vector in space.
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
class Vector
{
public:
@ -66,7 +66,7 @@ namespace PolyVox
Vector<Size,Type>& operator/=(const Type& rhs) throw();
///Element Access.
Type getElement(uint32 index) const throw();
Type getElement(uint32_t index) const throw();
///Get the x component of the vector.
Type getX(void) const throw();
///Get the y component of the vector.
@ -77,7 +77,7 @@ namespace PolyVox
Type getW(void) const throw();
///Element Access.
void setElement(uint32 index, Type tValue) throw();
void setElement(uint32_t index, Type tValue) throw();
///Element Access.
void setElements(Type x, Type y) throw();
///Element Access.
@ -113,19 +113,19 @@ namespace PolyVox
//Non-member overloaded operators.
///Addition operator.
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type> operator+(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw();
///Subtraction operator.
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type> operator-(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw();
///Multiplication operator.
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type> operator*(const Vector<Size,Type>& lhs, const Type& rhs) throw();
///Division operator.
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type> operator/(const Vector<Size,Type>& lhs, const Type& rhs) throw();
///Stream insertion operator.
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
std::ostream& operator<<(std::ostream& os, const Vector<Size,Type>& vector) throw();
//Some handy typedefs
@ -134,17 +134,17 @@ namespace PolyVox
///A 3D Vector of doubles.
typedef Vector<3,double> Vector3DDouble;
///A 3D Vector of signed 8-bit values.
typedef Vector<3,int8> Vector3DInt8;
typedef Vector<3,int8_t> Vector3DInt8;
///A 3D Vector of unsigned 8-bit values.
typedef Vector<3,uint8> Vector3DUint8;
typedef Vector<3,uint8_t> Vector3DUint8;
///A 3D Vector of signed 16-bit values.
typedef Vector<3,int16> Vector3DInt16;
typedef Vector<3,int16_t> Vector3DInt16;
///A 3D Vector of unsigned 16-bit values.
typedef Vector<3,uint16> Vector3DUint16;
typedef Vector<3,uint16_t> Vector3DUint16;
///A 3D Vector of signed 32-bit values.
typedef Vector<3,int32> Vector3DInt32;
typedef Vector<3,int32_t> Vector3DInt32;
///A 3D Vector of unsigned 32-bit values.
typedef Vector<3,uint32> Vector3DUint32;
typedef Vector<3,uint32_t> Vector3DUint32;

View File

@ -43,7 +43,7 @@ namespace PolyVox
documented below - however often binary versions are also generated by std::operators.
Lastly, note that for convienience a set of typedefs are included for 2 and 3 dimentionsal
vectors with type float, double, int32, and uint32. They are used as follows:
vectors with type float, double, int32_t, and uint32_t. They are used as follows:
Vector2DInt4 test(1,2); //Declares a 2 dimensional Vector of type int4.
*/
@ -55,7 +55,7 @@ namespace PolyVox
\param x x component to set.
\param y y component to set.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type>::Vector(Type x, Type y) throw()
{
m_tElements[0] = x;
@ -69,7 +69,7 @@ namespace PolyVox
\param y y component to set.
\param z z component to set.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type>::Vector(Type x, Type y, Type z) throw()
{
m_tElements[0] = x;
@ -85,7 +85,7 @@ namespace PolyVox
\param z z component to set.
\param w w component to set.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type>::Vector(Type x, Type y, Type z, Type w) throw()
{
m_tElements[0] = x;
@ -97,7 +97,7 @@ namespace PolyVox
/**
Creates a Vector object but does not initialise it.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
Vector<Size, Type>::Vector(void) throw()
{
}
@ -106,7 +106,7 @@ namespace PolyVox
Copy constructor builds object based on object passed as parameter.
\param vector A reference to the Vector to be copied.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
Vector<Size, Type>::Vector(const Vector<Size, Type>& vector) throw()
{
std::memcpy(m_tElements, vector.m_tElements, sizeof(Type) * Size);
@ -121,11 +121,11 @@ namespace PolyVox
\param vector A reference to the Vector to be copied.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
template <typename CastType>
Vector<Size, Type>::Vector(const Vector<Size, CastType>& vector) throw()
{
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
m_tElements[ct] = static_cast<CastType>(vector.getElement(ct));
}
@ -134,7 +134,7 @@ namespace PolyVox
/**
Destroys the Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
Vector<Size, Type>::~Vector(void) throw()
{
}
@ -146,7 +146,7 @@ namespace PolyVox
\param rhs Vector to assign to.
\return A reference to the result to allow chaining.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
Vector<Size, Type>& Vector<Size, Type>::operator=(const Vector<Size, Type>& rhs) throw()
{
if(this == &rhs)
@ -163,11 +163,11 @@ namespace PolyVox
\return true if the Vectors match.
\see operator!=
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline bool Vector<Size, Type>::operator==(const Vector<Size, Type> &rhs) const throw()
{
bool equal = true;
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
if(m_tElements[ct] != rhs.m_tElements[ct])
{
@ -185,7 +185,7 @@ namespace PolyVox
\return true if this is less than the parameter
\see operator!=
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline bool Vector<Size, Type>::operator<(const Vector<Size, Type> &rhs) const throw()
{
for(int ct = 0; ct < Size; ++ct)
@ -203,10 +203,10 @@ namespace PolyVox
\param rhs Vector to add
\return The resulting Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Vector<Size, Type>& Vector<Size, Type>::operator+=(const Vector<Size, Type>& rhs) throw()
{
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
m_tElements[ct] += rhs.m_tElements[ct];
}
@ -219,7 +219,7 @@ namespace PolyVox
\param rhs Vector to add.
\return The resulting Vector.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type> operator+(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw()
{
Vector<Size,Type> result = lhs;
@ -232,10 +232,10 @@ namespace PolyVox
\param rhs Vector to subtract
\return The resulting Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Vector<Size, Type>& Vector<Size, Type>::operator-=(const Vector<Size, Type>& rhs) throw()
{
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
m_tElements[ct] -= rhs.m_tElements[ct];
}
@ -248,7 +248,7 @@ namespace PolyVox
\param rhs Vector to subtract.
\return The resulting Vector.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type> operator-(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw()
{
Vector<Size,Type> result = lhs;
@ -261,10 +261,10 @@ namespace PolyVox
\param rhs the number the Vector is multiplied by.
\return The resulting Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Vector<Size, Type>& Vector<Size, Type>::operator*=(const Type& rhs) throw()
{
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
m_tElements[ct] *= rhs;
}
@ -277,7 +277,7 @@ namespace PolyVox
\param rhs the number the Vector is multiplied by.
\return The resulting Vector.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type> operator*(const Vector<Size,Type>& lhs, const Type& rhs) throw()
{
Vector<Size,Type> result = lhs;
@ -290,10 +290,10 @@ namespace PolyVox
\param rhs the number the Vector is divided by.
\return The resulting Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Vector<Size, Type>& Vector<Size, Type>::operator/=(const Type& rhs) throw()
{
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
m_tElements[ct] /= rhs;
}
@ -306,7 +306,7 @@ namespace PolyVox
\param rhs the number the Vector is divided by.
\return The resulting Vector.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
Vector<Size,Type> operator/(const Vector<Size,Type>& lhs, const Type& rhs) throw()
{
Vector<Size,Type> result = lhs;
@ -320,11 +320,11 @@ namespace PolyVox
\param vector The Vector to write to the stream.
\return A reference to the output stream to allow chaining.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
std::ostream& operator<<(std::ostream& os, const Vector<Size, Type>& vector) throw()
{
os << "(";
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
os << vector.getElement(ct);
if(ct < (Size-1))
@ -343,8 +343,8 @@ namespace PolyVox
\param index The index of the element to return.
\return The element.
*/
template <uint32 Size, typename Type>
inline Type Vector<Size, Type>::getElement(uint32 index) const throw()
template <uint32_t Size, typename Type>
inline Type Vector<Size, Type>::getElement(uint32_t index) const throw()
{
return m_tElements[index];
}
@ -352,7 +352,7 @@ namespace PolyVox
/**
\return A const reference to the X component of a 1, 2, 3, or 4 dimensional Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Type Vector<Size, Type>::getX(void) const throw()
{
return m_tElements[0];
@ -361,7 +361,7 @@ namespace PolyVox
/**
\return A const reference to the Y component of a 2, 3, or 4 dimensional Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Type Vector<Size, Type>::getY(void) const throw()
{
return m_tElements[1];
@ -370,7 +370,7 @@ namespace PolyVox
/**
\return A const reference to the Z component of a 3 or 4 dimensional Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Type Vector<Size, Type>::getZ(void) const throw()
{
return m_tElements[2];
@ -379,7 +379,7 @@ namespace PolyVox
/**
\return A const reference to the W component of a 4 dimensional Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Type Vector<Size, Type>::getW(void) const throw()
{
return m_tElements[3];
@ -391,8 +391,8 @@ namespace PolyVox
\param index The index of the element to set.
\param tValue The new value for the element.
*/
template <uint32 Size, typename Type>
inline void Vector<Size, Type>::setElement(uint32 index, Type tValue) throw()
template <uint32_t Size, typename Type>
inline void Vector<Size, Type>::setElement(uint32_t index, Type tValue) throw()
{
m_tElements[index] = tValue;
}
@ -402,7 +402,7 @@ namespace PolyVox
\param x x component to set.
\param y y component to set.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
inline void Vector<Size,Type>::setElements(Type x, Type y) throw()
{
m_tElements[0] = x;
@ -416,7 +416,7 @@ namespace PolyVox
\param y y component to set.
\param z z component to set.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
inline void Vector<Size,Type>::setElements(Type x, Type y, Type z) throw()
{
m_tElements[0] = x;
@ -432,7 +432,7 @@ namespace PolyVox
\param z z component to set.
\param w w component to set.
*/
template <uint32 Size,typename Type>
template <uint32_t Size,typename Type>
inline void Vector<Size,Type>::setElements(Type x, Type y, Type z, Type w) throw()
{
m_tElements[0] = x;
@ -444,7 +444,7 @@ namespace PolyVox
/**
\param tX The new value for the X component of a 1, 2, 3, or 4 dimensional Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline void Vector<Size, Type>::setX(Type tX) throw()
{
m_tElements[0] = tX;
@ -453,7 +453,7 @@ namespace PolyVox
/**
\param tX The new value for the Y component of a 2, 3, or 4 dimensional Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline void Vector<Size, Type>::setY(Type tY) throw()
{
m_tElements[1] = tY;
@ -462,7 +462,7 @@ namespace PolyVox
/**
\param tX The new value for the Z component of a 3 or 4 dimensional Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline void Vector<Size, Type>::setZ(Type tZ) throw()
{
m_tElements[2] = tZ;
@ -471,7 +471,7 @@ namespace PolyVox
/**
\param tX The new value for the W component of a 4 dimensional Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline void Vector<Size, Type>::setW(Type tW) throw()
{
m_tElements[3] = tW;
@ -483,7 +483,7 @@ namespace PolyVox
NOTE: This function does not make much sense on integer Vectors.
\return Length of the Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline double Vector<Size, Type>::length(void) const throw()
{
return sqrt(lengthSquared());
@ -492,11 +492,11 @@ namespace PolyVox
/**
\return Squared length of the Vector.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline double Vector<Size, Type>::lengthSquared(void) const throw()
{
double result = 0.0f;
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
result += m_tElements[ct] * m_tElements[ct];
}
@ -512,7 +512,7 @@ namespace PolyVox
\param Vector3D The Vector to find the angle to.
\return The angle between them in radians.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline double Vector<Size, Type>::angleTo(const Vector<Size, Type>& vector) const throw()
{
return acos(dot(vector) / (vector.length() * this->length()));
@ -531,7 +531,7 @@ namespace PolyVox
\return The value of the cross product.
\see dot()
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Vector<Size, Type> Vector<Size, Type>::cross(const Vector<Size, Type>& vector) const throw()
{
Type i = vector.getZ() * this->getY() - vector.getY() * this->getZ();
@ -547,11 +547,11 @@ namespace PolyVox
\return The value of the dot product.
\see cross()
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline Type Vector<Size, Type>::dot(const Vector<Size, Type>& rhs) const throw()
{
Type dotProduct = static_cast<Type>(0);
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
dotProduct += m_tElements[ct] * rhs.m_tElements[ct];
}
@ -563,7 +563,7 @@ namespace PolyVox
NOTE: This function does not make much sense on integer Vectors.
*/
template <uint32 Size, typename Type>
template <uint32_t Size, typename Type>
inline void Vector<Size, Type>::normalise(void) throw()
{
double length = this->length();
@ -572,7 +572,7 @@ namespace PolyVox
{
return;
}
for(uint32 ct = 0; ct < Size; ++ct)
for(uint32_t ct = 0; ct < Size; ++ct)
{
m_tElements[ct] /= static_cast<Type>(length);
}

View File

@ -49,22 +49,22 @@ namespace PolyVox
friend class VolumeIterator<VoxelType>;
public:
Volume(uint16 uSideLength, uint16 uBlockSideLength = 64);
Volume(uint16_t uSideLength, uint16_t uBlockSideLength = 64);
Volume(const Volume& rhs);
~Volume();
Volume& operator=(const Volume& rhs);
Region getEnclosingRegion(void) const;
uint16 getSideLength(void) const;
VoxelType getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const;
uint16_t getSideLength(void) const;
VoxelType getVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const;
VoxelType getVoxelAt(const Vector3DUint16& v3dPos) const;
void setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue);
void setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue);
void setVoxelAt(const Vector3DUint16& v3dPos, VoxelType tValue);
VolumeIterator<VoxelType> firstVoxel(void);
void idle(uint32 uAmount);
void idle(uint32_t uAmount);
bool isRegionHomogenous(const Region& region);
VolumeIterator<VoxelType> lastVoxel(void);
@ -74,20 +74,20 @@ namespace PolyVox
Block<VoxelType>* m_pBlocks;
mutable std::map<VoxelType, POLYVOX_WEAK_PTR< BlockData<VoxelType> > > m_pHomogenousBlockData;
uint32 m_uNoOfBlocksInVolume;
uint16 m_uSideLengthInBlocks;
uint32_t m_uNoOfBlocksInVolume;
uint16_t m_uSideLengthInBlocks;
uint8 m_uSideLengthPower;
uint16 m_uSideLength;
uint8_t m_uSideLengthPower;
uint16_t m_uSideLength;
uint8 m_uBlockSideLengthPower;
uint16 m_uBlockSideLength;
uint8_t m_uBlockSideLengthPower;
uint16_t m_uBlockSideLength;
};
//Some handy typedefs
typedef Volume<float> FloatVolume;
typedef Volume<uint8> UInt8Volume;
typedef Volume<uint16> UInt16Volume;
typedef Volume<uint8_t> UInt8Volume;
typedef Volume<uint16_t> UInt16Volume;
}
#include "Volume.inl"

View File

@ -34,7 +34,7 @@ namespace PolyVox
{
#pragma region Constructors/Destructors
template <typename VoxelType>
Volume<VoxelType>::Volume(uint16 uSideLength, uint16 uBlockSideLength)
Volume<VoxelType>::Volume(uint16_t uSideLength, uint16_t uBlockSideLength)
:m_pBlocks(0)
{
//Debug mode validation
@ -75,7 +75,7 @@ namespace PolyVox
m_bIsShared = new bool[m_uNoOfBlocksInVolume];
m_bIsPotentiallySharable = new bool[m_uNoOfBlocksInVolume];
m_pHomogenousValue = new VoxelType[m_uNoOfBlocksInVolume];
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
for(uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
{
m_pBlocks[i] = getHomogenousBlock(0);
m_bIsShared[i] = true;
@ -84,7 +84,7 @@ namespace PolyVox
}*/
m_pBlocks = new Block<VoxelType>[m_uNoOfBlocksInVolume];
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
for(uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
{
m_pBlocks[i].m_pBlockData = getHomogenousBlockData(0);
m_pBlocks[i].m_bIsShared = true;
@ -102,7 +102,7 @@ namespace PolyVox
template <typename VoxelType>
Volume<VoxelType>::~Volume()
{
/*for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
/*for(uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
{
if(m_pBlocks[i].m_bIsShared == false)
{
@ -133,25 +133,25 @@ namespace PolyVox
}
template <typename VoxelType>
uint16 Volume<VoxelType>::getSideLength(void) const
uint16_t Volume<VoxelType>::getSideLength(void) const
{
return m_uSideLength;
}
template <typename VoxelType>
VoxelType Volume<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
VoxelType Volume<VoxelType>::getVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos) const
{
assert(uXPos < getSideLength());
assert(uYPos < getSideLength());
assert(uZPos < getSideLength());
const uint16 blockX = uXPos >> m_uBlockSideLengthPower;
const uint16 blockY = uYPos >> m_uBlockSideLengthPower;
const uint16 blockZ = uZPos >> m_uBlockSideLengthPower;
const uint16_t blockX = uXPos >> m_uBlockSideLengthPower;
const uint16_t blockY = uYPos >> m_uBlockSideLengthPower;
const uint16_t blockZ = uZPos >> m_uBlockSideLengthPower;
const uint16 xOffset = uXPos - (blockX << m_uBlockSideLengthPower);
const uint16 yOffset = uYPos - (blockY << m_uBlockSideLengthPower);
const uint16 zOffset = uZPos - (blockZ << m_uBlockSideLengthPower);
const uint16_t xOffset = uXPos - (blockX << m_uBlockSideLengthPower);
const uint16_t yOffset = uYPos - (blockY << m_uBlockSideLengthPower);
const uint16_t zOffset = uZPos - (blockZ << m_uBlockSideLengthPower);
const POLYVOX_SHARED_PTR< BlockData<VoxelType> > block = m_pBlocks
[
@ -176,17 +176,17 @@ namespace PolyVox
#pragma region Setters
template <typename VoxelType>
void Volume<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
void Volume<VoxelType>::setVoxelAt(uint16_t uXPos, uint16_t uYPos, uint16_t uZPos, VoxelType tValue)
{
const uint16 blockX = uXPos >> m_uBlockSideLengthPower;
const uint16 blockY = uYPos >> m_uBlockSideLengthPower;
const uint16 blockZ = uZPos >> m_uBlockSideLengthPower;
const uint16_t blockX = uXPos >> m_uBlockSideLengthPower;
const uint16_t blockY = uYPos >> m_uBlockSideLengthPower;
const uint16_t blockZ = uZPos >> m_uBlockSideLengthPower;
const uint16 xOffset = uXPos - (blockX << m_uBlockSideLengthPower);
const uint16 yOffset = uYPos - (blockY << m_uBlockSideLengthPower);
const uint16 zOffset = uZPos - (blockZ << m_uBlockSideLengthPower);
const uint16_t xOffset = uXPos - (blockX << m_uBlockSideLengthPower);
const uint16_t yOffset = uYPos - (blockY << m_uBlockSideLengthPower);
const uint16_t zOffset = uZPos - (blockZ << m_uBlockSideLengthPower);
const uint32 uBlockIndex =
const uint32_t uBlockIndex =
blockX +
blockY * m_uSideLengthInBlocks +
blockZ * m_uSideLengthInBlocks * m_uSideLengthInBlocks;
@ -230,14 +230,14 @@ namespace PolyVox
}
template <typename VoxelType>
void Volume<VoxelType>::idle(uint32 uAmount)
void Volume<VoxelType>::idle(uint32_t uAmount)
{
//This function performs two roles. Firstly, it examines all of the blocks which are marked as
//'potentially sharable' to determine whether they really are sharable or not. For those which
//are sharable, it adjusts the pointer and deletes tho old data. Secondly, it determines which
//homogeneous regions are not actually being used (by thier reference count) and frees them.
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
for(uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
{
Block<VoxelType> block = m_pBlocks[i];
if(block.m_bIsPotentiallySharable)

View File

@ -43,17 +43,17 @@ namespace PolyVox
bool operator<=(const VolumeIterator& rhs);
bool operator>=(const VolumeIterator& rhs);
uint16 getPosX(void) const;
uint16 getPosY(void) const;
uint16 getPosZ(void) const;
VoxelType getSubSampledVoxel(uint8 uLevel) const;
uint16_t getPosX(void) const;
uint16_t getPosY(void) const;
uint16_t getPosZ(void) const;
VoxelType getSubSampledVoxel(uint8_t uLevel) const;
const Volume<VoxelType>& getVolume(void) const;
VoxelType getVoxel(void) const;
void setPosition(const Vector3DInt16& v3dNewPos);
void setPosition(uint16 xPos, uint16 yPos, uint16 zPos);
void setPosition(uint16_t xPos, uint16_t yPos, uint16_t zPos);
void setValidRegion(const Region& region);
void setValidRegion(uint16 xFirst, uint16 yFirst, uint16 zFirst, uint16 xLast, uint16 yLast, uint16 zLast);
void setValidRegion(uint16_t xFirst, uint16_t yFirst, uint16_t zFirst, uint16_t xLast, uint16_t yLast, uint16_t zLast);
bool isValidForRegion(void) const;
void moveForwardInRegionFast(void);
@ -95,38 +95,38 @@ namespace PolyVox
Volume<VoxelType>& mVolume;
//The current position in the volume
uint16 mXPosInVolume;
uint16 mYPosInVolume;
uint16 mZPosInVolume;
uint16_t mXPosInVolume;
uint16_t mYPosInVolume;
uint16_t mZPosInVolume;
//The position of the current block
uint16 mXBlock;
uint16 mYBlock;
uint16 mZBlock;
uint16_t mXBlock;
uint16_t mYBlock;
uint16_t mZBlock;
//The offset into the current block
uint16 mXPosInBlock;
uint16 mYPosInBlock;
uint16 mZPosInBlock;
uint16_t mXPosInBlock;
uint16_t mYPosInBlock;
uint16_t mZPosInBlock;
//Other current position information
VoxelType* mCurrentVoxel;
uint32 mBlockIndexInVolume;
uint32 mVoxelIndexInBlock;
uint32_t mBlockIndexInVolume;
uint32_t mVoxelIndexInBlock;
uint16 mXRegionFirst;
uint16 mYRegionFirst;
uint16 mZRegionFirst;
uint16 mXRegionLast;
uint16 mYRegionLast;
uint16 mZRegionLast;
uint16_t mXRegionFirst;
uint16_t mYRegionFirst;
uint16_t mZRegionFirst;
uint16_t mXRegionLast;
uint16_t mYRegionLast;
uint16_t mZRegionLast;
uint16 mXRegionFirstBlock;
uint16 mYRegionFirstBlock;
uint16 mZRegionFirstBlock;
uint16 mXRegionLastBlock;
uint16 mYRegionLastBlock;
uint16 mZRegionLastBlock;
uint16_t mXRegionFirstBlock;
uint16_t mYRegionFirstBlock;
uint16_t mZRegionFirstBlock;
uint16_t mXRegionLastBlock;
uint16_t mYRegionLastBlock;
uint16_t mZRegionLastBlock;
bool mIsValidForRegion;
};

View File

@ -108,25 +108,25 @@ namespace PolyVox
#pragma region Getters
template <typename VoxelType>
uint16 VolumeIterator<VoxelType>::getPosX(void) const
uint16_t VolumeIterator<VoxelType>::getPosX(void) const
{
return mXPosInVolume;
}
template <typename VoxelType>
uint16 VolumeIterator<VoxelType>::getPosY(void) const
uint16_t VolumeIterator<VoxelType>::getPosY(void) const
{
return mYPosInVolume;
}
template <typename VoxelType>
uint16 VolumeIterator<VoxelType>::getPosZ(void) const
uint16_t VolumeIterator<VoxelType>::getPosZ(void) const
{
return mZPosInVolume;
}
template <typename VoxelType>
VoxelType VolumeIterator<VoxelType>::getSubSampledVoxel(uint8 uLevel) const
VoxelType VolumeIterator<VoxelType>::getSubSampledVoxel(uint8_t uLevel) const
{
if(uLevel == 0)
{
@ -146,14 +146,14 @@ namespace PolyVox
}
else
{
const uint8 uSize = 1 << uLevel;
const uint8_t uSize = 1 << uLevel;
VoxelType tValue = std::numeric_limits<VoxelType>::max();
for(uint8 z = 0; z < uSize; ++z)
for(uint8_t z = 0; z < uSize; ++z)
{
for(uint8 y = 0; y < uSize; ++y)
for(uint8_t y = 0; y < uSize; ++y)
{
for(uint8 x = 0; x < uSize; ++x)
for(uint8_t x = 0; x < uSize; ++x)
{
tValue = (std::min)(tValue, mVolume.getVoxelAt(mXPosInVolume + x, mYPosInVolume + y, mZPosInVolume + z));
}
@ -184,7 +184,7 @@ namespace PolyVox
}
template <typename VoxelType>
void VolumeIterator<VoxelType>::setPosition(uint16 xPos, uint16 yPos, uint16 zPos)
void VolumeIterator<VoxelType>::setPosition(uint16_t xPos, uint16_t yPos, uint16_t zPos)
{
mXPosInVolume = xPos;
mYPosInVolume = yPos;
@ -217,7 +217,7 @@ namespace PolyVox
}
template <typename VoxelType>
void VolumeIterator<VoxelType>::setValidRegion(uint16 xFirst, uint16 yFirst, uint16 zFirst, uint16 xLast, uint16 yLast, uint16 zLast)
void VolumeIterator<VoxelType>::setValidRegion(uint16_t xFirst, uint16_t yFirst, uint16_t zFirst, uint16_t xLast, uint16_t yLast, uint16_t zLast)
{
mXRegionFirst = xFirst;
mYRegionFirst = yFirst;
@ -252,7 +252,7 @@ namespace PolyVox
mXPosInVolume++;
if((mXPosInBlock == mVolume.m_uBlockSideLength) || (mXPosInVolume > mXRegionLast))
{
mXPosInVolume = (std::max)(mXRegionFirst,uint16(mXBlock * mVolume.m_uBlockSideLength));
mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * mVolume.m_uBlockSideLength));
mXPosInBlock = mXPosInVolume - (mXBlock << mVolume.m_uBlockSideLengthPower);
mVoxelIndexInBlock = mXPosInBlock +
mYPosInBlock * mVolume.m_uBlockSideLength +
@ -265,7 +265,7 @@ namespace PolyVox
mCurrentVoxel += mVolume.m_uBlockSideLength;
if((mYPosInBlock == mVolume.m_uBlockSideLength) || (mYPosInVolume > mYRegionLast))
{
mYPosInVolume = (std::max)(mYRegionFirst,uint16(mYBlock * mVolume.m_uBlockSideLength));
mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * mVolume.m_uBlockSideLength));
mYPosInBlock = mYPosInVolume - (mYBlock << mVolume.m_uBlockSideLengthPower);
mVoxelIndexInBlock = mXPosInBlock +
mYPosInBlock * mVolume.m_uBlockSideLength +
@ -312,9 +312,9 @@ namespace PolyVox
BlockData<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
//mCurrentBlock = mVolume->m_pBlocks[mBlockIndexInVolume];
mXPosInVolume = (std::max)(mXRegionFirst,uint16(mXBlock * mVolume.m_uBlockSideLength));
mYPosInVolume = (std::max)(mYRegionFirst,uint16(mYBlock * mVolume.m_uBlockSideLength));
mZPosInVolume = (std::max)(mZRegionFirst,uint16(mZBlock * mVolume.m_uBlockSideLength));
mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * mVolume.m_uBlockSideLength));
mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * mVolume.m_uBlockSideLength));
mZPosInVolume = (std::max)(mZRegionFirst,uint16_t(mZBlock * mVolume.m_uBlockSideLength));
mXPosInBlock = mXPosInVolume - (mXBlock << mVolume.m_uBlockSideLengthPower);
mYPosInBlock = mYPosInVolume - (mYBlock << mVolume.m_uBlockSideLengthPower);

View File

@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
float computeSmoothedVoxel(VolumeIterator<uint8>& volIter);
float computeSmoothedVoxel(VolumeIterator<uint8_t>& volIter);
}
#endif

View File

@ -31,11 +31,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox
{
POLYVOX_API Volume<uint8>* loadVolumeRaw(std::istream& stream);
POLYVOX_API void saveVolumeRaw(std::ostream& stream, Volume<uint8>& volume);
POLYVOX_API Volume<uint8_t>* loadVolumeRaw(std::istream& stream);
POLYVOX_API void saveVolumeRaw(std::ostream& stream, Volume<uint8_t>& volume);
POLYVOX_API Volume<uint8>* loadVolumeRle(std::istream& stream);
POLYVOX_API void saveVolumeRle(std::ostream& stream, Volume<uint8>& volume);
POLYVOX_API Volume<uint8_t>* loadVolumeRle(std::istream& stream);
POLYVOX_API void saveVolumeRle(std::ostream& stream, Volume<uint8_t>& volume);
}
#endif

View File

@ -36,43 +36,43 @@ namespace PolyVox
{
public:
//Constructors, etc
VolumeChangeTracker(Volume<uint8>* volumeDataToSet, uint16 regionSideLength);
VolumeChangeTracker(Volume<uint8_t>* volumeDataToSet, uint16_t regionSideLength);
~VolumeChangeTracker();
//Getters
int32 getCurrentTime(void) const;
int32_t getCurrentTime(void) const;
Region getEnclosingRegion(void) const;
int32 getLastModifiedTimeForRegion(uint16 uX, uint16 uY, uint16 uZ);
uint16 getSideLength(void);
Volume<uint8>* getVolumeData(void) const;
uint8 getVoxelAt(const Vector3DUint16& pos);
uint8 getVoxelAt(uint16 uX, uint16 uY, uint16 uZ);
int32_t getLastModifiedTimeForRegion(uint16_t uX, uint16_t uY, uint16_t uZ);
uint16_t getSideLength(void);
Volume<uint8_t>* getVolumeData(void) const;
uint8_t getVoxelAt(const Vector3DUint16& pos);
uint8_t getVoxelAt(uint16_t uX, uint16_t uY, uint16_t uZ);
//Setters
void setAllRegionsModified(void);
void setLockedVoxelAt(uint16 x, uint16 y, uint16 z, uint8 value);
void setVoxelAt(uint16 x, uint16 y, uint16 z, uint8 value);
void setLockedVoxelAt(uint16_t x, uint16_t y, uint16_t z, uint8_t value);
void setVoxelAt(uint16_t x, uint16_t y, uint16_t z, uint8_t value);
//Others
void lockRegion(const Region& regToLock);
void unlockRegion(void);
//void markRegionChanged(uint16 firstX, uint16 firstY, uint16 firstZ, uint16 lastX, uint16 lastY, uint16 lastZ);
//void markRegionChanged(uint16_t firstX, uint16_t firstY, uint16_t firstZ, uint16_t lastX, uint16_t lastY, uint16_t lastZ);
private:
bool m_bIsLocked;
Region m_regLastLocked;
Volume<uint8>* volumeData;
Volume<uint8_t>* volumeData;
uint16 m_uRegionSideLength;
uint8 m_uRegionSideLengthPower;
uint16 m_uVolumeSideLengthInRegions;
uint16_t m_uRegionSideLength;
uint8_t m_uRegionSideLengthPower;
uint16_t m_uVolumeSideLengthInRegions;
//It's not what the block class was designed for, but it
//provides a handy way of storing a 3D grid of values.
BlockData<int32>* volRegionLastModified;
BlockData<int32_t>* volRegionLastModified;
static int32 m_iCurrentTime;
static int32_t m_iCurrentTime;
};
}