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

The container class contains an array of voxel. The amount of voxel per tile is voxelLength^3. The class counts how many voxel are max and how many are min. if all voxel are min or max the class simple::container::base doesnt save them. Additionally it saves an axisAlignedBox which describes the bounds of the voxel that changed. More...

#include <container.hpp>

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

Public Types

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

Public Member Functions

virtual ~container ()
 ~container destructor.
 
void startEdit ()
 startEdit resets the changed-voxel-bound-aab
 
void endEdit ()
 endEdit end edit
 
const bool & getEditing () const
 getEditing returns if editing is active. More...
 
const axisAlignedBoxInt32getEditedVoxelBoundingBox () const
 getEditedVoxelBoundingBox returns an axisAlignedBox which describes the bounds of the voxel that changed since the last call of startEdit(). More...
 
void setVoxel (const vector3int32 &pos, const t_data &toSet)
 setVoxel sets an voxel to a local position. Extends changed axisAlignedBox-bounds and counts if voxel is minimum or maximum. More...
 
void setVoxelIfInterpolationHigher (const vector3int32 &pos, const t_data &toSet)
 
void setVoxelIfInterpolationHigherEqualZero (const vector3int32 &pos, const t_data &toSet)
 
void setVoxelIfInterpolationLower (const vector3int32 &pos, const t_data &toSet)
 
void setFull ()
 setFull sets all voxel to max. More...
 
void setEmpty ()
 setFull sets all voxel to max. More...
 
t_data getVoxel (const vector3int32 &pos) const
 getVoxel returns a copy of a local voxel. More...
 
const t_datagetVoxel (const int32 &index) const
 getVoxel returns a copy of a local voxel. More...
 
const t_voxelArraygetVoxelArray (void) const
 getVoxelArray returns reference voxel-array More...
 
const int32 & getCountVoxelLargerZero () const
 getCountVoxelLargerZero returns number of voxel not minimum. More...
 
const int32 & getCountVoxelMaximum () const
 getCountVoxelMaximum returns number of voxel that are maximum. More...
 
const int32 & getCountVoxelMinimum () const
 getCountVoxelMinimum returns number of voxel that are minimum. 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...
 
void operator= (const container &other)
 operator = copy operator More...
 
- Public Member Functions inherited from blub::enableSharedFromThis< container< configType > >
t_thisPtrConst getSharedThisPtr () const
 
t_thisPtr getSharedThisPtr ()
 

Static Public Member Functions

static t_base::pointer create ()
 create creates an instance. More...
 
static int32 calculateIndex (const vector3int32 &pos)
 calculateIndex convertes a 3d voxel-pos to a 1d array-index. 0 <= pos.xyz < voxelLength More...
 

Static Public Attributes

static constexpr int32 voxelLength = t_config::voxelsPerTile
 
static constexpr int32 voxelCount = voxelLength*voxelLength*voxelLength
 

Protected Member Functions

 container ()
 container constructor
 
bool setVoxelIfInterpolationHigher (const int32 &index, const t_data &toSet)
 
bool setVoxelIfInterpolationHigherEqualZero (const int32 &index, const t_data &toSet)
 
bool setVoxelIfInterpolationLower (const int32 &index, const t_data &toSet)
 
bool setVoxel (const int32 &index, const t_data &toSet)
 setVoxel sets voxel to array and counts if voxel is maximum or minimum More...
 
- Protected Member Functions inherited from blub::procedural::voxel::tile::base< container< configType > >
 base ()
 base constrcutor.
 

Detailed Description

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

The container class contains an array of voxel. The amount of voxel per tile is voxelLength^3. The class counts how many voxel are max and how many are min. if all voxel are min or max the class simple::container::base doesnt save them. Additionally it saves an axisAlignedBox which describes the bounds of the voxel that changed.

Examples:
mesh.cpp.

Member Function Documentation

template<class configType >
static int32 blub::procedural::voxel::tile::container< configType >::calculateIndex ( const vector3int32 pos)
inlinestatic

calculateIndex convertes a 3d voxel-pos to a 1d array-index. 0 <= pos.xyz < voxelLength

Parameters
posto convert.
Returns
template<class configType >
static t_base::pointer blub::procedural::voxel::tile::container< configType >::create ( )
inlinestatic

create creates an instance.

Returns
never nullptr.
template<class configType >
const int32& blub::procedural::voxel::tile::container< configType >::getCountVoxelLargerZero ( ) const
inline

getCountVoxelLargerZero returns number of voxel not minimum.

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

getCountVoxelMaximum returns number of voxel that are maximum.

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

getCountVoxelMinimum returns number of voxel that are minimum.

Returns
See also
procedural::voxel::data
template<class configType >
const axisAlignedBoxInt32& blub::procedural::voxel::tile::container< configType >::getEditedVoxelBoundingBox ( ) const
inline

getEditedVoxelBoundingBox returns an axisAlignedBox which describes the bounds of the voxel that changed since the last call of startEdit().

Returns
template<class configType >
const bool& blub::procedural::voxel::tile::container< configType >::getEditing ( ) const
inline

getEditing returns if editing is active.

Returns
template<class configType >
t_data blub::procedural::voxel::tile::container< configType >::getVoxel ( const vector3int32 pos) const
inline

getVoxel returns a copy of a local voxel.

Parameters
poslocal voxel-position.
Returns
template<class configType >
const t_data& blub::procedural::voxel::tile::container< configType >::getVoxel ( const int32 &  index) const
inline

getVoxel returns a copy of a local voxel.

Parameters
indexlocal voxel-position.
Returns
See also
calculateIndex()
template<class configType >
const t_voxelArray& blub::procedural::voxel::tile::container< configType >::getVoxelArray ( void  ) const
inline

getVoxelArray returns reference voxel-array

Returns
template<class configType >
bool blub::procedural::voxel::tile::container< 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::container< 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::container< configType >::operator= ( const container< configType > &  other)
inline

operator = copy operator

Parameters
other
template<class configType >
void blub::procedural::voxel::tile::container< configType >::setEmpty ( )
inline

setFull sets all voxel to max.

See also
procedural::voxel::data::setMin()
template<class configType >
void blub::procedural::voxel::tile::container< configType >::setFull ( )
inline

setFull sets all voxel to max.

See also
procedural::voxel::data::setMax()
template<class configType >
void blub::procedural::voxel::tile::container< configType >::setVoxel ( const vector3int32 pos,
const t_data toSet 
)
inline

setVoxel sets an voxel to a local position. Extends changed axisAlignedBox-bounds and counts if voxel is minimum or maximum.

Parameters
pos
toSet
See also
procedural::voxel::data
template<class configType >
bool blub::procedural::voxel::tile::container< configType >::setVoxel ( const int32 &  index,
const t_data toSet 
)
inlineprotected

setVoxel sets voxel to array and counts if voxel is maximum or minimum

Parameters
index
toSet
Returns
See also
calculateIndex()
procedural::voxel::data

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