Moved typedef'd integers into PlyVox namespace instead of std.
This commit is contained in:
@ -36,22 +36,22 @@ namespace PolyVox
|
||||
//Make BlockVolumeIterator a friend
|
||||
friend class BlockVolumeIterator<VoxelType>;
|
||||
public:
|
||||
Block(std::uint8_t uSideLengthPower);
|
||||
Block(uint8 uSideLengthPower);
|
||||
Block(const Block& rhs);
|
||||
~Block();
|
||||
|
||||
Block& operator=(const Block& rhs);
|
||||
|
||||
std::uint16_t getSideLength(void) const;
|
||||
VoxelType getVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos) const;
|
||||
uint16 getSideLength(void) const;
|
||||
VoxelType getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const;
|
||||
|
||||
void setVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos, VoxelType tValue);
|
||||
void setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue);
|
||||
|
||||
void fill(VoxelType tValue);
|
||||
|
||||
private:
|
||||
std::uint8_t m_uSideLengthPower;
|
||||
std::uint16_t m_uSideLength;
|
||||
uint8 m_uSideLengthPower;
|
||||
uint16 m_uSideLength;
|
||||
VoxelType* m_tData;
|
||||
};
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace PolyVox
|
||||
{
|
||||
#pragma region Constructors/Destructors
|
||||
template <typename VoxelType>
|
||||
Block<VoxelType>::Block(std::uint8_t uSideLengthPower)
|
||||
Block<VoxelType>::Block(uint8 uSideLengthPower)
|
||||
:m_tData(0)
|
||||
{
|
||||
//Check the block size is sensible. This corresponds to a side length of 256 voxels
|
||||
@ -76,13 +76,13 @@ namespace PolyVox
|
||||
|
||||
#pragma region Getters
|
||||
template <typename VoxelType>
|
||||
std::uint16_t Block<VoxelType>::getSideLength(void) const
|
||||
uint16 Block<VoxelType>::getSideLength(void) const
|
||||
{
|
||||
return m_uSideLength;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType Block<VoxelType>::getVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos) const
|
||||
VoxelType Block<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
|
||||
{
|
||||
assert(uXPos < m_uSideLength);
|
||||
assert(uYPos < m_uSideLength);
|
||||
@ -99,7 +99,7 @@ namespace PolyVox
|
||||
|
||||
#pragma region Setters
|
||||
template <typename VoxelType>
|
||||
void Block<VoxelType>::setVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos, VoxelType tValue)
|
||||
void Block<VoxelType>::setVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos, VoxelType tValue)
|
||||
{
|
||||
assert(uXPos < m_uSideLength);
|
||||
assert(uYPos < m_uSideLength);
|
||||
|
@ -39,21 +39,21 @@ namespace PolyVox
|
||||
friend class BlockVolumeIterator<VoxelType>;
|
||||
|
||||
public:
|
||||
BlockVolume(std::uint8_t uSideLengthPower, std::uint8_t uBlockSideLengthPower = 5);
|
||||
BlockVolume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower = 5);
|
||||
BlockVolume(const BlockVolume& rhs);
|
||||
~BlockVolume();
|
||||
|
||||
BlockVolume& operator=(const BlockVolume& rhs);
|
||||
|
||||
Region getEnclosingRegion(void) const;
|
||||
std::uint16_t getSideLength(void) const;
|
||||
VoxelType getVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos) const;
|
||||
uint16 getSideLength(void) const;
|
||||
VoxelType getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const;
|
||||
VoxelType getVoxelAt(const Vector3DUint16& v3dPos) const;
|
||||
|
||||
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, std::uint16_t boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, uint16 boundary) const;
|
||||
BlockVolumeIterator<VoxelType> firstVoxel(void);
|
||||
void idle(std::uint32_t uAmount);
|
||||
void idle(uint32 uAmount);
|
||||
BlockVolumeIterator<VoxelType> lastVoxel(void);
|
||||
|
||||
private:
|
||||
@ -65,20 +65,20 @@ namespace PolyVox
|
||||
VoxelType* m_pHomogenousValue;
|
||||
mutable std::map<VoxelType, Block<VoxelType>*> m_pHomogenousBlocks;
|
||||
|
||||
std::uint32_t m_uNoOfBlocksInVolume;
|
||||
std::uint16_t m_uSideLengthInBlocks;
|
||||
uint32 m_uNoOfBlocksInVolume;
|
||||
uint16 m_uSideLengthInBlocks;
|
||||
|
||||
std::uint8_t m_uSideLengthPower;
|
||||
std::uint16_t m_uSideLength;
|
||||
uint8 m_uSideLengthPower;
|
||||
uint16 m_uSideLength;
|
||||
|
||||
std::uint8_t m_uBlockSideLengthPower;
|
||||
std::uint16_t m_uBlockSideLength;
|
||||
uint8 m_uBlockSideLengthPower;
|
||||
uint16 m_uBlockSideLength;
|
||||
};
|
||||
|
||||
//Some handy typedefs
|
||||
typedef BlockVolume<float> FloatBlockVolume;
|
||||
typedef BlockVolume<std::uint8_t> UInt8BlockVolume;
|
||||
typedef BlockVolume<std::uint16_t> UInt16BlockVolume;
|
||||
typedef BlockVolume<uint8> UInt8BlockVolume;
|
||||
typedef BlockVolume<uint16> UInt16BlockVolume;
|
||||
}
|
||||
|
||||
#include "BlockVolume.inl"
|
||||
|
@ -32,7 +32,7 @@ namespace PolyVox
|
||||
{
|
||||
#pragma region Constructors/Destructors
|
||||
template <typename VoxelType>
|
||||
BlockVolume<VoxelType>::BlockVolume(std::uint8_t uSideLengthPower, std::uint8_t uBlockSideLengthPower)
|
||||
BlockVolume<VoxelType>::BlockVolume(uint8 uSideLengthPower, uint8 uBlockSideLengthPower)
|
||||
:m_pBlocks(0)
|
||||
{
|
||||
//Check the volume size is sensible. This corresponds to a side length of 65536 voxels
|
||||
@ -60,7 +60,7 @@ namespace PolyVox
|
||||
m_pIsShared = new bool[m_uNoOfBlocksInVolume];
|
||||
m_pIsPotentiallySharable = new bool[m_uNoOfBlocksInVolume];
|
||||
m_pHomogenousValue = new VoxelType[m_uNoOfBlocksInVolume];
|
||||
for(std::uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
{
|
||||
m_pBlocks[i] = getHomogenousBlock(0); //new Block<VoxelType>(uBlockSideLengthPower);
|
||||
m_pIsShared[i] = true;
|
||||
@ -78,7 +78,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
BlockVolume<VoxelType>::~BlockVolume()
|
||||
{
|
||||
for(std::uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
{
|
||||
delete m_pBlocks[i];
|
||||
}
|
||||
@ -94,13 +94,13 @@ namespace PolyVox
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*for(uint16_t i = 0; i < POLYVOX_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
||||
/*for(uint16 i = 0; i < POLYVOX_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
||||
{
|
||||
//FIXME - Add checking...
|
||||
m_pBlocks[i] = SharedPtr<Block>(new Block);
|
||||
}*/
|
||||
|
||||
for(uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
for(uint32 i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
{
|
||||
//I think this is OK... If a block is in the homogeneous array it's ref count will be greater
|
||||
//than 1 as there will be the pointer in the volume and the pointer in the static homogeneous array.
|
||||
@ -127,25 +127,25 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
std::uint16_t BlockVolume<VoxelType>::getSideLength(void) const
|
||||
uint16 BlockVolume<VoxelType>::getSideLength(void) const
|
||||
{
|
||||
return m_uSideLength;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolume<VoxelType>::getVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos) const
|
||||
VoxelType BlockVolume<VoxelType>::getVoxelAt(uint16 uXPos, uint16 uYPos, uint16 uZPos) const
|
||||
{
|
||||
assert(uXPos < getSideLength());
|
||||
assert(uYPos < getSideLength());
|
||||
assert(uZPos < getSideLength());
|
||||
|
||||
const std::uint16_t blockX = uXPos >> m_uBlockSideLengthPower;
|
||||
const std::uint16_t blockY = uYPos >> m_uBlockSideLengthPower;
|
||||
const std::uint16_t blockZ = uZPos >> m_uBlockSideLengthPower;
|
||||
const uint16 blockX = uXPos >> m_uBlockSideLengthPower;
|
||||
const uint16 blockY = uYPos >> m_uBlockSideLengthPower;
|
||||
const uint16 blockZ = uZPos >> m_uBlockSideLengthPower;
|
||||
|
||||
const std::uint16_t xOffset = uXPos - (blockX << m_uBlockSideLengthPower);
|
||||
const std::uint16_t yOffset = uYPos - (blockY << m_uBlockSideLengthPower);
|
||||
const std::uint16_t zOffset = uZPos - (blockZ << m_uBlockSideLengthPower);
|
||||
const uint16 xOffset = uXPos - (blockX << m_uBlockSideLengthPower);
|
||||
const uint16 yOffset = uYPos - (blockY << m_uBlockSideLengthPower);
|
||||
const uint16 zOffset = uZPos - (blockZ << m_uBlockSideLengthPower);
|
||||
|
||||
const Block<VoxelType>* block = m_pBlocks
|
||||
[
|
||||
@ -181,7 +181,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolume<VoxelType>::containsPoint(const Vector3DInt32& pos, std::uint16_t boundary) const
|
||||
bool BlockVolume<VoxelType>::containsPoint(const Vector3DInt32& pos, uint16 boundary) const
|
||||
{
|
||||
return (pos.getX() <= m_uSideLength - 1 - boundary)
|
||||
&& (pos.getY() <= m_uSideLength - 1 - boundary)
|
||||
@ -200,7 +200,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolume<VoxelType>::idle(std::uint32_t uAmount)
|
||||
void BlockVolume<VoxelType>::idle(uint32 uAmount)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -43,17 +43,17 @@ namespace PolyVox
|
||||
bool operator<=(const BlockVolumeIterator& rhs);
|
||||
bool operator>=(const BlockVolumeIterator& rhs);
|
||||
|
||||
std::uint16_t getPosX(void) const;
|
||||
std::uint16_t getPosY(void) const;
|
||||
std::uint16_t getPosZ(void) const;
|
||||
VoxelType getSubSampledVoxel(std::uint8_t uLevel) const;
|
||||
uint16 getPosX(void) const;
|
||||
uint16 getPosY(void) const;
|
||||
uint16 getPosZ(void) const;
|
||||
VoxelType getSubSampledVoxel(uint8 uLevel) const;
|
||||
const BlockVolume<VoxelType>& getVolume(void) const;
|
||||
VoxelType getVoxel(void) const;
|
||||
|
||||
void setPosition(const Vector3DInt16& v3dNewPos);
|
||||
void setPosition(std::uint16_t xPos, std::uint16_t yPos, std::uint16_t zPos);
|
||||
void setPosition(uint16 xPos, uint16 yPos, uint16 zPos);
|
||||
void setValidRegion(const Region& region);
|
||||
void setValidRegion(std::uint16_t xFirst, std::uint16_t yFirst, std::uint16_t zFirst, std::uint16_t xLast, std::uint16_t yLast, std::uint16_t zLast);
|
||||
void setValidRegion(uint16 xFirst, uint16 yFirst, uint16 zFirst, uint16 xLast, uint16 yLast, uint16 zLast);
|
||||
void setVoxel(VoxelType tValue);
|
||||
|
||||
bool isValidForRegion(void) const;
|
||||
@ -96,38 +96,38 @@ namespace PolyVox
|
||||
BlockVolume<VoxelType>& mVolume;
|
||||
|
||||
//The current position in the volume
|
||||
std::uint16_t mXPosInVolume;
|
||||
std::uint16_t mYPosInVolume;
|
||||
std::uint16_t mZPosInVolume;
|
||||
uint16 mXPosInVolume;
|
||||
uint16 mYPosInVolume;
|
||||
uint16 mZPosInVolume;
|
||||
|
||||
//The position of the current block
|
||||
std::uint16_t mXBlock;
|
||||
std::uint16_t mYBlock;
|
||||
std::uint16_t mZBlock;
|
||||
uint16 mXBlock;
|
||||
uint16 mYBlock;
|
||||
uint16 mZBlock;
|
||||
|
||||
//The offset into the current block
|
||||
std::uint16_t mXPosInBlock;
|
||||
std::uint16_t mYPosInBlock;
|
||||
std::uint16_t mZPosInBlock;
|
||||
uint16 mXPosInBlock;
|
||||
uint16 mYPosInBlock;
|
||||
uint16 mZPosInBlock;
|
||||
|
||||
//Other current position information
|
||||
VoxelType* mCurrentVoxel;
|
||||
std::uint32_t mBlockIndexInVolume;
|
||||
std::uint32_t mVoxelIndexInBlock;
|
||||
uint32 mBlockIndexInVolume;
|
||||
uint32 mVoxelIndexInBlock;
|
||||
|
||||
std::uint16_t mXRegionFirst;
|
||||
std::uint16_t mYRegionFirst;
|
||||
std::uint16_t mZRegionFirst;
|
||||
std::uint16_t mXRegionLast;
|
||||
std::uint16_t mYRegionLast;
|
||||
std::uint16_t mZRegionLast;
|
||||
uint16 mXRegionFirst;
|
||||
uint16 mYRegionFirst;
|
||||
uint16 mZRegionFirst;
|
||||
uint16 mXRegionLast;
|
||||
uint16 mYRegionLast;
|
||||
uint16 mZRegionLast;
|
||||
|
||||
std::uint16_t mXRegionFirstBlock;
|
||||
std::uint16_t mYRegionFirstBlock;
|
||||
std::uint16_t mZRegionFirstBlock;
|
||||
std::uint16_t mXRegionLastBlock;
|
||||
std::uint16_t mYRegionLastBlock;
|
||||
std::uint16_t mZRegionLastBlock;
|
||||
uint16 mXRegionFirstBlock;
|
||||
uint16 mYRegionFirstBlock;
|
||||
uint16 mZRegionFirstBlock;
|
||||
uint16 mXRegionLastBlock;
|
||||
uint16 mYRegionLastBlock;
|
||||
uint16 mZRegionLastBlock;
|
||||
|
||||
bool mIsValidForRegion;
|
||||
};
|
||||
|
@ -105,25 +105,25 @@ namespace PolyVox
|
||||
|
||||
#pragma region Getters
|
||||
template <typename VoxelType>
|
||||
std::uint16_t BlockVolumeIterator<VoxelType>::getPosX(void) const
|
||||
uint16 BlockVolumeIterator<VoxelType>::getPosX(void) const
|
||||
{
|
||||
return mXPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
std::uint16_t BlockVolumeIterator<VoxelType>::getPosY(void) const
|
||||
uint16 BlockVolumeIterator<VoxelType>::getPosY(void) const
|
||||
{
|
||||
return mYPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
std::uint16_t BlockVolumeIterator<VoxelType>::getPosZ(void) const
|
||||
uint16 BlockVolumeIterator<VoxelType>::getPosZ(void) const
|
||||
{
|
||||
return mZPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::getSubSampledVoxel(std::uint8_t uLevel) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::getSubSampledVoxel(uint8 uLevel) const
|
||||
{
|
||||
if(uLevel == 0)
|
||||
{
|
||||
@ -143,14 +143,14 @@ namespace PolyVox
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::uint8_t uSize = 1 << uLevel;
|
||||
const uint8 uSize = 1 << uLevel;
|
||||
|
||||
VoxelType tValue = 0;
|
||||
for(std::uint8_t z = 0; z < uSize; ++z)
|
||||
for(uint8 z = 0; z < uSize; ++z)
|
||||
{
|
||||
for(std::uint8_t y = 0; y < uSize; ++y)
|
||||
for(uint8 y = 0; y < uSize; ++y)
|
||||
{
|
||||
for(std::uint8_t x = 0; x < uSize; ++x)
|
||||
for(uint8 x = 0; x < uSize; ++x)
|
||||
{
|
||||
tValue = (std::max)(tValue, mVolume.getVoxelAt(mXPosInVolume + x, mYPosInVolume + y, mZPosInVolume + z));
|
||||
}
|
||||
@ -181,7 +181,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setPosition(std::uint16_t xPos, std::uint16_t yPos, std::uint16_t zPos)
|
||||
void BlockVolumeIterator<VoxelType>::setPosition(uint16 xPos, uint16 yPos, uint16 zPos)
|
||||
{
|
||||
mXPosInVolume = xPos;
|
||||
mYPosInVolume = yPos;
|
||||
@ -214,7 +214,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setValidRegion(std::uint16_t xFirst, std::uint16_t yFirst, std::uint16_t zFirst, std::uint16_t xLast, std::uint16_t yLast, std::uint16_t zLast)
|
||||
void BlockVolumeIterator<VoxelType>::setValidRegion(uint16 xFirst, uint16 yFirst, uint16 zFirst, uint16 xLast, uint16 yLast, uint16 zLast)
|
||||
{
|
||||
mXRegionFirst = xFirst;
|
||||
mYRegionFirst = yFirst;
|
||||
@ -236,7 +236,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setVoxel(VoxelType tValue)
|
||||
{
|
||||
const std::uint32_t uBlockIndex =
|
||||
const uint32 uBlockIndex =
|
||||
mXBlock +
|
||||
mYBlock * mVolume.m_uSideLengthInBlocks +
|
||||
mZBlock * mVolume.m_uSideLengthInBlocks * mVolume.m_uSideLengthInBlocks;
|
||||
@ -278,7 +278,7 @@ namespace PolyVox
|
||||
mXPosInVolume++;
|
||||
if((mXPosInBlock == mVolume.m_uBlockSideLength) || (mXPosInVolume > mXRegionLast))
|
||||
{
|
||||
mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * mVolume.m_uBlockSideLength));
|
||||
mXPosInVolume = (std::max)(mXRegionFirst,uint16(mXBlock * mVolume.m_uBlockSideLength));
|
||||
mXPosInBlock = mXPosInVolume - (mXBlock << mVolume.m_uBlockSideLengthPower);
|
||||
mVoxelIndexInBlock = mXPosInBlock +
|
||||
mYPosInBlock * mVolume.m_uBlockSideLength +
|
||||
@ -291,7 +291,7 @@ namespace PolyVox
|
||||
mCurrentVoxel += mVolume.m_uBlockSideLength;
|
||||
if((mYPosInBlock == mVolume.m_uBlockSideLength) || (mYPosInVolume > mYRegionLast))
|
||||
{
|
||||
mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * mVolume.m_uBlockSideLength));
|
||||
mYPosInVolume = (std::max)(mYRegionFirst,uint16(mYBlock * mVolume.m_uBlockSideLength));
|
||||
mYPosInBlock = mYPosInVolume - (mYBlock << mVolume.m_uBlockSideLengthPower);
|
||||
mVoxelIndexInBlock = mXPosInBlock +
|
||||
mYPosInBlock * mVolume.m_uBlockSideLength +
|
||||
@ -338,9 +338,9 @@ namespace PolyVox
|
||||
Block<VoxelType>* currentBlock = mVolume.m_pBlocks[mBlockIndexInVolume];
|
||||
//mCurrentBlock = mVolume->m_pBlocks[mBlockIndexInVolume];
|
||||
|
||||
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));
|
||||
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));
|
||||
|
||||
mXPosInBlock = mXPosInVolume - (mXBlock << mVolume.m_uBlockSideLengthPower);
|
||||
mYPosInBlock = mYPosInVolume - (mYBlock << mVolume.m_uBlockSideLengthPower);
|
||||
|
@ -22,24 +22,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#ifndef __PolyVox_Constants_H__
|
||||
#define __PolyVox_Constants_H__
|
||||
|
||||
#include "PolyVoxCStdInt.h"
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
//FIXME - i think we can define mod using a bitmask which flattens the upper bits. Should define that here.
|
||||
//const std::uint32_t POLYVOX_BLOCK_SIDE_LENGTH_POWER = 5;
|
||||
//const std::uint32_t POLYVOX_BLOCK_SIDE_LENGTH = (0x0001 << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||
//const std::uint32_t POLYVOX_NO_OF_VOXELS_IN_BLOCK = (POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH);
|
||||
//const uint32 POLYVOX_BLOCK_SIDE_LENGTH_POWER = 5;
|
||||
//const uint32 POLYVOX_BLOCK_SIDE_LENGTH = (0x0001 << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||
//const uint32 POLYVOX_NO_OF_VOXELS_IN_BLOCK = (POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH);
|
||||
|
||||
const std::uint16_t POLYVOX_VOLUME_SIDE_LENGTH_POWER = 8;
|
||||
const std::uint16_t POLYVOX_VOLUME_SIDE_LENGTH = (0x0001 << POLYVOX_VOLUME_SIDE_LENGTH_POWER);
|
||||
//const std::uint32_t POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||
//const std::uint32_t POLYVOX_NO_OF_BLOCKS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS);
|
||||
//const std::uint32_t POLYVOX_NO_OF_VOXELS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH);
|
||||
const uint16 POLYVOX_VOLUME_SIDE_LENGTH_POWER = 8;
|
||||
const uint16 POLYVOX_VOLUME_SIDE_LENGTH = (0x0001 << POLYVOX_VOLUME_SIDE_LENGTH_POWER);
|
||||
//const uint32 POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||
//const uint32 POLYVOX_NO_OF_BLOCKS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS);
|
||||
//const uint32 POLYVOX_NO_OF_VOXELS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH);
|
||||
|
||||
const std::uint16_t POLYVOX_REGION_SIDE_LENGTH_POWER = 4;
|
||||
const std::uint16_t POLYVOX_REGION_SIDE_LENGTH = (0x0001 << POLYVOX_REGION_SIDE_LENGTH_POWER);
|
||||
const std::uint16_t POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_REGION_SIDE_LENGTH_POWER);
|
||||
const uint16 POLYVOX_REGION_SIDE_LENGTH_POWER = 4;
|
||||
const uint16 POLYVOX_REGION_SIDE_LENGTH = (0x0001 << POLYVOX_REGION_SIDE_LENGTH_POWER);
|
||||
const uint16 POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_REGION_SIDE_LENGTH_POWER);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -40,8 +40,8 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSobelGradient(const BlockVolumeIterator<VoxelType>& volIter);
|
||||
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<std::uint8_t>* volumeData, RegionGeometry& regGeom, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API Vector3DFloat computeNormal(BlockVolume<std::uint8_t>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<uint8>* volumeData, RegionGeometry& regGeom, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API Vector3DFloat computeNormal(BlockVolume<uint8>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod);
|
||||
}
|
||||
|
||||
#include "GradientEstimators.inl"
|
||||
|
@ -47,9 +47,9 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeDecimatedCentralDifferenceGradient(const BlockVolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
const uint16_t x = volIter.getPosX();
|
||||
const uint16_t y = volIter.getPosY();
|
||||
const uint16_t z = volIter.getPosZ();
|
||||
const uint16 x = volIter.getPosX();
|
||||
const uint16 y = volIter.getPosY();
|
||||
const uint16 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(BlockVolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
std::uint16_t initialX = volIter.getPosX();
|
||||
std::uint16_t initialY = volIter.getPosY();
|
||||
std::uint16_t initialZ = volIter.getPosZ();
|
||||
uint16 initialX = volIter.getPosX();
|
||||
uint16 initialY = volIter.getPosY();
|
||||
uint16 initialZ = volIter.getPosZ();
|
||||
|
||||
//FIXME - bitwise way of doing this?
|
||||
volIter.setPosition(initialX-1, initialY, initialZ);
|
||||
|
@ -40,17 +40,17 @@ namespace PolyVox
|
||||
~IndexedSurfacePatch();
|
||||
|
||||
void addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2);
|
||||
void fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<std::uint32_t>& vecIndices);
|
||||
void fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<uint32>& vecIndices);
|
||||
|
||||
const std::vector<SurfaceVertex>& getVertices(void) const;
|
||||
std::vector<SurfaceVertex>& getVertices(void); //FIXME - non const version should be removed.
|
||||
const std::vector<std::uint32_t>& getIndices(void) const;
|
||||
const std::vector<uint32>& getIndices(void) const;
|
||||
|
||||
unsigned short getNoNonUniformTrianges(void);
|
||||
unsigned short getNoUniformTrianges(void);
|
||||
|
||||
public:
|
||||
std::vector<std::uint32_t> m_vecTriangleIndices;
|
||||
std::vector<uint32> m_vecTriangleIndices;
|
||||
std::vector<SurfaceVertex> m_vecVertices;
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,7 @@ namespace PolyVox
|
||||
class LinearVolume
|
||||
{
|
||||
public:
|
||||
LinearVolume(std::uint8_t uSideLengthPower);
|
||||
LinearVolume(uint8 uSideLengthPower);
|
||||
LinearVolume(const LinearVolume& rhs);
|
||||
~LinearVolume();
|
||||
|
||||
@ -44,17 +44,17 @@ namespace PolyVox
|
||||
|
||||
//bool isHomogeneous(void);
|
||||
|
||||
std::uint16_t getSideLength(void);
|
||||
uint16 getSideLength(void);
|
||||
|
||||
VoxelType getVoxelAt(const std::uint16_t xPosition, const std::uint16_t yPosition, const std::uint16_t zPosition) const;
|
||||
void setVoxelAt(const std::uint16_t xPosition, const std::uint16_t yPosition, const std::uint16_t zPosition, const VoxelType value);
|
||||
VoxelType getVoxelAt(const uint16 xPosition, const uint16 yPosition, const uint16 zPosition) const;
|
||||
void setVoxelAt(const uint16 xPosition, const uint16 yPosition, const uint16 zPosition, const VoxelType value);
|
||||
|
||||
//void fillWithValue(const VoxelType value);
|
||||
|
||||
private:
|
||||
std::uint32_t getNoOfVoxels(void);
|
||||
std::uint8_t m_uSideLengthPower;
|
||||
std::uint16_t m_uSideLength;
|
||||
uint32 getNoOfVoxels(void);
|
||||
uint8 m_uSideLengthPower;
|
||||
uint16 m_uSideLength;
|
||||
VoxelType* m_tData;
|
||||
};
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace PolyVox
|
||||
{
|
||||
|
||||
template <typename VoxelType>
|
||||
LinearVolume<VoxelType>::LinearVolume(std::uint8_t uSideLengthPower)
|
||||
LinearVolume<VoxelType>::LinearVolume(uint8 uSideLengthPower)
|
||||
:m_tData(0)
|
||||
{
|
||||
//Check the block size is sensible. This corresponds to a side length of 256 voxels
|
||||
@ -67,7 +67,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType LinearVolume<VoxelType>::getVoxelAt(const std::uint16_t xPosition, const std::uint16_t yPosition, const std::uint16_t zPosition) const
|
||||
VoxelType LinearVolume<VoxelType>::getVoxelAt(const uint16 xPosition, const uint16 yPosition, const uint16 zPosition) const
|
||||
{
|
||||
return m_tData
|
||||
[
|
||||
@ -78,7 +78,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void LinearVolume<VoxelType>::setVoxelAt(const std::uint16_t xPosition, const std::uint16_t yPosition, const std::uint16_t zPosition, const VoxelType value)
|
||||
void LinearVolume<VoxelType>::setVoxelAt(const uint16 xPosition, const uint16 yPosition, const uint16 zPosition, const VoxelType value)
|
||||
{
|
||||
m_tData
|
||||
[
|
||||
@ -89,13 +89,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
std::uint16_t LinearVolume<VoxelType>::getSideLength(void)
|
||||
uint16 LinearVolume<VoxelType>::getSideLength(void)
|
||||
{
|
||||
return m_uSideLength;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
std::uint32_t LinearVolume<VoxelType>::getNoOfVoxels(void)
|
||||
uint32 LinearVolume<VoxelType>::getNoOfVoxels(void)
|
||||
{
|
||||
return m_uSideLength * m_uSideLength * m_uSideLength;
|
||||
}
|
||||
|
@ -24,14 +24,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
//Adding things to the std namespace in not actually allowed, but Microsoft
|
||||
//have still not added <cstdint> to thier standard library.
|
||||
namespace std
|
||||
namespace PolyVox
|
||||
{
|
||||
typedef char int8_t;
|
||||
typedef short int16_t;
|
||||
typedef long int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef char int8;
|
||||
typedef short int16;
|
||||
typedef long int32;
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned long uint32;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#define __PolyVox_ForwardDeclarations_H__
|
||||
|
||||
#include "Enums.h"
|
||||
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
namespace PolyVox
|
||||
@ -33,8 +32,8 @@ namespace PolyVox
|
||||
//---------- BlockVolume ----------
|
||||
template <typename VoxelType> class BlockVolume;
|
||||
typedef BlockVolume<float> FloatBlockVolume;
|
||||
typedef BlockVolume<std::uint8_t> UInt8BlockVolume;
|
||||
typedef BlockVolume<std::uint16_t> UInt16BlockVolume;
|
||||
typedef BlockVolume<uint8> UInt8BlockVolume;
|
||||
typedef BlockVolume<uint16> UInt16BlockVolume;
|
||||
//---------------------------------
|
||||
|
||||
class IndexedSurfacePatch;
|
||||
@ -45,15 +44,15 @@ namespace PolyVox
|
||||
class SurfaceVertex;
|
||||
|
||||
//---------- Vector ----------
|
||||
template <std::uint32_t Size, typename Type> class Vector;
|
||||
template <uint32 Size, typename Type> class Vector;
|
||||
typedef Vector<3,float> Vector3DFloat;
|
||||
typedef Vector<3,double> Vector3DDouble;
|
||||
typedef Vector<3,std::int8_t> Vector3DInt8;
|
||||
typedef Vector<3,std::uint8_t> Vector3DUint8;
|
||||
typedef Vector<3,std::int16_t> Vector3DInt16;
|
||||
typedef Vector<3,std::uint16_t> Vector3DUint16;
|
||||
typedef Vector<3,std::int32_t> Vector3DInt32;
|
||||
typedef Vector<3,std::uint32_t> Vector3DUint32;
|
||||
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;
|
||||
//----------------------------
|
||||
|
||||
class VolumeChangeTracker;
|
||||
|
@ -42,7 +42,7 @@ namespace PolyVox
|
||||
void setUpperCorner(const Vector3DInt32& v3dUpperCorner);
|
||||
|
||||
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, std::uint8_t boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, uint8 boundary) const;
|
||||
void cropTo(const Region& other);
|
||||
void shift(const Vector3DInt32& amount);
|
||||
|
||||
|
@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API void smoothRegionGeometry(BlockVolume<std::uint8_t>* volumeData, RegionGeometry& regGeom);
|
||||
POLYVOX_API void adjustDecimatedGeometry(BlockVolume<std::uint8_t>* volumeData, RegionGeometry& regGeom, std::uint8_t val);
|
||||
POLYVOX_API void smoothRegionGeometry(BlockVolume<uint8>* volumeData, RegionGeometry& regGeom);
|
||||
POLYVOX_API void adjustDecimatedGeometry(BlockVolume<uint8>* volumeData, RegionGeometry& regGeom, uint8 val);
|
||||
}
|
||||
|
||||
#endif
|
@ -36,18 +36,18 @@ namespace PolyVox
|
||||
{
|
||||
POLYVOX_API std::list<RegionGeometry> getChangedRegionGeometry(VolumeChangeTracker& volume);
|
||||
|
||||
std::uint32_t getIndex(std::uint32_t x, std::uint32_t y);
|
||||
uint32 getIndex(uint32 x, uint32 y);
|
||||
|
||||
POLYVOX_API void generateRoughMeshDataForRegion(BlockVolume<std::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API std::uint32_t computeInitialRoughBitmaskForSlice(BlockVolumeIterator<std::uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, std::uint8_t *bitmask);
|
||||
POLYVOX_API std::uint32_t computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<std::uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, std::uint8_t *bitmask, std::uint8_t *previousBitmask);
|
||||
POLYVOX_API void generateRoughIndicesForSlice(BlockVolumeIterator<std::uint8_t>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, std::uint8_t* bitmask0, std::uint8_t* bitmask1, std::int32_t vertexIndicesX0[],std::int32_t vertexIndicesY0[],std::int32_t vertexIndicesZ0[], std::int32_t vertexIndicesX1[],std::int32_t vertexIndicesY1[],std::int32_t vertexIndicesZ1[]);
|
||||
POLYVOX_API void generateRoughVerticesForSlice(BlockVolumeIterator<std::uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, std::uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,std::int32_t vertexIndicesX[],std::int32_t vertexIndicesY[],std::int32_t vertexIndicesZ[]);
|
||||
POLYVOX_API void generateRoughMeshDataForRegion(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API uint32 computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
|
||||
POLYVOX_API uint32 computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
|
||||
POLYVOX_API void generateRoughIndicesForSlice(BlockVolumeIterator<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[]);
|
||||
POLYVOX_API void generateRoughVerticesForSlice(BlockVolumeIterator<uint8>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
|
||||
|
||||
POLYVOX_API void generateReferenceMeshDataForRegion(BlockVolume<std::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API void generateReferenceMeshDataForRegion(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
|
||||
std::int32_t getIndexFor(const Vector3DFloat& pos, std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
|
||||
void setIndexFor(const Vector3DFloat& pos, std::int32_t newIndex, std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
|
||||
int32 getIndexFor(const Vector3DFloat& pos, int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
|
||||
void setIndexFor(const Vector3DFloat& pos, int32 newIndex, int32 vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1], int32 vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -34,17 +34,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
std::uint32_t getDecimatedIndex(std::uint32_t x, std::uint32_t y);
|
||||
uint32 getDecimatedIndex(uint32 x, uint32 y);
|
||||
|
||||
POLYVOX_API void generateDecimatedMeshDataForRegion(BlockVolume<std::uint8_t>* volumeData, std::uint8_t uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API std::uint32_t computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<std::uint8_t>& volIter, std::uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, std::uint8_t *bitmask);
|
||||
POLYVOX_API std::uint32_t computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<std::uint8_t>& volIter, std::uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, std::uint8_t *bitmask, std::uint8_t *previousBitmask);
|
||||
POLYVOX_API void generateDecimatedIndicesForSlice(BlockVolumeIterator<std::uint8_t>& volIter, std::uint8_t uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, std::uint8_t* bitmask0, std::uint8_t* bitmask1, std::int32_t vertexIndicesX0[],std::int32_t vertexIndicesY0[],std::int32_t vertexIndicesZ0[], std::int32_t vertexIndicesX1[],std::int32_t vertexIndicesY1[],std::int32_t vertexIndicesZ1[]);
|
||||
POLYVOX_API void generateDecimatedVerticesForSlice(BlockVolumeIterator<std::uint8_t>& volIter, std::uint8_t uLevel, Region& regSlice, const Vector3DFloat& offset, std::uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,std::int32_t vertexIndicesX[],std::int32_t vertexIndicesY[],std::int32_t vertexIndicesZ[]);
|
||||
POLYVOX_API void generateDecimatedMeshDataForRegion(BlockVolume<uint8>* volumeData, uint8 uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API uint32 computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask);
|
||||
POLYVOX_API uint32 computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8 *bitmask, uint8 *previousBitmask);
|
||||
POLYVOX_API void generateDecimatedIndicesForSlice(BlockVolumeIterator<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[]);
|
||||
POLYVOX_API void generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8>& volIter, uint8 uLevel, Region& regSlice, const Vector3DFloat& offset, uint8* bitmask, IndexedSurfacePatch* singleMaterialPatch,int32 vertexIndicesX[],int32 vertexIndicesY[],int32 vertexIndicesZ[]);
|
||||
|
||||
POLYVOX_API void generateDecimatedMeshDataForRegionSlow(BlockVolume<std::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API void generateDecimatedMeshDataForRegionSlow(BlockVolume<uint8>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
|
||||
POLYVOX_API Vector3DFloat computeDecimatedNormal(BlockVolume<std::uint8_t>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API Vector3DFloat computeDecimatedNormal(BlockVolume<uint8>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -24,12 +24,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "TypeDef.h"
|
||||
|
||||
#include "PolyVoxCStdInt.h"
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API std::uint8_t logBase2(std::uint32_t uInput);
|
||||
POLYVOX_API bool isPowerOf2(std::uint32_t uInput);
|
||||
POLYVOX_API uint8 logBase2(uint32 uInput);
|
||||
POLYVOX_API bool isPowerOf2(uint32 uInput);
|
||||
|
||||
template <typename Type>
|
||||
Type trilinearlyInterpolate(
|
||||
|
@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#define __PolyVox_Vector_H__
|
||||
|
||||
#pragma region Headers
|
||||
#include "PolyVoxCStdInt.h"
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
|
||||
#include <iostream>
|
||||
#pragma endregion
|
||||
@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
namespace PolyVox
|
||||
{
|
||||
///Represents a vector in space.
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
class Vector
|
||||
{
|
||||
public:
|
||||
@ -66,7 +66,7 @@ namespace PolyVox
|
||||
Vector<Size,Type>& operator/=(const Type& rhs) throw();
|
||||
|
||||
///Element Access
|
||||
Type getElement(std::uint32_t index) const throw();
|
||||
Type getElement(uint32 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(std::uint32_t index, Type tValue) throw();
|
||||
void setElement(uint32 index, Type tValue) throw();
|
||||
///Set the x component of the vector.
|
||||
void setX(Type tX) throw();
|
||||
///Set the y component of the vector.
|
||||
@ -107,19 +107,19 @@ namespace PolyVox
|
||||
|
||||
//Non-member overloaded operators.
|
||||
///Addition operator.
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type> operator+(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw();
|
||||
///Subtraction operator.
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type> operator-(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw();
|
||||
///Multiplication operator.
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type> operator*(const Vector<Size,Type>& lhs, const Type& rhs) throw();
|
||||
///Division operator.
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type> operator/(const Vector<Size,Type>& lhs, const Type& rhs) throw();
|
||||
///Stream insertion operator.
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
std::ostream& operator<<(std::ostream& os, const Vector<Size,Type>& vector) throw();
|
||||
|
||||
//Some handy typedefs
|
||||
@ -128,17 +128,17 @@ namespace PolyVox
|
||||
///A 3D Vector of doubles.
|
||||
typedef Vector<3,double> Vector3DDouble;
|
||||
///A 3D Vector of signed 8-bit values.
|
||||
typedef Vector<3,std::int8_t> Vector3DInt8;
|
||||
typedef Vector<3,int8> Vector3DInt8;
|
||||
///A 3D Vector of unsigned 8-bit values.
|
||||
typedef Vector<3,std::uint8_t> Vector3DUint8;
|
||||
typedef Vector<3,uint8> Vector3DUint8;
|
||||
///A 3D Vector of signed 16-bit values.
|
||||
typedef Vector<3,std::int16_t> Vector3DInt16;
|
||||
typedef Vector<3,int16> Vector3DInt16;
|
||||
///A 3D Vector of unsigned 16-bit values.
|
||||
typedef Vector<3,std::uint16_t> Vector3DUint16;
|
||||
typedef Vector<3,uint16> Vector3DUint16;
|
||||
///A 3D Vector of signed 32-bit values.
|
||||
typedef Vector<3,std::int32_t> Vector3DInt32;
|
||||
typedef Vector<3,int32> Vector3DInt32;
|
||||
///A 3D Vector of unsigned 32-bit values.
|
||||
typedef Vector<3,std::uint32_t> Vector3DUint32;
|
||||
typedef Vector<3,uint32> Vector3DUint32;
|
||||
|
||||
|
||||
|
||||
|
@ -42,7 +42,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, std::int32_t, and std::uint32_t. They are used as follows:
|
||||
vectors with type float, double, int32, and uint32. They are used as follows:
|
||||
|
||||
Vector2DInt4 test(1,2); //Declares a 2 dimensional Vector of type int4.
|
||||
*/
|
||||
@ -54,7 +54,7 @@ namespace PolyVox
|
||||
\param x x component to set.
|
||||
\param y y component to set.
|
||||
*/
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type>::Vector(Type x, Type y) throw()
|
||||
{
|
||||
m_tElements[0] = x;
|
||||
@ -68,7 +68,7 @@ namespace PolyVox
|
||||
\param y y component to set.
|
||||
\param z z component to set.
|
||||
*/
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type>::Vector(Type x, Type y, Type z) throw()
|
||||
{
|
||||
m_tElements[0] = x;
|
||||
@ -84,7 +84,7 @@ namespace PolyVox
|
||||
\param z z component to set.
|
||||
\param w w component to set.
|
||||
*/
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type>::Vector(Type x, Type y, Type z, Type w) throw()
|
||||
{
|
||||
m_tElements[0] = x;
|
||||
@ -96,7 +96,7 @@ namespace PolyVox
|
||||
/**
|
||||
Creates a Vector object but does not initialise it.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
Vector<Size, Type>::Vector(void) throw()
|
||||
{
|
||||
}
|
||||
@ -105,7 +105,7 @@ namespace PolyVox
|
||||
Copy constructor builds object based on object passed as parameter.
|
||||
\param vector A reference to the Vector to be copied.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
Vector<Size, Type>::Vector(const Vector<Size, Type>& vector) throw()
|
||||
{
|
||||
std::memcpy(m_tElements, vector.m_tElements, sizeof(Type) * Size);
|
||||
@ -120,11 +120,11 @@ namespace PolyVox
|
||||
|
||||
\param vector A reference to the Vector to be copied.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
template <typename CastType>
|
||||
Vector<Size, Type>::Vector(const Vector<Size, CastType>& vector) throw()
|
||||
{
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] = static_cast<CastType>(vector.getElement(ct));
|
||||
}
|
||||
@ -133,7 +133,7 @@ namespace PolyVox
|
||||
/**
|
||||
Destroys the Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
Vector<Size, Type>::~Vector(void) throw()
|
||||
{
|
||||
}
|
||||
@ -145,7 +145,7 @@ namespace PolyVox
|
||||
\param rhs Vector to assign to.
|
||||
\return A reference to the result to allow chaining.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
Vector<Size, Type>& Vector<Size, Type>::operator=(const Vector<Size, Type>& rhs) throw()
|
||||
{
|
||||
if(this == &rhs)
|
||||
@ -162,11 +162,11 @@ namespace PolyVox
|
||||
\return true if the Vectors match.
|
||||
\see operator!=
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline bool Vector<Size, Type>::operator==(const Vector<Size, Type> &rhs) const throw()
|
||||
{
|
||||
bool equal = true;
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
if(m_tElements[ct] != rhs(ct))
|
||||
{
|
||||
@ -184,7 +184,7 @@ namespace PolyVox
|
||||
\return true if this is less than the parameter
|
||||
\see operator!=
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline bool Vector<Size, Type>::operator<(const Vector<Size, Type> &rhs) const throw()
|
||||
{
|
||||
for(int ct = 0; ct < Size; ++ct)
|
||||
@ -202,10 +202,10 @@ namespace PolyVox
|
||||
\param rhs Vector to add
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Vector<Size, Type>& Vector<Size, Type>::operator+=(const Vector<Size, Type>& rhs) throw()
|
||||
{
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] += rhs.m_tElements[ct];
|
||||
}
|
||||
@ -218,7 +218,7 @@ namespace PolyVox
|
||||
\param rhs Vector to add.
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type> operator+(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw()
|
||||
{
|
||||
Vector<Size,Type> result = lhs;
|
||||
@ -231,10 +231,10 @@ namespace PolyVox
|
||||
\param rhs Vector to subtract
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Vector<Size, Type>& Vector<Size, Type>::operator-=(const Vector<Size, Type>& rhs) throw()
|
||||
{
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] -= rhs.m_tElements[ct];
|
||||
}
|
||||
@ -247,7 +247,7 @@ namespace PolyVox
|
||||
\param rhs Vector to subtract.
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type> operator-(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw()
|
||||
{
|
||||
Vector<Size,Type> result = lhs;
|
||||
@ -260,10 +260,10 @@ namespace PolyVox
|
||||
\param rhs the number the Vector is multiplied by.
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Vector<Size, Type>& Vector<Size, Type>::operator*=(const Type& rhs) throw()
|
||||
{
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] *= rhs;
|
||||
}
|
||||
@ -276,7 +276,7 @@ namespace PolyVox
|
||||
\param rhs the number the Vector is multiplied by.
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type> operator*(const Vector<Size,Type>& lhs, const Type& rhs) throw()
|
||||
{
|
||||
Vector<Size,Type> result = lhs;
|
||||
@ -289,10 +289,10 @@ namespace PolyVox
|
||||
\param rhs the number the Vector is divided by.
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Vector<Size, Type>& Vector<Size, Type>::operator/=(const Type& rhs) throw()
|
||||
{
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] /= rhs;
|
||||
}
|
||||
@ -305,7 +305,7 @@ namespace PolyVox
|
||||
\param rhs the number the Vector is divided by.
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <std::uint32_t Size,typename Type>
|
||||
template <uint32 Size,typename Type>
|
||||
Vector<Size,Type> operator/(const Vector<Size,Type>& lhs, const Type& rhs) throw()
|
||||
{
|
||||
Vector<Size,Type> result = lhs;
|
||||
@ -319,11 +319,11 @@ namespace PolyVox
|
||||
\param vector The Vector to write to the stream.
|
||||
\return A reference to the output stream to allow chaining.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
std::ostream& operator<<(std::ostream& os, const Vector<Size, Type>& vector) throw()
|
||||
{
|
||||
os << "(";
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
os << vector.getElement(ct);
|
||||
if(ct < (Size-1))
|
||||
@ -342,8 +342,8 @@ namespace PolyVox
|
||||
\param index The index of the element to return.
|
||||
\return The element.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline Type Vector<Size, Type>::getElement(std::uint32_t index) const throw()
|
||||
template <uint32 Size, typename Type>
|
||||
inline Type Vector<Size, Type>::getElement(uint32 index) const throw()
|
||||
{
|
||||
return m_tElements[index];
|
||||
}
|
||||
@ -351,7 +351,7 @@ namespace PolyVox
|
||||
/**
|
||||
\return A const reference to the X component of a 1, 2, 3, or 4 dimensional Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Type Vector<Size, Type>::getX(void) const throw()
|
||||
{
|
||||
return m_tElements[0];
|
||||
@ -360,7 +360,7 @@ namespace PolyVox
|
||||
/**
|
||||
\return A const reference to the Y component of a 2, 3, or 4 dimensional Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Type Vector<Size, Type>::getY(void) const throw()
|
||||
{
|
||||
return m_tElements[1];
|
||||
@ -369,7 +369,7 @@ namespace PolyVox
|
||||
/**
|
||||
\return A const reference to the Z component of a 3 or 4 dimensional Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Type Vector<Size, Type>::getZ(void) const throw()
|
||||
{
|
||||
return m_tElements[2];
|
||||
@ -378,7 +378,7 @@ namespace PolyVox
|
||||
/**
|
||||
\return A const reference to the W component of a 4 dimensional Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Type Vector<Size, Type>::getW(void) const throw()
|
||||
{
|
||||
return m_tElements[3];
|
||||
@ -390,8 +390,8 @@ namespace PolyVox
|
||||
\param index The index of the element to set.
|
||||
\param tValue The new value for the element.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline void Vector<Size, Type>::setElement(std::uint32_t index, Type tValue) throw()
|
||||
template <uint32 Size, typename Type>
|
||||
inline void Vector<Size, Type>::setElement(uint32 index, Type tValue) throw()
|
||||
{
|
||||
m_tElements[index] = tValue;
|
||||
}
|
||||
@ -399,7 +399,7 @@ namespace PolyVox
|
||||
/**
|
||||
\param tX The new value for the X component of a 1, 2, 3, or 4 dimensional Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline void Vector<Size, Type>::setX(Type tX) throw()
|
||||
{
|
||||
m_tElements[0] = tX;
|
||||
@ -408,7 +408,7 @@ namespace PolyVox
|
||||
/**
|
||||
\param tX The new value for the Y component of a 2, 3, or 4 dimensional Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline void Vector<Size, Type>::setY(Type tY) throw()
|
||||
{
|
||||
m_tElements[1] = tY;
|
||||
@ -417,7 +417,7 @@ namespace PolyVox
|
||||
/**
|
||||
\param tX The new value for the Z component of a 3 or 4 dimensional Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline void Vector<Size, Type>::setZ(Type tZ) throw()
|
||||
{
|
||||
m_tElements[2] = tZ;
|
||||
@ -426,7 +426,7 @@ namespace PolyVox
|
||||
/**
|
||||
\param tX The new value for the W component of a 4 dimensional Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline void Vector<Size, Type>::setW(Type tW) throw()
|
||||
{
|
||||
m_tElements[3] = tW;
|
||||
@ -438,7 +438,7 @@ namespace PolyVox
|
||||
NOTE: This function does not make much sense on integer Vectors.
|
||||
\return Length of the Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline double Vector<Size, Type>::length(void) const throw()
|
||||
{
|
||||
return sqrt(lengthSquared());
|
||||
@ -447,11 +447,11 @@ namespace PolyVox
|
||||
/**
|
||||
\return Squared length of the Vector.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline double Vector<Size, Type>::lengthSquared(void) const throw()
|
||||
{
|
||||
double result = 0.0f;
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
result += m_tElements[ct] * m_tElements[ct];
|
||||
}
|
||||
@ -467,7 +467,7 @@ namespace PolyVox
|
||||
\param Vector3D The Vector to find the angle to.
|
||||
\return The angle between them in radians.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline double Vector<Size, Type>::angleTo(const Vector<Size, Type>& vector) const throw()
|
||||
{
|
||||
return acos(dot(vector) / (vector.length() * this->length()));
|
||||
@ -486,7 +486,7 @@ namespace PolyVox
|
||||
\return The value of the cross product.
|
||||
\see dot()
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 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();
|
||||
@ -502,11 +502,11 @@ namespace PolyVox
|
||||
\return The value of the dot product.
|
||||
\see cross()
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline Type Vector<Size, Type>::dot(const Vector<Size, Type>& rhs) const throw()
|
||||
{
|
||||
Type dotProduct = static_cast<Type>(0);
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
dotProduct += m_tElements[ct] * rhs.m_tElements[ct];
|
||||
}
|
||||
@ -518,7 +518,7 @@ namespace PolyVox
|
||||
|
||||
NOTE: This function does not make much sense on integer Vectors.
|
||||
*/
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <uint32 Size, typename Type>
|
||||
inline void Vector<Size, Type>::normalise(void) throw()
|
||||
{
|
||||
double length = this->length();
|
||||
@ -527,7 +527,7 @@ namespace PolyVox
|
||||
{
|
||||
return;
|
||||
}
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(uint32 ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] /= static_cast<Type>(length);
|
||||
}
|
||||
|
@ -44,26 +44,26 @@ namespace PolyVox
|
||||
//Getters
|
||||
void getChangedRegions(std::list<Region>& listToFill) const;
|
||||
Region getEnclosingRegion(void) const;
|
||||
std::uint16_t getSideLength(void);
|
||||
BlockVolume<std::uint8_t>* getVolumeData(void) const;
|
||||
std::uint8_t getVoxelAt(const Vector3DUint16& pos);
|
||||
std::uint8_t getVoxelAt(std::uint16_t uX, std::uint16_t uY, std::uint16_t uZ);
|
||||
uint16 getSideLength(void);
|
||||
BlockVolume<uint8>* getVolumeData(void) const;
|
||||
uint8 getVoxelAt(const Vector3DUint16& pos);
|
||||
uint8 getVoxelAt(uint16 uX, uint16 uY, uint16 uZ);
|
||||
|
||||
//Setters
|
||||
void setAllRegionsUpToDate(bool newUpToDateValue);
|
||||
void setLockedVoxelAt(std::uint16_t x, std::uint16_t y, std::uint16_t z, std::uint8_t value);
|
||||
void setVolumeData(BlockVolume<std::uint8_t>* volumeDataToSet);
|
||||
void setVoxelAt(std::uint16_t x, std::uint16_t y, std::uint16_t z, std::uint8_t value);
|
||||
void setLockedVoxelAt(uint16 x, uint16 y, uint16 z, uint8 value);
|
||||
void setVolumeData(BlockVolume<uint8>* volumeDataToSet);
|
||||
void setVoxelAt(uint16 x, uint16 y, uint16 z, uint8 value);
|
||||
|
||||
//Others
|
||||
void lockRegion(const Region& regToLock);
|
||||
void unlockRegion(void);
|
||||
//void markRegionChanged(std::uint16_t firstX, std::uint16_t firstY, std::uint16_t firstZ, std::uint16_t lastX, std::uint16_t lastY, std::uint16_t lastZ);
|
||||
//void markRegionChanged(uint16 firstX, uint16 firstY, uint16 firstZ, uint16 lastX, uint16 lastY, uint16 lastZ);
|
||||
|
||||
private:
|
||||
bool m_bIsLocked;
|
||||
Region m_regLastLocked;
|
||||
BlockVolume<std::uint8_t>* volumeData;
|
||||
BlockVolume<uint8>* volumeData;
|
||||
LinearVolume<bool>* volRegionUpToDate;
|
||||
};
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
float computeSmoothedVoxel(BlockVolumeIterator<std::uint8_t>& volIter);
|
||||
float computeSmoothedVoxel(BlockVolumeIterator<uint8>& volIter);
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user