voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
blub::procedural::voxel::tile::accessor< configType > Class Template Reference

The accessor class caches all voxel needed by tile::surface for an extremly optimized and fast calculation for the same. This class looks up all voxel needed for the modified marching cubes and if lod is enabled 6*arrays for every side of the cube (transvoxel). See http://www.terathon.com/voxels/ and http://www.terathon.com/lengyel/Lengyel-VoxelTerrain.pdf. More...

#include <accessor.hpp>

Inheritance diagram for blub::procedural::voxel::tile::accessor< configType >:
blub::procedural::voxel::tile::base< accessor< configType > > blub::enableSharedFromThis< accessor< configType > >

Public Types

typedef configType t_config
 
typedef base< accessor
< t_config > > 
t_base
 
typedef t_config::t_data t_voxel
 
typedef vector< t_voxelt_voxelArray
 
typedef vector< t_voxelt_voxelArrayLod
 
- Public Types inherited from blub::procedural::voxel::tile::base< accessor< configType > >
typedef sharedPointer
< accessor< configType > > 
pointer
 
- Public Types inherited from blub::enableSharedFromThis< accessor< configType > >
typedef
std::enable_shared_from_this
< accessor< configType > > 
t_base
 
typedef blub::sharedPointer
< accessor< configType >const > 
t_thisPtrConst
 
typedef blub::sharedPointer
< accessor< configType > > 
t_thisPtr
 

Public Member Functions

virtual ~accessor ()
 ~accessor destructor.
 
bool setVoxel (const vector3int32 &pos, const t_voxel &toSet)
 setVoxel set ancalculateIndex convertes a 3d voxel-pos to a 1d array-index. More...
 
bool setVoxelLod (const vector3int32 &pos, const t_voxel &toSet, const int32 &lod)
 setVoxelLod sets a voxel to a lod array. More...
 
const t_voxelgetVoxel (const vector3int32 &pos) const
 getVoxel return ref to voxel. More...
 
const t_voxelgetVoxelLod (const vector3int32 &pos, const int32 &lod) const
 getVoxelLod returns ref to lod-voxel More...
 
bool isEmpty () const
 isEmpty returns true if all voxel are minimum. More...
 
bool isFull () const
 isFull returns true if all voxel are maximum. More...
 
const bool & getCalculateLod () const
 getCalculateLod returns true if surface later shall calculate level-of-detail More...
 
const int32 & getNumVoxelLargerZero () const
 getNumVoxelLargerZero returns number of voxel not minimum. More...
 
const int32 & getNumVoxelLargerZeroLod () const
 getNumVoxelLargerZeroLod returns number of voxel in lod not minimum. More...
 
const t_voxelArraygetVoxelArray () const
 getVoxelArray return voxel-array More...
 
t_voxelArraygetVoxelArray ()
 getVoxelArray return voxel-array More...
 
t_voxelArrayLodgetVoxelArrayLod () const
 getVoxelArrayLod returns nullptr if no lod shall get calculated else 6-lod-arrays of voxels. More...
 
t_voxelArrayLodgetVoxelArrayLod ()
 getVoxelArrayLod returns nullptr if no lod shall get calculated else 6-lod-arrays of voxels. More...
 
void setCalculateLod (const bool &lod)
 setCalculateLod enables or disables lod calculation and voxel buffering for it. More...
 
void setNumVoxelLargerZero (const int32 &toSet)
 setNumVoxelLargerZero internally used for extern sync. (optimisation) More...
 
void setNumVoxelLargerZeroLod (const int32 &toSet)
 setNumVoxelLargerZero internally used for extern sync. (optimisation) More...
 
- Public Member Functions inherited from blub::enableSharedFromThis< accessor< configType > >
t_thisPtrConst getSharedThisPtr () const
 
t_thisPtr getSharedThisPtr ()
 

Static Public Member Functions

static t_base::pointer create ()
 create creates an instance. More...
 

Static Public Attributes

static constexpr int32 voxelLength = t_config::voxelsPerTile
 
static constexpr int32 voxelLengthWithNormalCorrection = voxelLength+3
 
static constexpr int32 voxelLengthLod = (voxelLength+1)*2
 
static constexpr int32 voxelCount = voxelLengthWithNormalCorrection*voxelLengthWithNormalCorrection*voxelLengthWithNormalCorrection
 
static constexpr int32 voxelCountLod = voxelLengthLod*voxelLengthLod
 
static constexpr int32 voxelCountLodAll = 6*voxelCountLod
 
static constexpr int32 voxelLengthSurface = t_config::voxelsPerTile+1
 
static constexpr int32 voxelCountSurface = voxelLengthSurface*voxelLengthSurface*voxelLengthSurface
 

Protected Member Functions

 accessor ()
 accessor constructor
 
bool setVoxelLod (const vector2int32 &index, const t_voxel &toSet, const int32 &lod)
 
const t_voxelgetVoxelLod (const vector2int32 &index, const int32 &lod) const
 
- Protected Member Functions inherited from blub::procedural::voxel::tile::base< accessor< configType > >
 base ()
 base constrcutor.
 

Static Protected Member Functions

static vector2int32 calculateCoordsLod (const vector3int32 &pos, const int32 &lod)
 calculateCoordsLod converts a 3d lod-coord to a 2d. Transvoxel needs per quader-side (6) only one 2d half-size/detail array. See http://www.terathon.com/voxels/ and http://www.terathon.com/lengyel/Lengyel-VoxelTerrain.pdf More...
 

Detailed Description

template<class configType>
class blub::procedural::voxel::tile::accessor< configType >

The accessor class caches all voxel needed by tile::surface for an extremly optimized and fast calculation for the same. This class looks up all voxel needed for the modified marching cubes and if lod is enabled 6*arrays for every side of the cube (transvoxel). See http://www.terathon.com/voxels/ and http://www.terathon.com/lengyel/Lengyel-VoxelTerrain.pdf.

Member Function Documentation

template<class configType >
static vector2int32 blub::procedural::voxel::tile::accessor< configType >::calculateCoordsLod ( const vector3int32 pos,
const int32 &  lod 
)
inlinestaticprotected

calculateCoordsLod converts a 3d lod-coord to a 2d. Transvoxel needs per quader-side (6) only one 2d half-size/detail array. See http://www.terathon.com/voxels/ and http://www.terathon.com/lengyel/Lengyel-VoxelTerrain.pdf

Parameters
pos
lod
Returns
template<class configType >
static t_base::pointer blub::procedural::voxel::tile::accessor< configType >::create ( )
inlinestatic

create creates an instance.

Returns
Never nullptr.
template<class configType >
const bool& blub::procedural::voxel::tile::accessor< configType >::getCalculateLod ( ) const
inline

getCalculateLod returns true if surface later shall calculate level-of-detail

Returns
template<class configType >
const int32& blub::procedural::voxel::tile::accessor< configType >::getNumVoxelLargerZero ( ) const
inline

getNumVoxelLargerZero returns number of voxel not minimum.

Returns
See also
procedural::voxel::data
template<class configType >
const int32& blub::procedural::voxel::tile::accessor< configType >::getNumVoxelLargerZeroLod ( ) const
inline

getNumVoxelLargerZeroLod returns number of voxel in lod not minimum.

Returns
template<class configType >
const t_voxel& blub::procedural::voxel::tile::accessor< configType >::getVoxel ( const vector3int32 pos) const
inline

getVoxel return ref to voxel.

Parameters
pos-1 <= pos.xyz < voxelLengthWithNormalCorrection-1
Returns
template<class configType >
const t_voxelArray& blub::procedural::voxel::tile::accessor< configType >::getVoxelArray ( ) const
inline

getVoxelArray return voxel-array

Returns
template<class configType >
t_voxelArray& blub::procedural::voxel::tile::accessor< configType >::getVoxelArray ( )
inline

getVoxelArray return voxel-array

Returns
template<class configType >
t_voxelArrayLod* blub::procedural::voxel::tile::accessor< configType >::getVoxelArrayLod ( ) const
inline

getVoxelArrayLod returns nullptr if no lod shall get calculated else 6-lod-arrays of voxels.

Returns
See also
getCalculateLod()
template<class configType >
t_voxelArrayLod* blub::procedural::voxel::tile::accessor< configType >::getVoxelArrayLod ( )
inline

getVoxelArrayLod returns nullptr if no lod shall get calculated else 6-lod-arrays of voxels.

Returns
returns
See also
getCalculateLod()
template<class configType >
const t_voxel& blub::procedural::voxel::tile::accessor< configType >::getVoxelLod ( const vector3int32 pos,
const int32 &  lod 
) const
inline

getVoxelLod returns ref to lod-voxel

Parameters
pos
lodlevel of detail index
Returns
See also
calculateCoordsLod()
template<class configType >
const t_voxel& blub::procedural::voxel::tile::accessor< configType >::getVoxelLod ( const vector2int32 index,
const int32 &  lod 
) const
inlineprotected
See also
getVoxelLod()
template<class configType >
bool blub::procedural::voxel::tile::accessor< configType >::isEmpty ( void  ) const
inline

isEmpty returns true if all voxel are minimum.

Returns
See also
procedural::voxel::data
template<class configType >
bool blub::procedural::voxel::tile::accessor< configType >::isFull ( ) const
inline

isFull returns true if all voxel are maximum.

Returns
See also
procedural::voxel::data
template<class configType >
void blub::procedural::voxel::tile::accessor< configType >::setCalculateLod ( const bool &  lod)
inline

setCalculateLod enables or disables lod calculation and voxel buffering for it.

Parameters
lod
template<class configType >
void blub::procedural::voxel::tile::accessor< configType >::setNumVoxelLargerZero ( const int32 &  toSet)
inline

setNumVoxelLargerZero internally used for extern sync. (optimisation)

Parameters
toSet
template<class configType >
void blub::procedural::voxel::tile::accessor< configType >::setNumVoxelLargerZeroLod ( const int32 &  toSet)
inline

setNumVoxelLargerZero internally used for extern sync. (optimisation)

Parameters
toSet
template<class configType >
bool blub::procedural::voxel::tile::accessor< configType >::setVoxel ( const vector3int32 pos,
const t_voxel toSet 
)
inline

setVoxel set ancalculateIndex convertes a 3d voxel-pos to a 1d array-index.

Parameters
pos-1 <= pos.xyz < voxelLengthWithNormalCorrection-1
toSet
Returns
returns true if anything changed.
template<class configType >
bool blub::procedural::voxel::tile::accessor< configType >::setVoxelLod ( const vector3int32 pos,
const t_voxel toSet,
const int32 &  lod 
)
inline

setVoxelLod sets a voxel to a lod array.

Parameters
pos
toSet
lodlevel of detail index
Returns
returns true if anything changed.
See also
calculateCoordsLod()
template<class configType >
bool blub::procedural::voxel::tile::accessor< configType >::setVoxelLod ( const vector2int32 index,
const t_voxel toSet,
const int32 &  lod 
)
inlineprotected
See also
setVoxelLod()

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