Renamed Volume to BlockVolume.

This commit is contained in:
David Williams 2008-05-24 16:25:05 +00:00
parent dc9950d1c8
commit b42f28793f
8 changed files with 44 additions and 44 deletions

View File

@ -14,6 +14,8 @@ SET(SRC_FILES
SET(INC_FILES SET(INC_FILES
include/Block.h include/Block.h
include/Block.inl include/Block.inl
include/BlockVolume.h
include/BlockVolume.inl
include/Constants.h include/Constants.h
include/GradientEstimators.h include/GradientEstimators.h
include/GradientEstimators.inl include/GradientEstimators.inl
@ -29,8 +31,6 @@ SET(INC_FILES
include/Utility.h include/Utility.h
include/Vector.h include/Vector.h
include/Vector.inl include/Vector.inl
include/Volume.h
include/Volume.inl
include/VolumeIterator.h include/VolumeIterator.h
include/VolumeIterator.inl include/VolumeIterator.inl
) )

View File

@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
******************************************************************************/ ******************************************************************************/
#pragma endregion #pragma endregion
#ifndef __PolyVox_Volume_H__ #ifndef __PolyVox_BlockVolume_H__
#define __PolyVox_Volume_H__ #define __PolyVox_BlockVolume_H__
#pragma region Headers #pragma region Headers
#include "PolyVoxForwardDeclarations.h" #include "PolyVoxForwardDeclarations.h"
@ -33,17 +33,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox namespace PolyVox
{ {
template <typename VoxelType> template <typename VoxelType>
class Volume class BlockVolume
{ {
//Make VolumeIterator a friend //Make VolumeIterator a friend
friend class VolumeIterator<VoxelType>; friend class VolumeIterator<VoxelType>;
public: public:
Volume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower = 5); BlockVolume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower = 5);
Volume(const Volume& rhs); BlockVolume(const BlockVolume& rhs);
~Volume(); ~BlockVolume();
Volume& operator=(const Volume& rhs); BlockVolume& operator=(const BlockVolume& rhs);
boost::uint16_t getSideLength(void) const; boost::uint16_t getSideLength(void) const;
VoxelType getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) 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 //Some handy typedefs
typedef Volume<float> FloatVolume; typedef BlockVolume<float> FloatBlockVolume;
typedef Volume<boost::uint8_t> UInt8Volume; typedef BlockVolume<boost::uint8_t> UInt8BlockVolume;
typedef Volume<boost::uint16_t> UInt16Volume; typedef BlockVolume<boost::uint16_t> UInt16BlockVolume;
} }
#include "Volume.inl" #include "BlockVolume.inl"
#endif #endif

View File

@ -30,7 +30,7 @@ namespace PolyVox
{ {
#pragma region Constructors/Destructors #pragma region Constructors/Destructors
template <typename VoxelType> template <typename VoxelType>
Volume<VoxelType>::Volume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower) BlockVolume<VoxelType>::BlockVolume(boost::uint8_t uSideLengthPower, boost::uint8_t uBlockSideLengthPower)
:m_pBlocks(0) :m_pBlocks(0)
{ {
//Check the volume size is sensible. This corresponds to a side length of 65536 voxels //Check the volume size is sensible. This corresponds to a side length of 65536 voxels
@ -68,13 +68,13 @@ namespace PolyVox
} }
template <typename VoxelType> template <typename VoxelType>
Volume<VoxelType>::Volume(const Volume<VoxelType>& rhs) BlockVolume<VoxelType>::BlockVolume(const BlockVolume<VoxelType>& rhs)
{ {
*this = rhs; *this = rhs;
} }
template <typename VoxelType> template <typename VoxelType>
Volume<VoxelType>::~Volume() BlockVolume<VoxelType>::~BlockVolume()
{ {
for(boost::uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i) for(boost::uint32_t i = 0; i < m_uNoOfBlocksInVolume; ++i)
{ {
@ -85,7 +85,7 @@ namespace PolyVox
#pragma region Operators #pragma region Operators
template <typename VoxelType> template <typename VoxelType>
Volume<VoxelType>& Volume<VoxelType>::operator=(const Volume& rhs) BlockVolume<VoxelType>& BlockVolume<VoxelType>::operator=(const BlockVolume& rhs)
{ {
if (this == &rhs) if (this == &rhs)
{ {
@ -119,13 +119,13 @@ namespace PolyVox
#pragma region Getters #pragma region Getters
template <typename VoxelType> template <typename VoxelType>
boost::uint16_t Volume<VoxelType>::getSideLength(void) const boost::uint16_t BlockVolume<VoxelType>::getSideLength(void) const
{ {
return m_uSideLength; return m_uSideLength;
} }
template <typename VoxelType> template <typename VoxelType>
VoxelType Volume<VoxelType>::getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const VoxelType BlockVolume<VoxelType>::getVoxelAt(boost::uint16_t uXPos, boost::uint16_t uYPos, boost::uint16_t uZPos) const
{ {
assert(uXPos < getSideLength()); assert(uXPos < getSideLength());
assert(uYPos < getSideLength()); assert(uYPos < getSideLength());
@ -150,7 +150,7 @@ namespace PolyVox
} }
template <typename VoxelType> template <typename VoxelType>
VoxelType Volume<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const VoxelType BlockVolume<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
{ {
assert(v3dPos.x() < m_uSideLength); assert(v3dPos.x() < m_uSideLength);
assert(v3dPos.y() < m_uSideLength); assert(v3dPos.y() < m_uSideLength);
@ -162,7 +162,7 @@ namespace PolyVox
#pragma region Other #pragma region Other
template <typename VoxelType> template <typename VoxelType>
bool Volume<VoxelType>::containsPoint(Vector3DFloat pos, float boundary) const bool BlockVolume<VoxelType>::containsPoint(Vector3DFloat pos, float boundary) const
{ {
return (pos.x() <= m_uSideLength - 1 - boundary) return (pos.x() <= m_uSideLength - 1 - boundary)
&& (pos.y() <= m_uSideLength - 1 - boundary) && (pos.y() <= m_uSideLength - 1 - boundary)
@ -173,7 +173,7 @@ namespace PolyVox
} }
template <typename VoxelType> template <typename VoxelType>
bool Volume<VoxelType>::containsPoint(Vector3DInt32 pos, boost::uint16_t boundary) const bool BlockVolume<VoxelType>::containsPoint(Vector3DInt32 pos, boost::uint16_t boundary) const
{ {
return (pos.x() <= m_uSideLength - 1 - boundary) return (pos.x() <= m_uSideLength - 1 - boundary)
&& (pos.y() <= m_uSideLength - 1 - boundary) && (pos.y() <= m_uSideLength - 1 - boundary)
@ -184,7 +184,7 @@ namespace PolyVox
} }
template <typename VoxelType> template <typename VoxelType>
VolumeIterator<VoxelType> Volume<VoxelType>::firstVoxel(void) VolumeIterator<VoxelType> BlockVolume<VoxelType>::firstVoxel(void)
{ {
VolumeIterator<VoxelType> iter(*this); VolumeIterator<VoxelType> iter(*this);
iter.setPosition(0,0,0); iter.setPosition(0,0,0);
@ -192,12 +192,12 @@ namespace PolyVox
} }
template <typename VoxelType> template <typename VoxelType>
void Volume<VoxelType>::idle(boost::uint32_t uAmount) void BlockVolume<VoxelType>::idle(boost::uint32_t uAmount)
{ {
} }
template <typename VoxelType> template <typename VoxelType>
VolumeIterator<VoxelType> Volume<VoxelType>::lastVoxel(void) VolumeIterator<VoxelType> BlockVolume<VoxelType>::lastVoxel(void)
{ {
VolumeIterator<VoxelType> iter(*this); VolumeIterator<VoxelType> iter(*this);
iter.setPosition(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1); iter.setPosition(m_uSideLength-1,m_uSideLength-1,m_uSideLength-1);
@ -207,9 +207,9 @@ namespace PolyVox
#pragma region Private Implementation #pragma region Private Implementation
template <typename VoxelType> template <typename VoxelType>
Block<VoxelType>* Volume<VoxelType>::getHomogenousBlock(VoxelType tHomogenousValue) const Block<VoxelType>* BlockVolume<VoxelType>::getHomogenousBlock(VoxelType tHomogenousValue) const
{ {
typename std::map<VoxelType, Block<VoxelType>*>::iterator iterResult = m_pHomogenousBlocks.find(tHomogenousValue); std::map<VoxelType, Block<VoxelType>*>::iterator iterResult = m_pHomogenousBlocks.find(tHomogenousValue);
if(iterResult == m_pHomogenousBlocks.end()) if(iterResult == m_pHomogenousBlocks.end())
{ {
Block<VoxelType>* pBlock = new Block<VoxelType>(m_uBlockSideLengthPower); Block<VoxelType>* pBlock = new Block<VoxelType>(m_uBlockSideLengthPower);

View File

@ -27,6 +27,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
namespace PolyVox namespace PolyVox
{ {
template <typename VoxelType> class Block; template <typename VoxelType> class Block;
template <typename VoxelType> class BlockVolume;
//Some handy typedefs
typedef BlockVolume<float> FloatBlockVolume;
typedef BlockVolume<boost::uint8_t> UInt8BlockVolume;
typedef BlockVolume<boost::uint16_t> UInt16BlockVolume;
class IndexedSurfacePatch; class IndexedSurfacePatch;
class IntegrealVector3; class IntegrealVector3;
template <typename VoxelType> class LinearVolume; template <typename VoxelType> class LinearVolume;
@ -42,11 +47,6 @@ namespace PolyVox
typedef Vector<3,boost::uint16_t> Vector3DUint16; typedef Vector<3,boost::uint16_t> Vector3DUint16;
typedef Vector<3,boost::int32_t> Vector3DInt32; typedef Vector<3,boost::int32_t> Vector3DInt32;
typedef Vector<3,boost::uint32_t> Vector3DUint32; typedef Vector<3,boost::uint32_t> Vector3DUint32;
template <typename VoxelType> class Volume;
//Some handy typedefs
typedef Volume<float> FloatVolume;
typedef Volume<boost::uint8_t> UInt8Volume;
typedef Volume<boost::uint16_t> UInt16Volume;
template <typename VoxelType> class VolumeIterator; template <typename VoxelType> class VolumeIterator;
} }

View File

@ -52,11 +52,11 @@ namespace PolyVox
const std::string& getTypeName(void) const; const std::string& getTypeName(void) const;
boost::uint16_t getSideLength(void); boost::uint16_t getSideLength(void);
const Volume<boost::uint8_t>* getVolumeData(void) const; const BlockVolume<boost::uint8_t>* getVolumeData(void) const;
//Setters //Setters
void setVolumeData(Volume<boost::uint8_t>* volumeDataToSet); void setVolumeData(BlockVolume<boost::uint8_t>* volumeDataToSet);
void setNormalGenerationMethod(NormalGenerationMethod method); void setNormalGenerationMethod(NormalGenerationMethod method);
//void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo * visibleBounds, bool onlyShadowCasters); //void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo * visibleBounds, bool onlyShadowCasters);
@ -92,7 +92,7 @@ namespace PolyVox
NormalGenerationMethod m_normalGenerationMethod; NormalGenerationMethod m_normalGenerationMethod;
private: private:
Volume<boost::uint8_t>* volumeData; BlockVolume<boost::uint8_t>* volumeData;
bool m_bHaveGeneratedMeshes; bool m_bHaveGeneratedMeshes;

View File

@ -34,7 +34,7 @@ namespace PolyVox
class VolumeIterator class VolumeIterator
{ {
public: public:
VolumeIterator(Volume<VoxelType>& volume); VolumeIterator(BlockVolume<VoxelType>& volume);
~VolumeIterator(); ~VolumeIterator();
bool operator==(const VolumeIterator& rhs); bool operator==(const VolumeIterator& rhs);
@ -89,7 +89,7 @@ namespace PolyVox
private: private:
//The current volume //The current volume
Volume<VoxelType>& mVolume; BlockVolume<VoxelType>& mVolume;
//The current position in the volume //The current position in the volume
boost::uint16_t mXPosInVolume; boost::uint16_t mXPosInVolume;

View File

@ -21,15 +21,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma region Headers #pragma region Headers
#include "Block.h" #include "Block.h"
#include "BlockVolume.h"
#include "Vector.h" #include "Vector.h"
#include "Volume.h"
#pragma endregion #pragma endregion
namespace PolyVox namespace PolyVox
{ {
#pragma region Constructors/Destructors #pragma region Constructors/Destructors
template <typename VoxelType> template <typename VoxelType>
VolumeIterator<VoxelType>::VolumeIterator(Volume<VoxelType>& volume) VolumeIterator<VoxelType>::VolumeIterator(BlockVolume<VoxelType>& volume)
:mVolume(volume) :mVolume(volume)
{ {
} }

View File

@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "SurfaceVertex.h" #include "SurfaceVertex.h"
#include "Utility.h" #include "Utility.h"
#include "Vector.h" #include "Vector.h"
#include "Volume.h" #include "BlockVolume.h"
#include "VolumeIterator.h" #include "VolumeIterator.h"
using namespace boost; using namespace boost;
@ -53,7 +53,7 @@ namespace PolyVox
{ {
} }
void PolyVoxSceneManager::setVolumeData(Volume<boost::uint8_t>* volumeDataToSet) void PolyVoxSceneManager::setVolumeData(BlockVolume<boost::uint8_t>* volumeDataToSet)
{ {
volumeData = volumeDataToSet; volumeData = volumeDataToSet;
volSurfaceUpToDate = new LinearVolume<bool>(PolyVox::logBase2(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS)); volSurfaceUpToDate = new LinearVolume<bool>(PolyVox::logBase2(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS));
@ -1073,7 +1073,7 @@ namespace PolyVox
m_axisNode->setVisible(visible); m_axisNode->setVisible(visible);
}*/ }*/
const Volume<boost::uint8_t>* PolyVoxSceneManager::getVolumeData(void) const const BlockVolume<boost::uint8_t>* PolyVoxSceneManager::getVolumeData(void) const
{ {
return volumeData; return volumeData;
} }