Classes | Public Member Functions | Protected Attributes

PolyVox::BaseVolume< VoxelType > Class Template Reference

#include <BaseVolume.h>

Inheritance diagram for PolyVox::BaseVolume< VoxelType >:
Collaboration diagram for PolyVox::BaseVolume< VoxelType >:

List of all members.

Classes

class  Sampler

Public Member Functions

 BaseVolume (const Region &regValid)
 Constructor for creating a fixed size volume.
 ~BaseVolume ()
 Destructor.
VoxelType getBorderValue (void) const
 Gets the value used for voxels which are outside the volume.
Region getEnclosingRegion (void) const
 Gets a Region representing the extents of the Volume.
int32_t getWidth (void) const
 Gets the width of the volume in voxels.
int32_t getHeight (void) const
 Gets the height of the volume in voxels.
int32_t getDepth (void) const
 Gets the depth of the volume in voxels.
int32_t getLongestSideLength (void) const
 Gets the length of the longest side in voxels.
int32_t getShortestSideLength (void) const
 Gets the length of the shortest side in voxels.
float getDiagonalLength (void) const
 Gets the length of the diagonal in voxels.
VoxelType getVoxelAt (int32_t uXPos, int32_t uYPos, int32_t uZPos) const
 Gets a voxel at the position given by x,y,z coordinates.
VoxelType getVoxelAt (const Vector3DInt32 &v3dPos) const
 Gets a voxel at the position given by a 3D vector.
void setBorderValue (const VoxelType &tBorder)
 Sets the value used for voxels which are outside the volume.
bool setVoxelAt (int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue)
 Sets the voxel at the position given by x,y,z coordinates.
bool setVoxelAt (const Vector3DInt32 &v3dPos, VoxelType tValue)
 Sets the voxel at the position given by a 3D vector.
uint32_t calculateSizeInBytes (void)
 Calculates approximatly how many bytes of memory the volume is currently using.

Protected Attributes

Region m_regValidRegion
int32_t m_uLongestSideLength
int32_t m_uShortestSideLength
float m_fDiagonalLength

Detailed Description

template<typename VoxelType>
class PolyVox::BaseVolume< VoxelType >

Definition at line 37 of file BaseVolume.h.


Constructor & Destructor Documentation

template<typename VoxelType >
PolyVox::BaseVolume< VoxelType >::BaseVolume ( const Region regValid  ) 

Constructor for creating a fixed size volume.

Definition at line 28 of file BaseVolume.inl.

template<typename VoxelType >
PolyVox::BaseVolume< VoxelType >::~BaseVolume (  ) 

Destructor.

Destroys the volume.

Definition at line 39 of file BaseVolume.inl.


Member Function Documentation

template<typename VoxelType >
uint32_t PolyVox::BaseVolume< VoxelType >::calculateSizeInBytes ( void   ) 

Calculates approximatly how many bytes of memory the volume is currently using.

Note: This function needs reviewing for accuracy...

Reimplemented in PolyVox::LargeVolume< VoxelType >, PolyVox::RawVolume< VoxelType >, PolyVox::SimpleVolume< VoxelType >, and PolyVox::LargeVolume< int32_t >.

Definition at line 191 of file BaseVolume.inl.

Here is the call graph for this function:

template<typename VoxelType >
VoxelType PolyVox::BaseVolume< VoxelType >::getBorderValue ( void   )  const

Gets the value used for voxels which are outside the volume.

The border value is returned whenever an attempt is made to read a voxel which is outside the extents of the volume.

Returns:
The value used for voxels outside of the volume

Reimplemented in PolyVox::LargeVolume< VoxelType >, PolyVox::RawVolume< VoxelType >, PolyVox::SimpleVolume< VoxelType >, and PolyVox::LargeVolume< int32_t >.

Definition at line 49 of file BaseVolume.inl.

template<typename VoxelType >
int32_t PolyVox::BaseVolume< VoxelType >::getDepth ( void   )  const

Gets the depth of the volume in voxels.

Returns:
The depth of the volume in voxels. Note that this value is inclusive, so that if the valid range is e.g. 0 to 63 then the depth is 64.
See also:
getWidth(), getHeight()

Definition at line 89 of file BaseVolume.inl.

Referenced by PolyVox::RawVolume< VoxelType >::calculateSizeInBytes(), PolyVox::BaseVolume< VoxelType >::calculateSizeInBytes(), PolyVox::SimpleVolume< VoxelType >::resize(), PolyVox::RawVolume< VoxelType >::resize(), and PolyVox::LargeVolume< VoxelType >::resize().

Here is the call graph for this function:

template<typename VoxelType >
float PolyVox::BaseVolume< VoxelType >::getDiagonalLength ( void   )  const

Gets the length of the diagonal in voxels.

Returns:
The length of the diagonal in voxels. For example, if a volume has dimensions 256x512x1024 this function will return sqrt(256*256+512*512+1024*1024) = 1173.139. This value is computed on volume creation so retrieving it is fast.
See also:
getShortestSideLength(), getLongestSideLength()

Definition at line 123 of file BaseVolume.inl.

template<typename VoxelType >
Region PolyVox::BaseVolume< VoxelType >::getEnclosingRegion ( void   )  const

Gets a Region representing the extents of the Volume.

Returns:
A Region representing the extent of the volume.

Definition at line 59 of file BaseVolume.inl.

template<typename VoxelType >
int32_t PolyVox::BaseVolume< VoxelType >::getHeight ( void   )  const

Gets the height of the volume in voxels.

Returns:
The height of the volume in voxels. Note that this value is inclusive, so that if the valid range is e.g. 0 to 63 then the height is 64.
See also:
getWidth(), getDepth()

Definition at line 79 of file BaseVolume.inl.

Referenced by PolyVox::RawVolume< VoxelType >::calculateSizeInBytes(), PolyVox::BaseVolume< VoxelType >::calculateSizeInBytes(), PolyVox::RawVolume< VoxelType >::getVoxelAt(), PolyVox::SimpleVolume< VoxelType >::resize(), PolyVox::RawVolume< VoxelType >::resize(), PolyVox::LargeVolume< VoxelType >::resize(), and PolyVox::RawVolume< VoxelType >::setVoxelAt().

Here is the call graph for this function:

template<typename VoxelType >
int32_t PolyVox::BaseVolume< VoxelType >::getLongestSideLength ( void   )  const

Gets the length of the longest side in voxels.

Returns:
The length of the longest side in voxels. For example, if a volume has dimensions 256x512x1024 this function will return 1024.
See also:
getShortestSideLength(), getDiagonalLength()

Definition at line 111 of file BaseVolume.inl.

template<typename VoxelType >
int32_t PolyVox::BaseVolume< VoxelType >::getShortestSideLength ( void   )  const

Gets the length of the shortest side in voxels.

Returns:
The length of the shortest side in voxels. For example, if a volume has dimensions 256x512x1024 this function will return 256.
See also:
getLongestSideLength(), getDiagonalLength()

Definition at line 100 of file BaseVolume.inl.

template<typename VoxelType >
VoxelType PolyVox::BaseVolume< VoxelType >::getVoxelAt ( int32_t  uXPos,
int32_t  uYPos,
int32_t  uZPos 
) const

Gets a voxel at the position given by x,y,z coordinates.

Parameters:
uXPos The x position of the voxel
uYPos The y position of the voxel
uZPos The z position of the voxel
Returns:
The voxel value

Reimplemented in PolyVox::LargeVolume< VoxelType >, PolyVox::RawVolume< VoxelType >, PolyVox::SimpleVolume< VoxelType >, and PolyVox::LargeVolume< int32_t >.

Definition at line 135 of file BaseVolume.inl.

template<typename VoxelType >
VoxelType PolyVox::BaseVolume< VoxelType >::getVoxelAt ( const Vector3DInt32 v3dPos  )  const

Gets a voxel at the position given by a 3D vector.

Parameters:
v3dPos The 3D position of the voxel
Returns:
The voxel value

Reimplemented in PolyVox::LargeVolume< VoxelType >, PolyVox::RawVolume< VoxelType >, PolyVox::SimpleVolume< VoxelType >, and PolyVox::LargeVolume< int32_t >.

Definition at line 146 of file BaseVolume.inl.

template<typename VoxelType >
int32_t PolyVox::BaseVolume< VoxelType >::getWidth ( void   )  const

Gets the width of the volume in voxels.

Returns:
The width of the volume in voxels. Note that this value is inclusive, so that if the valid range is e.g. 0 to 63 then the width is 64.
See also:
getHeight(), getDepth()

Definition at line 69 of file BaseVolume.inl.

Referenced by PolyVox::RawVolume< VoxelType >::calculateSizeInBytes(), PolyVox::BaseVolume< VoxelType >::calculateSizeInBytes(), PolyVox::RawVolume< VoxelType >::getVoxelAt(), PolyVox::SimpleVolume< VoxelType >::resize(), PolyVox::RawVolume< VoxelType >::resize(), PolyVox::LargeVolume< VoxelType >::resize(), and PolyVox::RawVolume< VoxelType >::setVoxelAt().

Here is the call graph for this function:

template<typename VoxelType>
void PolyVox::BaseVolume< VoxelType >::setBorderValue ( const VoxelType &  tBorder  ) 

Sets the value used for voxels which are outside the volume.

Parameters:
tBorder The value to use for voxels outside the volume.

Reimplemented in PolyVox::LargeVolume< VoxelType >, PolyVox::RawVolume< VoxelType >, PolyVox::SimpleVolume< VoxelType >, and PolyVox::LargeVolume< int32_t >.

Definition at line 156 of file BaseVolume.inl.

template<typename VoxelType>
bool PolyVox::BaseVolume< VoxelType >::setVoxelAt ( int32_t  uXPos,
int32_t  uYPos,
int32_t  uZPos,
VoxelType  tValue 
)

Sets the voxel at the position given by x,y,z coordinates.

Parameters:
uXPos the x position of the voxel
uYPos the y position of the voxel
uZPos the z position of the voxel
tValue the value to which the voxel will be set
Returns:
whether the requested position is inside the volume

Reimplemented in PolyVox::LargeVolume< VoxelType >, PolyVox::RawVolume< VoxelType >, PolyVox::SimpleVolume< VoxelType >, and PolyVox::LargeVolume< int32_t >.

Definition at line 169 of file BaseVolume.inl.

template<typename VoxelType>
bool PolyVox::BaseVolume< VoxelType >::setVoxelAt ( const Vector3DInt32 v3dPos,
VoxelType  tValue 
)

Sets the voxel at the position given by a 3D vector.

Parameters:
v3dPos the 3D position of the voxel
tValue the value to which the voxel will be set
Returns:
whether the requested position is inside the volume

Reimplemented in PolyVox::LargeVolume< VoxelType >, PolyVox::RawVolume< VoxelType >, PolyVox::SimpleVolume< VoxelType >, and PolyVox::LargeVolume< int32_t >.

Definition at line 181 of file BaseVolume.inl.


Member Data Documentation

template<typename VoxelType>
float PolyVox::BaseVolume< VoxelType >::m_fDiagonalLength [protected]
template<typename VoxelType>
Region PolyVox::BaseVolume< VoxelType >::m_regValidRegion [protected]
template<typename VoxelType>
int32_t PolyVox::BaseVolume< VoxelType >::m_uLongestSideLength [protected]
template<typename VoxelType>
int32_t PolyVox::BaseVolume< VoxelType >::m_uShortestSideLength [protected]

The documentation for this class was generated from the following files: