Removed boost dependency.
This commit is contained in:
parent
9a58b83b6d
commit
27f6e461c0
@ -40,6 +40,7 @@ SET(INC_FILES
|
||||
include/IndexedSurfacePatch.h
|
||||
include/MarchingCubesTables.h
|
||||
include/PolyVoxForwardDeclarations.h
|
||||
include/PolyVoxCStdInt.h
|
||||
include/Region.h
|
||||
include/RegionGeometry.h
|
||||
include/SurfaceAdjusters.h
|
||||
@ -54,15 +55,6 @@ SET(INC_FILES
|
||||
include/VoxelFilters.h
|
||||
)
|
||||
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
|
||||
#under windows boost linking is automatic. Under Linux it is specified here. Might need changing for MinGW
|
||||
#IF(NOT WIN32)
|
||||
# SET(BOOST_LIBRARIES boost_program_options boost_filesystem)
|
||||
#ENDIF(NOT WIN32)
|
||||
|
||||
|
||||
|
||||
ADD_DEFINITIONS(-DPOLYVOX_EXPORT) #Export symbols in the .dll
|
||||
|
||||
#Appends "_d" to the generated library when in debug mode
|
||||
@ -74,7 +66,7 @@ SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||
|
||||
#Tell CMake the paths
|
||||
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
#Build
|
||||
ADD_LIBRARY(PolyVoxCore SHARED ${SRC_FILES} ${INC_FILES})
|
||||
|
@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#pragma region Headers
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
#pragma endregion
|
||||
|
||||
namespace PolyVox
|
||||
@ -36,22 +36,22 @@ namespace PolyVox
|
||||
//Make BlockVolumeIterator a friend
|
||||
friend class BlockVolumeIterator<VoxelType>;
|
||||
public:
|
||||
Block(boost::uint8_t uSideLengthPower);
|
||||
Block(std::uint8_t uSideLengthPower);
|
||||
Block(const Block& rhs);
|
||||
~Block();
|
||||
|
||||
Block& operator=(const Block& rhs);
|
||||
|
||||
boost::uint16_t getSideLength(void) const;
|
||||
VoxelType getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const;
|
||||
std::uint16_t getSideLength(void) const;
|
||||
VoxelType getVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos) const;
|
||||
|
||||
void setVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos, VoxelType tValue);
|
||||
void setVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos, VoxelType tValue);
|
||||
|
||||
void fill(VoxelType tValue);
|
||||
|
||||
private:
|
||||
boost::uint8_t m_uSideLengthPower;
|
||||
boost::uint16_t m_uSideLength;
|
||||
std::uint8_t m_uSideLengthPower;
|
||||
std::uint16_t m_uSideLength;
|
||||
VoxelType* m_tData;
|
||||
};
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace PolyVox
|
||||
{
|
||||
#pragma region Constructors/Destructors
|
||||
template <typename VoxelType>
|
||||
Block<VoxelType>::Block(boost::uint8_t uSideLengthPower)
|
||||
Block<VoxelType>::Block(std::uint8_t 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>
|
||||
boost::uint16_t Block<VoxelType>::getSideLength(void) const
|
||||
std::uint16_t Block<VoxelType>::getSideLength(void) const
|
||||
{
|
||||
return m_uSideLength;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType Block<VoxelType>::getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const
|
||||
VoxelType Block<VoxelType>::getVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t 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(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos, VoxelType tValue)
|
||||
void Block<VoxelType>::setVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos, VoxelType tValue)
|
||||
{
|
||||
assert(uXPos < m_uSideLength);
|
||||
assert(uYPos < m_uSideLength);
|
||||
|
@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#pragma region Headers
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
#include <map>
|
||||
#pragma endregion
|
||||
@ -39,21 +39,21 @@ namespace PolyVox
|
||||
friend class BlockVolumeIterator<VoxelType>;
|
||||
|
||||
public:
|
||||
BlockVolume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower = 5);
|
||||
BlockVolume(std::uint8_t uSideLengthPower, std::uint8_t uBlockSideLengthPower = 5);
|
||||
BlockVolume(const BlockVolume& rhs);
|
||||
~BlockVolume();
|
||||
|
||||
BlockVolume& operator=(const BlockVolume& rhs);
|
||||
|
||||
Region getEnclosingRegion(void) const;
|
||||
boost::uint16_t getSideLength(void) const;
|
||||
VoxelType getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const;
|
||||
std::uint16_t getSideLength(void) const;
|
||||
VoxelType getVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos) const;
|
||||
VoxelType getVoxelAt(const Vector3DUint16& v3dPos) const;
|
||||
|
||||
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, boost::uint16_t boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, std::uint16_t boundary) const;
|
||||
BlockVolumeIterator<VoxelType> firstVoxel(void);
|
||||
void idle(boost::uint32_t uAmount);
|
||||
void idle(std::uint32_t uAmount);
|
||||
BlockVolumeIterator<VoxelType> lastVoxel(void);
|
||||
|
||||
private:
|
||||
@ -65,20 +65,20 @@ namespace PolyVox
|
||||
VoxelType* m_pHomogenousValue;
|
||||
mutable std::map<VoxelType, Block<VoxelType>*> m_pHomogenousBlocks;
|
||||
|
||||
boost::uint32_t m_uNoOfBlocksInVolume;
|
||||
boost::uint16_t m_uSideLengthInBlocks;
|
||||
std::uint32_t m_uNoOfBlocksInVolume;
|
||||
std::uint16_t m_uSideLengthInBlocks;
|
||||
|
||||
boost::uint8_t m_uSideLengthPower;
|
||||
boost::uint16_t m_uSideLength;
|
||||
std::uint8_t m_uSideLengthPower;
|
||||
std::uint16_t m_uSideLength;
|
||||
|
||||
boost::uint8_t m_uBlockSideLengthPower;
|
||||
boost::uint16_t m_uBlockSideLength;
|
||||
std::uint8_t m_uBlockSideLengthPower;
|
||||
std::uint16_t m_uBlockSideLength;
|
||||
};
|
||||
|
||||
//Some handy typedefs
|
||||
typedef BlockVolume<float> FloatBlockVolume;
|
||||
typedef BlockVolume<boost::uint8_t> UInt8BlockVolume;
|
||||
typedef BlockVolume<boost::uint16_t> UInt16BlockVolume;
|
||||
typedef BlockVolume<std::uint8_t> UInt8BlockVolume;
|
||||
typedef BlockVolume<std::uint16_t> UInt16BlockVolume;
|
||||
}
|
||||
|
||||
#include "BlockVolume.inl"
|
||||
|
@ -32,7 +32,7 @@ namespace PolyVox
|
||||
{
|
||||
#pragma region Constructors/Destructors
|
||||
template <typename VoxelType>
|
||||
BlockVolume<VoxelType>::BlockVolume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower)
|
||||
BlockVolume<VoxelType>::BlockVolume(std::uint8_t uSideLengthPower, std::uint8_t 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(boost::uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
for(std::uint32_t 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(boost::uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
for(std::uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
|
||||
{
|
||||
delete m_pBlocks[i];
|
||||
}
|
||||
@ -127,25 +127,25 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t BlockVolume<VoxelType>::getSideLength(void) const
|
||||
std::uint16_t BlockVolume<VoxelType>::getSideLength(void) const
|
||||
{
|
||||
return m_uSideLength;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolume<VoxelType>::getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const
|
||||
VoxelType BlockVolume<VoxelType>::getVoxelAt(std::uint16_t uXPos, std::uint16_t uYPos, std::uint16_t uZPos) const
|
||||
{
|
||||
assert(uXPos < getSideLength());
|
||||
assert(uYPos < getSideLength());
|
||||
assert(uZPos < getSideLength());
|
||||
|
||||
const boost::uint16_t blockX = uXPos >> m_uBlockSideLengthPower;
|
||||
const boost::uint16_t blockY = uYPos >> m_uBlockSideLengthPower;
|
||||
const boost::uint16_t blockZ = uZPos >> m_uBlockSideLengthPower;
|
||||
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 boost::uint16_t xOffset = uXPos - (blockX << m_uBlockSideLengthPower);
|
||||
const boost::uint16_t yOffset = uYPos - (blockY << m_uBlockSideLengthPower);
|
||||
const boost::uint16_t zOffset = uZPos - (blockZ << 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 Block<VoxelType>* block = m_pBlocks
|
||||
[
|
||||
@ -181,7 +181,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
bool BlockVolume<VoxelType>::containsPoint(const Vector3DInt32& pos, boost::uint16_t boundary) const
|
||||
bool BlockVolume<VoxelType>::containsPoint(const Vector3DInt32& pos, std::uint16_t 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(boost::uint32_t uAmount)
|
||||
void BlockVolume<VoxelType>::idle(std::uint32_t uAmount)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#pragma region Headers
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
#pragma endregion
|
||||
|
||||
namespace PolyVox
|
||||
@ -43,17 +43,17 @@ namespace PolyVox
|
||||
bool operator<=(const BlockVolumeIterator& rhs);
|
||||
bool operator>=(const BlockVolumeIterator& rhs);
|
||||
|
||||
boost::uint16_t getPosX(void) const;
|
||||
boost::uint16_t getPosY(void) const;
|
||||
boost::uint16_t getPosZ(void) const;
|
||||
VoxelType getSubSampledVoxel(boost::uint8_t uLevel) const;
|
||||
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;
|
||||
const BlockVolume<VoxelType>& getVolume(void) const;
|
||||
VoxelType getVoxel(void) const;
|
||||
|
||||
void setPosition(const Vector3DInt16& v3dNewPos);
|
||||
void setPosition(boost::uint16_t xPos, boost::uint16_t yPos, boost::uint16_t zPos);
|
||||
void setPosition(std::uint16_t xPos, std::uint16_t yPos, std::uint16_t zPos);
|
||||
void setValidRegion(const Region& region);
|
||||
void setValidRegion(boost::uint16_t xFirst, boost::uint16_t yFirst, boost::uint16_t zFirst, boost::uint16_t xLast, boost::uint16_t yLast, boost::uint16_t zLast);
|
||||
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 setVoxel(VoxelType tValue);
|
||||
|
||||
bool isValidForRegion(void) const;
|
||||
@ -96,38 +96,38 @@ namespace PolyVox
|
||||
BlockVolume<VoxelType>& mVolume;
|
||||
|
||||
//The current position in the volume
|
||||
boost::uint16_t mXPosInVolume;
|
||||
boost::uint16_t mYPosInVolume;
|
||||
boost::uint16_t mZPosInVolume;
|
||||
std::uint16_t mXPosInVolume;
|
||||
std::uint16_t mYPosInVolume;
|
||||
std::uint16_t mZPosInVolume;
|
||||
|
||||
//The position of the current block
|
||||
boost::uint16_t mXBlock;
|
||||
boost::uint16_t mYBlock;
|
||||
boost::uint16_t mZBlock;
|
||||
std::uint16_t mXBlock;
|
||||
std::uint16_t mYBlock;
|
||||
std::uint16_t mZBlock;
|
||||
|
||||
//The offset into the current block
|
||||
boost::uint16_t mXPosInBlock;
|
||||
boost::uint16_t mYPosInBlock;
|
||||
boost::uint16_t mZPosInBlock;
|
||||
std::uint16_t mXPosInBlock;
|
||||
std::uint16_t mYPosInBlock;
|
||||
std::uint16_t mZPosInBlock;
|
||||
|
||||
//Other current position information
|
||||
VoxelType* mCurrentVoxel;
|
||||
boost::uint32_t mBlockIndexInVolume;
|
||||
boost::uint32_t mVoxelIndexInBlock;
|
||||
std::uint32_t mBlockIndexInVolume;
|
||||
std::uint32_t mVoxelIndexInBlock;
|
||||
|
||||
boost::uint16_t mXRegionFirst;
|
||||
boost::uint16_t mYRegionFirst;
|
||||
boost::uint16_t mZRegionFirst;
|
||||
boost::uint16_t mXRegionLast;
|
||||
boost::uint16_t mYRegionLast;
|
||||
boost::uint16_t mZRegionLast;
|
||||
std::uint16_t mXRegionFirst;
|
||||
std::uint16_t mYRegionFirst;
|
||||
std::uint16_t mZRegionFirst;
|
||||
std::uint16_t mXRegionLast;
|
||||
std::uint16_t mYRegionLast;
|
||||
std::uint16_t mZRegionLast;
|
||||
|
||||
boost::uint16_t mXRegionFirstBlock;
|
||||
boost::uint16_t mYRegionFirstBlock;
|
||||
boost::uint16_t mZRegionFirstBlock;
|
||||
boost::uint16_t mXRegionLastBlock;
|
||||
boost::uint16_t mYRegionLastBlock;
|
||||
boost::uint16_t mZRegionLastBlock;
|
||||
std::uint16_t mXRegionFirstBlock;
|
||||
std::uint16_t mYRegionFirstBlock;
|
||||
std::uint16_t mZRegionFirstBlock;
|
||||
std::uint16_t mXRegionLastBlock;
|
||||
std::uint16_t mYRegionLastBlock;
|
||||
std::uint16_t mZRegionLastBlock;
|
||||
|
||||
bool mIsValidForRegion;
|
||||
};
|
||||
|
@ -105,25 +105,25 @@ namespace PolyVox
|
||||
|
||||
#pragma region Getters
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t BlockVolumeIterator<VoxelType>::getPosX(void) const
|
||||
std::uint16_t BlockVolumeIterator<VoxelType>::getPosX(void) const
|
||||
{
|
||||
return mXPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t BlockVolumeIterator<VoxelType>::getPosY(void) const
|
||||
std::uint16_t BlockVolumeIterator<VoxelType>::getPosY(void) const
|
||||
{
|
||||
return mYPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t BlockVolumeIterator<VoxelType>::getPosZ(void) const
|
||||
std::uint16_t BlockVolumeIterator<VoxelType>::getPosZ(void) const
|
||||
{
|
||||
return mZPosInVolume;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType BlockVolumeIterator<VoxelType>::getSubSampledVoxel(boost::uint8_t uLevel) const
|
||||
VoxelType BlockVolumeIterator<VoxelType>::getSubSampledVoxel(std::uint8_t uLevel) const
|
||||
{
|
||||
if(uLevel == 0)
|
||||
{
|
||||
@ -143,14 +143,14 @@ namespace PolyVox
|
||||
}
|
||||
else
|
||||
{
|
||||
const boost::uint8_t uSize = 1 << uLevel;
|
||||
const std::uint8_t uSize = 1 << uLevel;
|
||||
|
||||
VoxelType tValue = 0;
|
||||
for(boost::uint8_t z = 0; z < uSize; ++z)
|
||||
for(std::uint8_t z = 0; z < uSize; ++z)
|
||||
{
|
||||
for(boost::uint8_t y = 0; y < uSize; ++y)
|
||||
for(std::uint8_t y = 0; y < uSize; ++y)
|
||||
{
|
||||
for(boost::uint8_t x = 0; x < uSize; ++x)
|
||||
for(std::uint8_t 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(boost::uint16_t xPos, boost::uint16_t yPos, boost::uint16_t zPos)
|
||||
void BlockVolumeIterator<VoxelType>::setPosition(std::uint16_t xPos, std::uint16_t yPos, std::uint16_t zPos)
|
||||
{
|
||||
mXPosInVolume = xPos;
|
||||
mYPosInVolume = yPos;
|
||||
@ -214,7 +214,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setValidRegion(boost::uint16_t xFirst, boost::uint16_t yFirst, boost::uint16_t zFirst, boost::uint16_t xLast, boost::uint16_t yLast, boost::uint16_t zLast)
|
||||
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)
|
||||
{
|
||||
mXRegionFirst = xFirst;
|
||||
mYRegionFirst = yFirst;
|
||||
@ -236,7 +236,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
void BlockVolumeIterator<VoxelType>::setVoxel(VoxelType tValue)
|
||||
{
|
||||
const boost::uint32_t uBlockIndex =
|
||||
const std::uint32_t uBlockIndex =
|
||||
mXBlock +
|
||||
mYBlock * mVolume.m_uSideLengthInBlocks +
|
||||
mZBlock * mVolume.m_uSideLengthInBlocks * mVolume.m_uSideLengthInBlocks;
|
||||
|
@ -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 "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
//FIXME - i think we can define mod using a bitmask which flattens the upper bits. Should define that here.
|
||||
//const boost::uint32_t POLYVOX_BLOCK_SIDE_LENGTH_POWER = 5;
|
||||
//const boost::uint32_t POLYVOX_BLOCK_SIDE_LENGTH = (0x0001 << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||
//const boost::uint32_t POLYVOX_NO_OF_VOXELS_IN_BLOCK = (POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH);
|
||||
//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 boost::uint16_t POLYVOX_VOLUME_SIDE_LENGTH_POWER = 8;
|
||||
const boost::uint16_t POLYVOX_VOLUME_SIDE_LENGTH = (0x0001 << POLYVOX_VOLUME_SIDE_LENGTH_POWER);
|
||||
//const boost::uint32_t POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||
//const boost::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 boost::uint32_t POLYVOX_NO_OF_VOXELS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_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 boost::uint16_t POLYVOX_REGION_SIDE_LENGTH_POWER = 4;
|
||||
const boost::uint16_t POLYVOX_REGION_SIDE_LENGTH = (0x0001 << POLYVOX_REGION_SIDE_LENGTH_POWER);
|
||||
const boost::uint16_t POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_REGION_SIDE_LENGTH_POWER);
|
||||
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);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -40,8 +40,8 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSobelGradient(const BlockVolumeIterator<VoxelType>& volIter);
|
||||
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<boost::uint8_t>* volumeData, RegionGeometry& regGeom, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API Vector3DFloat computeNormal(BlockVolume<boost::uint8_t>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod);
|
||||
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);
|
||||
}
|
||||
|
||||
#include "GradientEstimators.inl"
|
||||
|
@ -72,9 +72,9 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
Vector3DFloat computeSmoothCentralDifferenceGradient(BlockVolumeIterator<VoxelType>& volIter)
|
||||
{
|
||||
boost::uint16_t initialX = volIter.getPosX();
|
||||
boost::uint16_t initialY = volIter.getPosY();
|
||||
boost::uint16_t initialZ = volIter.getPosZ();
|
||||
std::uint16_t initialX = volIter.getPosX();
|
||||
std::uint16_t initialY = volIter.getPosY();
|
||||
std::uint16_t initialZ = volIter.getPosZ();
|
||||
|
||||
//FIXME - bitwise way of doing this?
|
||||
volIter.setPosition(initialX-1, initialY, initialZ);
|
||||
|
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
#include "Constants.h"
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
@ -40,29 +40,29 @@ namespace PolyVox
|
||||
~IndexedSurfacePatch();
|
||||
|
||||
void addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2);
|
||||
void fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<boost::uint32_t>& vecIndices);
|
||||
void fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<std::uint32_t>& vecIndices);
|
||||
|
||||
const std::vector<SurfaceVertex>& getVertices(void) const;
|
||||
std::vector<SurfaceVertex>& getVertices(void); //FIXME - non const version should be removed.
|
||||
const std::vector<boost::uint32_t>& getIndices(void) const;
|
||||
const std::vector<std::uint32_t>& getIndices(void) const;
|
||||
|
||||
unsigned short getNoNonUniformTrianges(void);
|
||||
unsigned short getNoUniformTrianges(void);
|
||||
|
||||
public:
|
||||
std::vector<boost::uint32_t> m_vecTriangleIndices;
|
||||
std::vector<std::uint32_t> m_vecTriangleIndices;
|
||||
std::vector<SurfaceVertex> m_vecVertices;
|
||||
|
||||
static boost::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
static boost::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
static boost::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
static std::int32_t vertexIndicesX[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
static std::int32_t vertexIndicesY[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
static std::int32_t vertexIndicesZ[POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1][POLYVOX_REGION_SIDE_LENGTH+1];
|
||||
|
||||
static boost::int32_t noOfVerticesSubmitted;
|
||||
static boost::int32_t noOfVerticesAccepted;
|
||||
static boost::int32_t noOfTrianglesSubmitted;
|
||||
static std::int32_t noOfVerticesSubmitted;
|
||||
static std::int32_t noOfVerticesAccepted;
|
||||
static std::int32_t noOfTrianglesSubmitted;
|
||||
|
||||
boost::int32_t getIndexFor(const Vector3DFloat& pos);
|
||||
void setIndexFor(const Vector3DFloat& pos, boost::int32_t newIndex);
|
||||
std::int32_t getIndexFor(const Vector3DFloat& pos);
|
||||
void setIndexFor(const Vector3DFloat& pos, std::int32_t newIndex);
|
||||
|
||||
public:
|
||||
bool m_AllowDuplicateVertices;
|
||||
|
@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
#include "TypeDef.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
#pragma endregion
|
||||
|
||||
namespace PolyVox
|
||||
@ -36,7 +36,7 @@ namespace PolyVox
|
||||
class LinearVolume
|
||||
{
|
||||
public:
|
||||
LinearVolume(boost::uint8_t uSideLengthPower);
|
||||
LinearVolume(std::uint8_t uSideLengthPower);
|
||||
LinearVolume(const LinearVolume& rhs);
|
||||
~LinearVolume();
|
||||
|
||||
@ -44,17 +44,17 @@ namespace PolyVox
|
||||
|
||||
//bool isHomogeneous(void);
|
||||
|
||||
boost::uint16_t getSideLength(void);
|
||||
std::uint16_t getSideLength(void);
|
||||
|
||||
VoxelType getVoxelAt(const boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition) const;
|
||||
void setVoxelAt(const boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition, const VoxelType value);
|
||||
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);
|
||||
|
||||
//void fillWithValue(const VoxelType value);
|
||||
|
||||
private:
|
||||
boost::uint32_t getNoOfVoxels(void);
|
||||
boost::uint8_t m_uSideLengthPower;
|
||||
boost::uint16_t m_uSideLength;
|
||||
std::uint32_t getNoOfVoxels(void);
|
||||
std::uint8_t m_uSideLengthPower;
|
||||
std::uint16_t m_uSideLength;
|
||||
VoxelType* m_tData;
|
||||
};
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace PolyVox
|
||||
{
|
||||
|
||||
template <typename VoxelType>
|
||||
LinearVolume<VoxelType>::LinearVolume(boost::uint8_t uSideLengthPower)
|
||||
LinearVolume<VoxelType>::LinearVolume(std::uint8_t 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 boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition) const
|
||||
VoxelType LinearVolume<VoxelType>::getVoxelAt(const std::uint16_t xPosition, const std::uint16_t yPosition, const std::uint16_t zPosition) const
|
||||
{
|
||||
return m_tData
|
||||
[
|
||||
@ -78,7 +78,7 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void LinearVolume<VoxelType>::setVoxelAt(const boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition, const VoxelType value)
|
||||
void LinearVolume<VoxelType>::setVoxelAt(const std::uint16_t xPosition, const std::uint16_t yPosition, const std::uint16_t zPosition, const VoxelType value)
|
||||
{
|
||||
m_tData
|
||||
[
|
||||
@ -89,13 +89,13 @@ namespace PolyVox
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint16_t LinearVolume<VoxelType>::getSideLength(void)
|
||||
std::uint16_t LinearVolume<VoxelType>::getSideLength(void)
|
||||
{
|
||||
return m_uSideLength;
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
boost::uint32_t LinearVolume<VoxelType>::getNoOfVoxels(void)
|
||||
std::uint32_t LinearVolume<VoxelType>::getNoOfVoxels(void)
|
||||
{
|
||||
return m_uSideLength * m_uSideLength * m_uSideLength;
|
||||
}
|
||||
|
37
PolyVoxCore/include/PolyVoxCStdInt.h
Normal file
37
PolyVoxCore/include/PolyVoxCStdInt.h
Normal file
@ -0,0 +1,37 @@
|
||||
#pragma region License
|
||||
/******************************************************************************
|
||||
This file is part of the PolyVox library
|
||||
Copyright (C) 2006 David Williams
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
******************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifndef __PolyVox_CStdInt_H__
|
||||
#define __PolyVox_CStdInt_H__
|
||||
|
||||
//Adding things to the std namespace in not actually allowed, but Microsoft
|
||||
//have still not added <cstdint> to thier standard library.
|
||||
namespace std
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
#endif
|
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "Enums.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
@ -33,8 +33,8 @@ namespace PolyVox
|
||||
//---------- BlockVolume ----------
|
||||
template <typename VoxelType> class BlockVolume;
|
||||
typedef BlockVolume<float> FloatBlockVolume;
|
||||
typedef BlockVolume<boost::uint8_t> UInt8BlockVolume;
|
||||
typedef BlockVolume<boost::uint16_t> UInt16BlockVolume;
|
||||
typedef BlockVolume<std::uint8_t> UInt8BlockVolume;
|
||||
typedef BlockVolume<std::uint16_t> UInt16BlockVolume;
|
||||
//---------------------------------
|
||||
|
||||
class IndexedSurfacePatch;
|
||||
@ -45,15 +45,15 @@ namespace PolyVox
|
||||
class SurfaceVertex;
|
||||
|
||||
//---------- Vector ----------
|
||||
template <boost::uint32_t Size, typename Type> class Vector;
|
||||
template <std::uint32_t Size, typename Type> class Vector;
|
||||
typedef Vector<3,float> Vector3DFloat;
|
||||
typedef Vector<3,double> Vector3DDouble;
|
||||
typedef Vector<3,boost::int8_t> Vector3DInt8;
|
||||
typedef Vector<3,boost::uint8_t> Vector3DUint8;
|
||||
typedef Vector<3,boost::int16_t> Vector3DInt16;
|
||||
typedef Vector<3,boost::uint16_t> Vector3DUint16;
|
||||
typedef Vector<3,boost::int32_t> Vector3DInt32;
|
||||
typedef Vector<3,boost::uint32_t> Vector3DUint32;
|
||||
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;
|
||||
//----------------------------
|
||||
|
||||
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, boost::uint8_t boundary) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, std::uint8_t boundary) const;
|
||||
void cropTo(const Region& other);
|
||||
void shift(const Vector3DInt32& amount);
|
||||
|
||||
|
@ -27,12 +27,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
#include "TypeDef.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
#pragma endregion
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API void smoothRegionGeometry(BlockVolume<boost::uint8_t>* volumeData, RegionGeometry& regGeom);
|
||||
POLYVOX_API void smoothRegionGeometry(BlockVolume<std::uint8_t>* volumeData, RegionGeometry& regGeom);
|
||||
}
|
||||
|
||||
#endif
|
@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
#include "TypeDef.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
#include <list>
|
||||
#pragma endregion
|
||||
@ -36,15 +36,15 @@ namespace PolyVox
|
||||
{
|
||||
POLYVOX_API std::list<RegionGeometry> getChangedRegionGeometry(VolumeChangeTracker& volume);
|
||||
|
||||
boost::uint32_t getIndex(boost::uint32_t x, boost::uint32_t y);
|
||||
std::uint32_t getIndex(std::uint32_t x, std::uint32_t y);
|
||||
|
||||
POLYVOX_API void generateRoughMeshDataForRegion(BlockVolume<boost::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API boost::uint32_t computeInitialRoughBitmaskForSlice(BlockVolumeIterator<boost::uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, boost::uint8_t *bitmask);
|
||||
POLYVOX_API boost::uint32_t computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<boost::uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, boost::uint8_t *bitmask, boost::uint8_t *previousBitmask);
|
||||
POLYVOX_API void generateRoughIndicesForSlice(BlockVolumeIterator<boost::uint8_t>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, boost::uint8_t* bitmask0, boost::uint8_t* bitmask1, boost::int32_t vertexIndicesX0[],boost::int32_t vertexIndicesY0[],boost::int32_t vertexIndicesZ0[], boost::int32_t vertexIndicesX1[],boost::int32_t vertexIndicesY1[],boost::int32_t vertexIndicesZ1[]);
|
||||
POLYVOX_API void generateRoughVerticesForSlice(BlockVolumeIterator<boost::uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, boost::uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,boost::int32_t vertexIndicesX[],boost::int32_t vertexIndicesY[],boost::int32_t vertexIndicesZ[]);
|
||||
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 generateReferenceMeshDataForRegion(BlockVolume<boost::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API void generateReferenceMeshDataForRegion(BlockVolume<std::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -27,24 +27,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
#include "TypeDef.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
#include <list>
|
||||
#pragma endregion
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
boost::uint32_t getDecimatedIndex(boost::uint32_t x, boost::uint32_t y);
|
||||
std::uint32_t getDecimatedIndex(std::uint32_t x, std::uint32_t y);
|
||||
|
||||
POLYVOX_API void generateDecimatedMeshDataForRegion(BlockVolume<boost::uint8_t>* volumeData, boost::uint8_t uLevel, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API boost::uint32_t computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<boost::uint8_t>& volIter, boost::uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, boost::uint8_t *bitmask);
|
||||
POLYVOX_API boost::uint32_t computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<boost::uint8_t>& volIter, boost::uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, boost::uint8_t *bitmask, boost::uint8_t *previousBitmask);
|
||||
POLYVOX_API void generateDecimatedIndicesForSlice(BlockVolumeIterator<boost::uint8_t>& volIter, boost::uint8_t uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, boost::uint8_t* bitmask0, boost::uint8_t* bitmask1, boost::int32_t vertexIndicesX0[],boost::int32_t vertexIndicesY0[],boost::int32_t vertexIndicesZ0[], boost::int32_t vertexIndicesX1[],boost::int32_t vertexIndicesY1[],boost::int32_t vertexIndicesZ1[]);
|
||||
POLYVOX_API void generateDecimatedVerticesForSlice(BlockVolumeIterator<boost::uint8_t>& volIter, boost::uint8_t uLevel, Region& regSlice, const Vector3DFloat& offset, boost::uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,boost::int32_t vertexIndicesX[],boost::int32_t vertexIndicesY[],boost::int32_t vertexIndicesZ[]);
|
||||
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 generateDecimatedMeshDataForRegionSlow(BlockVolume<boost::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
POLYVOX_API void generateDecimatedMeshDataForRegionSlow(BlockVolume<std::uint8_t>* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch);
|
||||
|
||||
POLYVOX_API Vector3DFloat computeDecimatedNormal(BlockVolume<boost::uint8_t>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod);
|
||||
POLYVOX_API Vector3DFloat computeDecimatedNormal(BlockVolume<std::uint8_t>* 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 "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API boost::uint8_t logBase2(boost::uint32_t uInput);
|
||||
POLYVOX_API bool isPowerOf2(boost::uint32_t uInput);
|
||||
POLYVOX_API std::uint8_t logBase2(std::uint32_t uInput);
|
||||
POLYVOX_API bool isPowerOf2(std::uint32_t 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 "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.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 <boost::uint32_t Size, typename Type>
|
||||
template <std::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(boost::uint32_t index) const throw();
|
||||
Type getElement(std::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(boost::uint32_t index, Type tValue) throw();
|
||||
void setElement(std::uint32_t 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 <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t Size,typename Type>
|
||||
Vector<Size,Type> operator+(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw();
|
||||
///Subtraction operator.
|
||||
template <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t Size,typename Type>
|
||||
Vector<Size,Type> operator-(const Vector<Size,Type>& lhs, const Vector<Size,Type>& rhs) throw();
|
||||
///Multiplication operator.
|
||||
template <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t Size,typename Type>
|
||||
Vector<Size,Type> operator*(const Vector<Size,Type>& lhs, const Type& rhs) throw();
|
||||
///Division operator.
|
||||
template <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t Size,typename Type>
|
||||
Vector<Size,Type> operator/(const Vector<Size,Type>& lhs, const Type& rhs) throw();
|
||||
///Stream insertion operator.
|
||||
template <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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,boost::int8_t> Vector3DInt8;
|
||||
typedef Vector<3,std::int8_t> Vector3DInt8;
|
||||
///A 3D Vector of unsigned 8-bit values.
|
||||
typedef Vector<3,boost::uint8_t> Vector3DUint8;
|
||||
typedef Vector<3,std::uint8_t> Vector3DUint8;
|
||||
///A 3D Vector of signed 16-bit values.
|
||||
typedef Vector<3,boost::int16_t> Vector3DInt16;
|
||||
typedef Vector<3,std::int16_t> Vector3DInt16;
|
||||
///A 3D Vector of unsigned 16-bit values.
|
||||
typedef Vector<3,boost::uint16_t> Vector3DUint16;
|
||||
typedef Vector<3,std::uint16_t> Vector3DUint16;
|
||||
///A 3D Vector of signed 32-bit values.
|
||||
typedef Vector<3,boost::int32_t> Vector3DInt32;
|
||||
typedef Vector<3,std::int32_t> Vector3DInt32;
|
||||
///A 3D Vector of unsigned 32-bit values.
|
||||
typedef Vector<3,boost::uint32_t> Vector3DUint32;
|
||||
typedef Vector<3,std::uint32_t> Vector3DUint32;
|
||||
|
||||
|
||||
|
||||
|
@ -39,10 +39,10 @@ namespace PolyVox
|
||||
|
||||
A variety of overloaded operators are also provided for comparison and arithmetic
|
||||
operations. For most of these arithmetic operators only the unary versions are
|
||||
documented below - however often binary versions are also generated by boost::operators.
|
||||
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, boost::int32_t, and boost::uint32_t. They are used as follows:
|
||||
vectors with type float, double, std::int32_t, and std::uint32_t. 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 <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::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);
|
||||
@ -120,11 +120,11 @@ namespace PolyVox
|
||||
|
||||
\param vector A reference to the Vector to be copied.
|
||||
*/
|
||||
template <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
template <typename CastType>
|
||||
Vector<Size, Type>::Vector(const Vector<Size, CastType>& vector) throw()
|
||||
{
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] = static_cast<CastType>(vector.getElement(ct));
|
||||
}
|
||||
@ -133,7 +133,7 @@ namespace PolyVox
|
||||
/**
|
||||
Destroys the Vector.
|
||||
*/
|
||||
template <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline bool Vector<Size, Type>::operator==(const Vector<Size, Type> &rhs) const throw()
|
||||
{
|
||||
bool equal = true;
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::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)
|
||||
@ -202,10 +202,10 @@ namespace PolyVox
|
||||
\param rhs Vector to add
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline Vector<Size, Type>& Vector<Size, Type>::operator+=(const Vector<Size, Type>& rhs) throw()
|
||||
{
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t 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 <boost::uint32_t Size,typename Type>
|
||||
template <std::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;
|
||||
@ -231,10 +231,10 @@ namespace PolyVox
|
||||
\param rhs Vector to subtract
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline Vector<Size, Type>& Vector<Size, Type>::operator-=(const Vector<Size, Type>& rhs) throw()
|
||||
{
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t 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 <boost::uint32_t Size,typename Type>
|
||||
template <std::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;
|
||||
@ -260,10 +260,10 @@ namespace PolyVox
|
||||
\param rhs the number the Vector is multiplied by.
|
||||
\return The resulting Vector.
|
||||
*/
|
||||
template <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline Vector<Size, Type>& Vector<Size, Type>::operator*=(const Type& rhs) throw()
|
||||
{
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t 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 <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline Vector<Size, Type>& Vector<Size, Type>::operator/=(const Type& rhs) throw()
|
||||
{
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t 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 <boost::uint32_t Size,typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
std::ostream& operator<<(std::ostream& os, const Vector<Size, Type>& vector) throw()
|
||||
{
|
||||
os << "(";
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
inline Type Vector<Size, Type>::getElement(boost::uint32_t index) const throw()
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline Type Vector<Size, Type>::getElement(std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
inline void Vector<Size, Type>::setElement(boost::uint32_t index, Type tValue) throw()
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline void Vector<Size, Type>::setElement(std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline double Vector<Size, Type>::lengthSquared(void) const throw()
|
||||
{
|
||||
double result = 0.0f;
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::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()));
|
||||
@ -486,7 +486,7 @@ namespace PolyVox
|
||||
\return The value of the cross product.
|
||||
\see dot()
|
||||
*/
|
||||
template <boost::uint32_t Size, typename Type>
|
||||
template <std::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();
|
||||
@ -502,11 +502,11 @@ namespace PolyVox
|
||||
\return The value of the dot product.
|
||||
\see cross()
|
||||
*/
|
||||
template <boost::uint32_t Size, typename Type>
|
||||
template <std::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(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t 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 <boost::uint32_t Size, typename Type>
|
||||
template <std::uint32_t Size, typename Type>
|
||||
inline void Vector<Size, Type>::normalise(void) throw()
|
||||
{
|
||||
double length = this->length();
|
||||
@ -527,7 +527,7 @@ namespace PolyVox
|
||||
{
|
||||
return;
|
||||
}
|
||||
for(boost::uint32_t ct = 0; ct < Size; ++ct)
|
||||
for(std::uint32_t ct = 0; ct < Size; ++ct)
|
||||
{
|
||||
m_tElements[ct] /= static_cast<Type>(length);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
#include "Constants.h"
|
||||
#include "PolyVoxForwardDeclarations.h"
|
||||
@ -44,26 +44,26 @@ namespace PolyVox
|
||||
//Getters
|
||||
void getChangedRegions(std::list<Region>& listToFill) const;
|
||||
Region getEnclosingRegion(void) const;
|
||||
boost::uint16_t getSideLength(void);
|
||||
BlockVolume<boost::uint8_t>* getVolumeData(void) const;
|
||||
boost::uint8_t getVoxelAt(const Vector3DUint16& pos);
|
||||
boost::uint8_t getVoxelAt(boost::uint16_t uX, boost::uint16_t uY, boost::uint16_t uZ);
|
||||
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);
|
||||
|
||||
//Setters
|
||||
void setAllRegionsUpToDate(bool newUpToDateValue);
|
||||
void setLockedVoxelAt(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z, boost::uint8_t value);
|
||||
void setVolumeData(BlockVolume<boost::uint8_t>* volumeDataToSet);
|
||||
void setVoxelAt(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z, boost::uint8_t value);
|
||||
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);
|
||||
|
||||
//Others
|
||||
void lockRegion(const Region& regToLock);
|
||||
void unlockRegion(void);
|
||||
//void markRegionChanged(boost::uint16_t firstX, boost::uint16_t firstY, boost::uint16_t firstZ, boost::uint16_t lastX, boost::uint16_t lastY, boost::uint16_t lastZ);
|
||||
//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);
|
||||
|
||||
private:
|
||||
bool m_bIsLocked;
|
||||
Region m_regLastLocked;
|
||||
BlockVolume<boost::uint8_t>* volumeData;
|
||||
BlockVolume<std::uint8_t>* 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<boost::uint8_t>& volIter);
|
||||
float computeSmoothedVoxel(BlockVolumeIterator<std::uint8_t>& volIter);
|
||||
}
|
||||
|
||||
#endif
|
@ -3,13 +3,13 @@
|
||||
#include "RegionGeometry.h"
|
||||
#include "SurfaceVertex.h"
|
||||
|
||||
#include "boost/cstdint.hpp"
|
||||
#include "PolyVoxCStdInt.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<boost::uint8_t>* volumeData, RegionGeometry& regGeom, NormalGenerationMethod normalGenerationMethod)
|
||||
POLYVOX_API void computeNormalsForVertices(BlockVolume<std::uint8_t>* volumeData, RegionGeometry& regGeom, NormalGenerationMethod normalGenerationMethod)
|
||||
{
|
||||
std::vector<SurfaceVertex>& vecVertices = regGeom.m_patchSingleMaterial->m_vecVertices;
|
||||
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
|
||||
@ -18,7 +18,7 @@ namespace PolyVox
|
||||
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(regGeom.m_v3dRegionPosition);
|
||||
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
|
||||
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData);
|
||||
|
||||
//Check all corners are within the volume, allowing a boundary for gradient estimation
|
||||
bool lowerCornerInside = volumeData->containsPoint(v3dFloor,1);
|
||||
@ -98,7 +98,7 @@ namespace PolyVox
|
||||
|
||||
Vector3DFloat result;
|
||||
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create?
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create?
|
||||
|
||||
|
||||
if(normalGenerationMethod == SOBEL)
|
||||
|
@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "IndexedSurfacePatch.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
@ -120,7 +120,7 @@ namespace PolyVox
|
||||
}*/
|
||||
}
|
||||
|
||||
boost::int32_t IndexedSurfacePatch::getIndexFor(const Vector3DFloat& pos)
|
||||
std::int32_t IndexedSurfacePatch::getIndexFor(const Vector3DFloat& pos)
|
||||
{
|
||||
assert(pos.getX() >= 0.0f);
|
||||
assert(pos.getY() >= 0.0f);
|
||||
@ -152,7 +152,7 @@ namespace PolyVox
|
||||
while(true);
|
||||
}
|
||||
|
||||
void IndexedSurfacePatch::setIndexFor(const Vector3DFloat& pos, boost::int32_t newIndex)
|
||||
void IndexedSurfacePatch::setIndexFor(const Vector3DFloat& pos, std::int32_t newIndex)
|
||||
{
|
||||
assert(pos.getX() >= 0.0f);
|
||||
assert(pos.getY() >= 0.0f);
|
||||
@ -195,7 +195,7 @@ namespace PolyVox
|
||||
return m_vecVertices;
|
||||
}
|
||||
|
||||
const std::vector<boost::uint32_t>& IndexedSurfacePatch::getIndices(void) const
|
||||
const std::vector<std::uint32_t>& IndexedSurfacePatch::getIndices(void) const
|
||||
{
|
||||
return m_vecTriangleIndices;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace PolyVox
|
||||
&& (pos.getZ() >= m_v3dLowerCorner.getZ() + boundary);
|
||||
}
|
||||
|
||||
bool Region::containsPoint(const Vector3DInt32& pos, boost::uint8_t boundary) const
|
||||
bool Region::containsPoint(const Vector3DInt32& pos, std::uint8_t boundary) const
|
||||
{
|
||||
return (pos.getX() <= m_v3dUpperCorner.getX() - boundary)
|
||||
&& (pos.getY() <= m_v3dUpperCorner.getY() - boundary)
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
void smoothRegionGeometry(BlockVolume<boost::uint8_t>* volumeData, RegionGeometry& regGeom)
|
||||
void smoothRegionGeometry(BlockVolume<std::uint8_t>* volumeData, RegionGeometry& regGeom)
|
||||
{
|
||||
const boost::uint8_t uSmoothingFactor = 2;
|
||||
const std::uint8_t uSmoothingFactor = 2;
|
||||
const float fThreshold = 0.5f;
|
||||
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData);
|
||||
|
||||
std::vector<SurfaceVertex>& vecVertices = regGeom.m_patchSingleMaterial->m_vecVertices;
|
||||
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin();
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
@ -55,7 +55,7 @@ namespace PolyVox
|
||||
return listChangedRegionGeometry;
|
||||
}
|
||||
|
||||
boost::uint32_t getIndex(boost::uint32_t x, boost::uint32_t y)
|
||||
std::uint32_t getIndex(std::uint32_t x, std::uint32_t y)
|
||||
{
|
||||
return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1));
|
||||
}
|
||||
@ -66,16 +66,16 @@ namespace PolyVox
|
||||
singleMaterialPatch->m_vecTriangleIndices.clear();
|
||||
|
||||
//For edge indices
|
||||
boost::int32_t* vertexIndicesX0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesY0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesZ0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesX1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesY1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesZ1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesX0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesY0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesZ0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesX1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesY1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesZ1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
|
||||
//Cell bitmasks
|
||||
boost::uint8_t* bitmask0 = new boost::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::uint8_t* bitmask1 = new boost::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::uint8_t* bitmask0 = new std::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::uint8_t* bitmask1 = new std::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
|
||||
//When generating the mesh for a region we actually look one voxel outside it in the
|
||||
// back, bottom, right direction. Protect against access violations by cropping region here
|
||||
@ -91,22 +91,22 @@ namespace PolyVox
|
||||
regSlice0.setUpperCorner(Vector3DInt32(regSlice0.getUpperCorner().getX(),regSlice0.getUpperCorner().getY(),regSlice0.getLowerCorner().getZ()));
|
||||
|
||||
//Iterator to access the volume data
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData);
|
||||
|
||||
//Compute bitmask for initial slice
|
||||
boost::uint32_t uNoOfNonEmptyCellsForSlice0 = computeInitialRoughBitmaskForSlice(volIter, regSlice0, offset, bitmask0);
|
||||
std::uint32_t uNoOfNonEmptyCellsForSlice0 = computeInitialRoughBitmaskForSlice(volIter, regSlice0, offset, bitmask0);
|
||||
if(uNoOfNonEmptyCellsForSlice0 != 0)
|
||||
{
|
||||
//If there were some non-empty cells then generate initial slice vertices for them
|
||||
generateRoughVerticesForSlice(volIter,regSlice0, offset, bitmask0, singleMaterialPatch, vertexIndicesX0, vertexIndicesY0, vertexIndicesZ0);
|
||||
}
|
||||
|
||||
for(boost::uint32_t uSlice = 0; ((uSlice <= POLYVOX_REGION_SIDE_LENGTH-1) && (uSlice + offset.getZ() < region.getUpperCorner().getZ())); ++uSlice)
|
||||
for(std::uint32_t uSlice = 0; ((uSlice <= POLYVOX_REGION_SIDE_LENGTH-1) && (uSlice + offset.getZ() < region.getUpperCorner().getZ())); ++uSlice)
|
||||
{
|
||||
Region regSlice1(regSlice0);
|
||||
regSlice1.shift(Vector3DInt32(0,0,1));
|
||||
|
||||
boost::uint32_t uNoOfNonEmptyCellsForSlice1 = computeRoughBitmaskForSliceFromPrevious(volIter, regSlice1, offset, bitmask1, bitmask0);
|
||||
std::uint32_t uNoOfNonEmptyCellsForSlice1 = computeRoughBitmaskForSliceFromPrevious(volIter, regSlice1, offset, bitmask1, bitmask0);
|
||||
|
||||
if(uNoOfNonEmptyCellsForSlice1 != 0)
|
||||
{
|
||||
@ -137,9 +137,9 @@ namespace PolyVox
|
||||
delete[] vertexIndicesZ1;
|
||||
}
|
||||
|
||||
boost::uint32_t computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask)
|
||||
std::uint32_t computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask)
|
||||
{
|
||||
boost::uint32_t uNoOfNonEmptyCells = 0;
|
||||
std::uint32_t uNoOfNonEmptyCells = 0;
|
||||
|
||||
//Iterate over each cell in the region
|
||||
volIter.setPosition(regSlice.getLowerCorner().getX(),regSlice.getLowerCorner().getY(), regSlice.getLowerCorner().getZ());
|
||||
@ -287,9 +287,9 @@ namespace PolyVox
|
||||
return uNoOfNonEmptyCells;
|
||||
}
|
||||
|
||||
boost::uint32_t computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, uint8_t* previousBitmask)
|
||||
std::uint32_t computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, uint8_t* previousBitmask)
|
||||
{
|
||||
boost::uint32_t uNoOfNonEmptyCells = 0;
|
||||
std::uint32_t uNoOfNonEmptyCells = 0;
|
||||
|
||||
//Iterate over each cell in the region
|
||||
volIter.setPosition(regSlice.getLowerCorner().getX(),regSlice.getLowerCorner().getY(), regSlice.getLowerCorner().getZ());
|
||||
@ -403,7 +403,7 @@ namespace PolyVox
|
||||
return uNoOfNonEmptyCells;
|
||||
}
|
||||
|
||||
void generateRoughVerticesForSlice(BlockVolumeIterator<uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,boost::int32_t vertexIndicesX[],boost::int32_t vertexIndicesY[],boost::int32_t vertexIndicesZ[])
|
||||
void generateRoughVerticesForSlice(BlockVolumeIterator<uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,std::int32_t vertexIndicesX[],std::int32_t vertexIndicesY[],std::int32_t vertexIndicesZ[])
|
||||
{
|
||||
//Iterate over each cell in the region
|
||||
volIter.setPosition(regSlice.getLowerCorner().getX(),regSlice.getLowerCorner().getY(), regSlice.getLowerCorner().getZ());
|
||||
@ -470,9 +470,9 @@ namespace PolyVox
|
||||
}while(volIter.moveForwardInRegionXYZ());//For each cell
|
||||
}
|
||||
|
||||
void generateRoughIndicesForSlice(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, uint8_t* bitmask1, boost::int32_t vertexIndicesX0[],boost::int32_t vertexIndicesY0[],boost::int32_t vertexIndicesZ0[], boost::int32_t vertexIndicesX1[],boost::int32_t vertexIndicesY1[],boost::int32_t vertexIndicesZ1[])
|
||||
void generateRoughIndicesForSlice(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, 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[])
|
||||
{
|
||||
boost::uint32_t indlist[12];
|
||||
std::uint32_t indlist[12];
|
||||
|
||||
Region regCroppedSlice(regSlice);
|
||||
regCroppedSlice.setUpperCorner(regCroppedSlice.getUpperCorner() - Vector3DInt32(1,1,0));
|
||||
@ -559,9 +559,9 @@ namespace PolyVox
|
||||
|
||||
for (int i=0;triTable[iCubeIndex][i]!=-1;i+=3)
|
||||
{
|
||||
boost::uint32_t ind0 = indlist[triTable[iCubeIndex][i ]];
|
||||
boost::uint32_t ind1 = indlist[triTable[iCubeIndex][i+1]];
|
||||
boost::uint32_t ind2 = indlist[triTable[iCubeIndex][i+2]];
|
||||
std::uint32_t ind0 = indlist[triTable[iCubeIndex][i ]];
|
||||
std::uint32_t ind1 = indlist[triTable[iCubeIndex][i+1]];
|
||||
std::uint32_t ind2 = indlist[triTable[iCubeIndex][i+2]];
|
||||
|
||||
singleMaterialPatch->m_vecTriangleIndices.push_back(ind0);
|
||||
singleMaterialPatch->m_vecTriangleIndices.push_back(ind1);
|
||||
@ -584,7 +584,7 @@ namespace PolyVox
|
||||
|
||||
Vector3DFloat vertlist[12];
|
||||
uint8_t vertMaterials[12];
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData);
|
||||
volIter.setValidRegion(region);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -11,11 +11,11 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
boost::uint32_t getDecimatedIndex(boost::uint32_t x, boost::uint32_t y)
|
||||
std::uint32_t getDecimatedIndex(std::uint32_t x, std::uint32_t y)
|
||||
{
|
||||
return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1));
|
||||
}
|
||||
@ -26,16 +26,16 @@ namespace PolyVox
|
||||
singleMaterialPatch->m_vecTriangleIndices.clear();
|
||||
|
||||
//For edge indices
|
||||
boost::int32_t* vertexIndicesX0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesY0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesZ0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesX1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesY1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::int32_t* vertexIndicesZ1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesX0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesY0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesZ0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesX1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesY1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::int32_t* vertexIndicesZ1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
|
||||
//Cell bitmasks
|
||||
boost::uint8_t* bitmask0 = new boost::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
boost::uint8_t* bitmask1 = new boost::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::uint8_t* bitmask0 = new std::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
std::uint8_t* bitmask1 = new std::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)];
|
||||
|
||||
const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
|
||||
@ -55,22 +55,22 @@ namespace PolyVox
|
||||
regSlice0.setUpperCorner(v3dUpperCorner);
|
||||
|
||||
//Iterator to access the volume data
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData);
|
||||
|
||||
//Compute bitmask for initial slice
|
||||
boost::uint32_t uNoOfNonEmptyCellsForSlice0 = computeInitialDecimatedBitmaskForSlice(volIter, uLevel, regSlice0, offset, bitmask0);
|
||||
std::uint32_t uNoOfNonEmptyCellsForSlice0 = computeInitialDecimatedBitmaskForSlice(volIter, uLevel, regSlice0, offset, bitmask0);
|
||||
if(uNoOfNonEmptyCellsForSlice0 != 0)
|
||||
{
|
||||
//If there were some non-empty cells then generate initial slice vertices for them
|
||||
generateDecimatedVerticesForSlice(volIter, uLevel, regSlice0, offset, bitmask0, singleMaterialPatch, vertexIndicesX0, vertexIndicesY0, vertexIndicesZ0);
|
||||
}
|
||||
|
||||
for(boost::uint32_t uSlice = 1; ((uSlice <= POLYVOX_REGION_SIDE_LENGTH) && (uSlice + offset.getZ() <= regVolume.getUpperCorner().getZ())); uSlice += uStepSize)
|
||||
for(std::uint32_t uSlice = 1; ((uSlice <= POLYVOX_REGION_SIDE_LENGTH) && (uSlice + offset.getZ() <= regVolume.getUpperCorner().getZ())); uSlice += uStepSize)
|
||||
{
|
||||
Region regSlice1(regSlice0);
|
||||
regSlice1.shift(Vector3DInt32(0,0,uStepSize));
|
||||
|
||||
boost::uint32_t uNoOfNonEmptyCellsForSlice1 = computeDecimatedBitmaskForSliceFromPrevious(volIter, uLevel, regSlice1, offset, bitmask1, bitmask0);
|
||||
std::uint32_t uNoOfNonEmptyCellsForSlice1 = computeDecimatedBitmaskForSliceFromPrevious(volIter, uLevel, regSlice1, offset, bitmask1, bitmask0);
|
||||
|
||||
if(uNoOfNonEmptyCellsForSlice1 != 0)
|
||||
{
|
||||
@ -110,10 +110,10 @@ namespace PolyVox
|
||||
}*/
|
||||
}
|
||||
|
||||
boost::uint32_t computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask)
|
||||
std::uint32_t computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask)
|
||||
{
|
||||
const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
boost::uint32_t uNoOfNonEmptyCells = 0;
|
||||
std::uint32_t uNoOfNonEmptyCells = 0;
|
||||
|
||||
//Iterate over each cell in the region
|
||||
for(uint16_t y = regSlice.getLowerCorner().getY(); y <= regSlice.getUpperCorner().getY(); y += uStepSize)
|
||||
@ -279,10 +279,10 @@ namespace PolyVox
|
||||
return uNoOfNonEmptyCells;
|
||||
}
|
||||
|
||||
boost::uint32_t computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, uint8_t* previousBitmask)
|
||||
std::uint32_t computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, uint8_t* previousBitmask)
|
||||
{
|
||||
const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
boost::uint32_t uNoOfNonEmptyCells = 0;
|
||||
std::uint32_t uNoOfNonEmptyCells = 0;
|
||||
|
||||
//Iterate over each cell in the region
|
||||
for(uint16_t y = regSlice.getLowerCorner().getY(); y <= regSlice.getUpperCorner().getY(); y += uStepSize)
|
||||
@ -405,7 +405,7 @@ namespace PolyVox
|
||||
return uNoOfNonEmptyCells;
|
||||
}
|
||||
|
||||
void generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,boost::int32_t vertexIndicesX[],boost::int32_t vertexIndicesY[],boost::int32_t vertexIndicesZ[])
|
||||
void generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,std::int32_t vertexIndicesX[],std::int32_t vertexIndicesY[],std::int32_t vertexIndicesZ[])
|
||||
{
|
||||
const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
|
||||
@ -476,10 +476,10 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
void generateDecimatedIndicesForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, uint8_t* bitmask1, boost::int32_t vertexIndicesX0[],boost::int32_t vertexIndicesY0[],boost::int32_t vertexIndicesZ0[], boost::int32_t vertexIndicesX1[],boost::int32_t vertexIndicesY1[],boost::int32_t vertexIndicesZ1[])
|
||||
void generateDecimatedIndicesForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, 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[])
|
||||
{
|
||||
const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel;
|
||||
boost::uint32_t indlist[12];
|
||||
std::uint32_t indlist[12];
|
||||
|
||||
for(uint16_t y = regSlice.getLowerCorner().getY() - offset.getY(); y < regSlice.getUpperCorner().getY() - offset.getY(); y += uStepSize)
|
||||
{
|
||||
@ -561,9 +561,9 @@ namespace PolyVox
|
||||
|
||||
for (int i=0;triTable[iCubeIndex][i]!=-1;i+=3)
|
||||
{
|
||||
boost::uint32_t ind0 = indlist[triTable[iCubeIndex][i ]];
|
||||
boost::uint32_t ind1 = indlist[triTable[iCubeIndex][i+1]];
|
||||
boost::uint32_t ind2 = indlist[triTable[iCubeIndex][i+2]];
|
||||
std::uint32_t ind0 = indlist[triTable[iCubeIndex][i ]];
|
||||
std::uint32_t ind1 = indlist[triTable[iCubeIndex][i+1]];
|
||||
std::uint32_t ind2 = indlist[triTable[iCubeIndex][i+2]];
|
||||
|
||||
singleMaterialPatch->m_vecTriangleIndices.push_back(ind0);
|
||||
singleMaterialPatch->m_vecTriangleIndices.push_back(ind1);
|
||||
@ -588,7 +588,7 @@ namespace PolyVox
|
||||
Vector3DFloat vertlist[12];
|
||||
Vector3DFloat normlist[12];
|
||||
uint8_t vertMaterials[12];
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData);
|
||||
volIter.setValidRegion(region);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -817,7 +817,7 @@ namespace PolyVox
|
||||
|
||||
Vector3DFloat result;
|
||||
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create?
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create?
|
||||
|
||||
|
||||
if(normalGenerationMethod == SOBEL)
|
||||
|
@ -27,21 +27,21 @@ namespace PolyVox
|
||||
{
|
||||
//Note: this function only works for inputs which are a power of two and not zero
|
||||
//If this is not the case then the output is undefined.
|
||||
boost::uint8_t logBase2(boost::uint32_t uInput)
|
||||
std::uint8_t logBase2(std::uint32_t uInput)
|
||||
{
|
||||
assert(uInput != 0);
|
||||
assert(isPowerOf2(uInput));
|
||||
|
||||
boost::uint32_t uResult = 0;
|
||||
std::uint32_t uResult = 0;
|
||||
while( (uInput >> uResult) != 0)
|
||||
{
|
||||
++uResult;
|
||||
}
|
||||
return static_cast<boost::uint8_t>(uResult-1);
|
||||
return static_cast<std::uint8_t>(uResult-1);
|
||||
}
|
||||
|
||||
|
||||
bool isPowerOf2(boost::uint32_t uInput)
|
||||
bool isPowerOf2(std::uint32_t uInput)
|
||||
{
|
||||
if(uInput == 0)
|
||||
return false;
|
||||
|
@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "BlockVolume.h"
|
||||
#include "BlockVolumeIterator.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
@ -50,7 +50,7 @@ namespace PolyVox
|
||||
{
|
||||
}
|
||||
|
||||
void VolumeChangeTracker::setVolumeData(BlockVolume<boost::uint8_t>* volumeDataToSet)
|
||||
void VolumeChangeTracker::setVolumeData(BlockVolume<std::uint8_t>* volumeDataToSet)
|
||||
{
|
||||
volumeData = volumeDataToSet;
|
||||
volRegionUpToDate = new LinearVolume<bool>(PolyVox::logBase2(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS));
|
||||
@ -124,20 +124,20 @@ namespace PolyVox
|
||||
assert(uY < volumeData->getSideLength());
|
||||
assert(uZ < volumeData->getSideLength());
|
||||
|
||||
BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> volIter(*volumeData);
|
||||
volIter.setPosition(uX,uY,uZ);
|
||||
return volIter.getVoxel();
|
||||
}
|
||||
|
||||
BlockVolume<boost::uint8_t>* VolumeChangeTracker::getVolumeData(void) const
|
||||
BlockVolume<std::uint8_t>* VolumeChangeTracker::getVolumeData(void) const
|
||||
{
|
||||
return volumeData;
|
||||
}
|
||||
|
||||
void VolumeChangeTracker::setVoxelAt(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z, boost::uint8_t value)
|
||||
void VolumeChangeTracker::setVoxelAt(std::uint16_t x, std::uint16_t y, std::uint16_t z, std::uint8_t value)
|
||||
{
|
||||
//FIXME - rather than creating a iterator each time we should have one stored
|
||||
BlockVolumeIterator<boost::uint8_t> iterVol(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> iterVol(*volumeData);
|
||||
iterVol.setPosition(x,y,z);
|
||||
iterVol.setVoxel(value);
|
||||
|
||||
@ -178,12 +178,12 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
void VolumeChangeTracker::setLockedVoxelAt(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z, boost::uint8_t value)
|
||||
void VolumeChangeTracker::setLockedVoxelAt(std::uint16_t x, std::uint16_t y, std::uint16_t z, std::uint8_t value)
|
||||
{
|
||||
assert(m_bIsLocked);
|
||||
|
||||
//FIXME - rather than creating a iterator each time we should have one stored
|
||||
BlockVolumeIterator<boost::uint8_t> iterVol(*volumeData);
|
||||
BlockVolumeIterator<std::uint8_t> iterVol(*volumeData);
|
||||
iterVol.setPosition(x,y,z);
|
||||
iterVol.setVoxel(value);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
float computeSmoothedVoxel(BlockVolumeIterator<boost::uint8_t>& volIter)
|
||||
float computeSmoothedVoxel(BlockVolumeIterator<std::uint8_t>& volIter)
|
||||
{
|
||||
assert(volIter.getPosX() >= 1);
|
||||
assert(volIter.getPosY() >= 1);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <gl/glut.h> // The GL Utility Toolkit (Glut) Header
|
||||
|
||||
//Some namespaces we need
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
using namespace PolyVox;
|
||||
using namespace std;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user