diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e3942cb..3d997e49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ SET(SRC_FILES SET(INC_FILES include/Block.h include/Block.inl + include/BlockVolume.h + include/BlockVolume.inl include/Constants.h include/GradientEstimators.h include/GradientEstimators.inl @@ -28,9 +30,7 @@ SET(INC_FILES include/TypeDef.h include/Utility.h include/Vector.h - include/Vector.inl - include/Volume.h - include/Volume.inl + include/Vector.inl include/VolumeIterator.h include/VolumeIterator.inl ) diff --git a/include/Volume.h b/include/BlockVolume.h similarity index 80% rename from include/Volume.h rename to include/BlockVolume.h index 27b962f6..b964ca3b 100644 --- a/include/Volume.h +++ b/include/BlockVolume.h @@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #pragma endregion -#ifndef __PolyVox_Volume_H__ -#define __PolyVox_Volume_H__ +#ifndef __PolyVox_BlockVolume_H__ +#define __PolyVox_BlockVolume_H__ #pragma region Headers #include "PolyVoxForwardDeclarations.h" @@ -33,17 +33,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. namespace PolyVox { template - class Volume + class BlockVolume { //Make VolumeIterator a friend friend class VolumeIterator; public: - Volume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower = 5); - Volume(const Volume& rhs); - ~Volume(); + BlockVolume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower = 5); + BlockVolume(const BlockVolume& rhs); + ~BlockVolume(); - Volume& operator=(const Volume& rhs); + BlockVolume& operator=(const BlockVolume& rhs); boost::uint16_t getSideLength(void) const; VoxelType getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const; @@ -75,11 +75,11 @@ namespace PolyVox }; //Some handy typedefs - typedef Volume FloatVolume; - typedef Volume UInt8Volume; - typedef Volume UInt16Volume; + typedef BlockVolume FloatBlockVolume; + typedef BlockVolume UInt8BlockVolume; + typedef BlockVolume UInt16BlockVolume; } -#include "Volume.inl" +#include "BlockVolume.inl" #endif diff --git a/include/Volume.inl b/include/BlockVolume.inl similarity index 80% rename from include/Volume.inl rename to include/BlockVolume.inl index 5bb1bc40..0c568c36 100644 --- a/include/Volume.inl +++ b/include/BlockVolume.inl @@ -30,7 +30,7 @@ namespace PolyVox { #pragma region Constructors/Destructors template - Volume::Volume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower) + BlockVolume::BlockVolume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower) :m_pBlocks(0) { //Check the volume size is sensible. This corresponds to a side length of 65536 voxels @@ -68,13 +68,13 @@ namespace PolyVox } template - Volume::Volume(const Volume& rhs) + BlockVolume::BlockVolume(const BlockVolume& rhs) { *this = rhs; } template - Volume::~Volume() + BlockVolume::~BlockVolume() { for(boost::uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i) { @@ -85,7 +85,7 @@ namespace PolyVox #pragma region Operators template - Volume& Volume::operator=(const Volume& rhs) + BlockVolume& BlockVolume::operator=(const BlockVolume& rhs) { if (this == &rhs) { @@ -119,13 +119,13 @@ namespace PolyVox #pragma region Getters template - boost::uint16_t Volume::getSideLength(void) const + boost::uint16_t BlockVolume::getSideLength(void) const { return m_uSideLength; } template - VoxelType Volume::getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const + VoxelType BlockVolume::getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const { assert(uXPos < getSideLength()); assert(uYPos < getSideLength()); @@ -150,7 +150,7 @@ namespace PolyVox } template - VoxelType Volume::getVoxelAt(const Vector3DUint16& v3dPos) const + VoxelType BlockVolume::getVoxelAt(const Vector3DUint16& v3dPos) const { assert(v3dPos.x() < m_uSideLength); assert(v3dPos.y() < m_uSideLength); @@ -162,7 +162,7 @@ namespace PolyVox #pragma region Other template - bool Volume::containsPoint(Vector3DFloat pos, float boundary) const + bool BlockVolume::containsPoint(Vector3DFloat pos, float boundary) const { return (pos.x() <= m_uSideLength - 1 - boundary) && (pos.y() <= m_uSideLength - 1 - boundary) @@ -173,7 +173,7 @@ namespace PolyVox } template - bool Volume::containsPoint(Vector3DInt32 pos, boost::uint16_t boundary) const + bool BlockVolume::containsPoint(Vector3DInt32 pos, boost::uint16_t boundary) const { return (pos.x() <= m_uSideLength - 1 - boundary) && (pos.y() <= m_uSideLength - 1 - boundary) @@ -184,7 +184,7 @@ namespace PolyVox } template - VolumeIterator Volume::firstVoxel(void) + VolumeIterator BlockVolume::firstVoxel(void) { VolumeIterator iter(*this); iter.setPosition(0,0,0); @@ -192,12 +192,12 @@ namespace PolyVox } template - void Volume::idle(boost::uint32_t uAmount) + void BlockVolume::idle(boost::uint32_t uAmount) { } template - VolumeIterator Volume::lastVoxel(void) + VolumeIterator BlockVolume::lastVoxel(void) { VolumeIterator iter(*this); iter.setPosition(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1); @@ -207,9 +207,9 @@ namespace PolyVox #pragma region Private Implementation template - Block* Volume::getHomogenousBlock(VoxelType tHomogenousValue) const + Block* BlockVolume::getHomogenousBlock(VoxelType tHomogenousValue) const { - typename std::map*>::iterator iterResult = m_pHomogenousBlocks.find(tHomogenousValue); + std::map*>::iterator iterResult = m_pHomogenousBlocks.find(tHomogenousValue); if(iterResult == m_pHomogenousBlocks.end()) { Block* pBlock = new Block(m_uBlockSideLengthPower); diff --git a/include/PolyVoxForwardDeclarations.h b/include/PolyVoxForwardDeclarations.h index c97aafe8..6209c4e8 100644 --- a/include/PolyVoxForwardDeclarations.h +++ b/include/PolyVoxForwardDeclarations.h @@ -27,6 +27,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. namespace PolyVox { template class Block; + template class BlockVolume; + //Some handy typedefs + typedef BlockVolume FloatBlockVolume; + typedef BlockVolume UInt8BlockVolume; + typedef BlockVolume UInt16BlockVolume; class IndexedSurfacePatch; class IntegrealVector3; template class LinearVolume; @@ -41,12 +46,7 @@ namespace PolyVox 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; - template class Volume; - //Some handy typedefs - typedef Volume FloatVolume; - typedef Volume UInt8Volume; - typedef Volume UInt16Volume; + typedef Vector<3,boost::uint32_t> Vector3DUint32; template class VolumeIterator; } diff --git a/include/PolyVoxSceneManager.h b/include/PolyVoxSceneManager.h index e39c13fb..a528bc3d 100644 --- a/include/PolyVoxSceneManager.h +++ b/include/PolyVoxSceneManager.h @@ -52,11 +52,11 @@ namespace PolyVox const std::string& getTypeName(void) const; boost::uint16_t getSideLength(void); - const Volume* getVolumeData(void) const; + const BlockVolume* getVolumeData(void) const; //Setters - void setVolumeData(Volume* volumeDataToSet); + void setVolumeData(BlockVolume* volumeDataToSet); void setNormalGenerationMethod(NormalGenerationMethod method); //void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo * visibleBounds, bool onlyShadowCasters); @@ -92,7 +92,7 @@ namespace PolyVox NormalGenerationMethod m_normalGenerationMethod; private: - Volume* volumeData; + BlockVolume* volumeData; bool m_bHaveGeneratedMeshes; diff --git a/include/VolumeIterator.h b/include/VolumeIterator.h index b2c9aeab..e7dbc3b5 100644 --- a/include/VolumeIterator.h +++ b/include/VolumeIterator.h @@ -34,7 +34,7 @@ namespace PolyVox class VolumeIterator { public: - VolumeIterator(Volume& volume); + VolumeIterator(BlockVolume& volume); ~VolumeIterator(); bool operator==(const VolumeIterator& rhs); @@ -89,7 +89,7 @@ namespace PolyVox private: //The current volume - Volume& mVolume; + BlockVolume& mVolume; //The current position in the volume boost::uint16_t mXPosInVolume; diff --git a/include/VolumeIterator.inl b/include/VolumeIterator.inl index 717f7b3b..956febb6 100644 --- a/include/VolumeIterator.inl +++ b/include/VolumeIterator.inl @@ -21,15 +21,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #pragma region Headers #include "Block.h" +#include "BlockVolume.h" #include "Vector.h" -#include "Volume.h" #pragma endregion namespace PolyVox { #pragma region Constructors/Destructors template - VolumeIterator::VolumeIterator(Volume& volume) + VolumeIterator::VolumeIterator(BlockVolume& volume) :mVolume(volume) { } diff --git a/source/PolyVoxSceneManager.cpp b/source/PolyVoxSceneManager.cpp index ae9a22e9..982398f3 100644 --- a/source/PolyVoxSceneManager.cpp +++ b/source/PolyVoxSceneManager.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "SurfaceVertex.h" #include "Utility.h" #include "Vector.h" -#include "Volume.h" +#include "BlockVolume.h" #include "VolumeIterator.h" using namespace boost; @@ -53,7 +53,7 @@ namespace PolyVox { } - void PolyVoxSceneManager::setVolumeData(Volume* volumeDataToSet) + void PolyVoxSceneManager::setVolumeData(BlockVolume* volumeDataToSet) { volumeData = volumeDataToSet; volSurfaceUpToDate = new LinearVolume(PolyVox::logBase2(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS)); @@ -1073,7 +1073,7 @@ namespace PolyVox m_axisNode->setVisible(visible); }*/ - const Volume* PolyVoxSceneManager::getVolumeData(void) const + const BlockVolume* PolyVoxSceneManager::getVolumeData(void) const { return volumeData; }