PolyVox  0.2.1
Open source voxel management library
Classes | Public Member Functions | Protected Member Functions
PolyVox::SimpleVolume< VoxelType > Class Template Reference

#include <SimpleVolume.h>

+ Inheritance diagram for PolyVox::SimpleVolume< VoxelType >:
+ Collaboration diagram for PolyVox::SimpleVolume< VoxelType >:

List of all members.

Classes

class  Block
class  Sampler

Public Member Functions

 SimpleVolume (const Region &regValid, uint16_t uBlockSideLength=32)
 Constructor for creating a fixed size volume.
 ~SimpleVolume ()
 Destructor.
VoxelType getBorderValue (void) const
 Gets the value used for voxels which are outside the volume.
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.
- Public Member Functions inherited from PolyVox::BaseVolume< VoxelType >
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.

Protected Member Functions

 SimpleVolume (const SimpleVolume &rhs)
 Copy constructor.
SimpleVolumeoperator= (const SimpleVolume &rhs)
 Assignment operator.
- Protected Member Functions inherited from PolyVox::BaseVolume< VoxelType >
 BaseVolume (const Region &regValid)
 Constructor for creating a fixed size volume.
 BaseVolume (const BaseVolume &rhs)
 Copy constructor.
 ~BaseVolume ()
 Destructor.
BaseVolumeoperator= (const BaseVolume &rhs)
 Assignment operator.

Additional Inherited Members

- Public Types inherited from PolyVox::BaseVolume< VoxelType >
typedef VoxelType VoxelType
- Protected Attributes inherited from PolyVox::BaseVolume< VoxelType >
Region m_regValidRegion
int32_t m_uLongestSideLength
int32_t m_uShortestSideLength
float m_fDiagonalLength

Detailed Description

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

Definition at line 44 of file SimpleVolume.h.


Constructor & Destructor Documentation

template<typename VoxelType >
PolyVox::SimpleVolume< VoxelType >::SimpleVolume ( const Region regValid,
uint16_t  uBlockSideLength = 32 
)

Constructor for creating a fixed size volume.

This constructor creates a volume with a fixed size which is specified as a parameter.

Parameters:
regValidSpecifies the minimum and maximum valid voxel positions.
uBlockSideLengthThe size of the block to use within the volume

Definition at line 32 of file SimpleVolume.inl.

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

Destructor.

Destroys the volume.

Definition at line 56 of file SimpleVolume.inl.

template<typename VoxelType >
PolyVox::SimpleVolume< VoxelType >::SimpleVolume ( const SimpleVolume< VoxelType > &  rhs)
protected

Copy constructor.

This function should never be called.

Copying volumes by value would be expensive, and we want to prevent users from doing it by accident (such as when passing them as paramenters to functions). That said, there are times when you really do want to make a copy of a volume and in this case you should look at the Volumeresampler.

See also:
VolumeResampler

Definition at line 47 of file SimpleVolume.inl.


Member Function Documentation

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

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

Todo:
This function needs reviewing for accuracy...
Returns:
The number of bytes used

Reimplemented from PolyVox::BaseVolume< VoxelType >.

Definition at line 271 of file SimpleVolume.inl.

template<typename VoxelType >
VoxelType PolyVox::SimpleVolume< 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 from PolyVox::BaseVolume< VoxelType >.

Definition at line 81 of file SimpleVolume.inl.

template<typename VoxelType >
VoxelType PolyVox::SimpleVolume< 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:
uXPosThe x position of the voxel
uYPosThe y position of the voxel
uZPosThe z position of the voxel
Returns:
The voxel value

Reimplemented from PolyVox::BaseVolume< VoxelType >.

Definition at line 93 of file SimpleVolume.inl.

Referenced by PolyVox::SimpleVolume< VoxelType >::Block::getVoxelAt(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel0px0py1nz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel0px0py1pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel0px1ny0pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel0px1ny1nz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel0px1ny1pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel0px1py0pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel0px1py1nz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel0px1py1pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx0py0pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx0py1nz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx0py1pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx1ny0pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx1ny1nz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx1ny1pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx1py0pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx1py1nz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1nx1py1pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px0py0pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px0py1nz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px0py1pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px1ny0pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px1ny1nz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px1ny1pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px1py0pz(), PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px1py1nz(), and PolyVox::SimpleVolume< VoxelType >::Sampler::peekVoxel1px1py1pz().

+ Here is the call graph for this function:

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

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

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

Reimplemented from PolyVox::BaseVolume< VoxelType >.

Definition at line 120 of file SimpleVolume.inl.

+ Here is the call graph for this function:

template<typename VoxelType >
SimpleVolume< VoxelType > & PolyVox::SimpleVolume< VoxelType >::operator= ( const SimpleVolume< VoxelType > &  rhs)
protected

Assignment operator.

This function should never be called.

Copying volumes by value would be expensive, and we want to prevent users from doing it by accident (such as when passing them as paramenters to functions). That said, there are times when you really do want to make a copy of a volume and in this case you should look at the Volumeresampler.

See also:
VolumeResampler

Definition at line 70 of file SimpleVolume.inl.

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

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

Parameters:
tBorderThe value to use for voxels outside the volume.

Reimplemented from PolyVox::BaseVolume< VoxelType >.

Definition at line 129 of file SimpleVolume.inl.

template<typename VoxelType >
bool PolyVox::SimpleVolume< 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:
uXPosthe x position of the voxel
uYPosthe y position of the voxel
uZPosthe z position of the voxel
tValuethe value to which the voxel will be set
Returns:
whether the requested position is inside the volume

Reimplemented from PolyVox::BaseVolume< VoxelType >.

Definition at line 144 of file SimpleVolume.inl.

Referenced by PolyVox::SimpleVolume< VoxelType >::Block::setVoxelAt().

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

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

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

Reimplemented from PolyVox::BaseVolume< VoxelType >.

Definition at line 170 of file SimpleVolume.inl.

Referenced by PolyVox::SimpleVolume< VoxelType >::setVoxelAt().

+ Here is the call graph for this function:


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