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

The surface class convertes a tile::accessor to an iso-surface. Call this class by one thread at a time. Uses marching cubes and transvoxel for surface-generation. http://www.terathon.com/voxels/ To understand this class and algos please read Eric Lengyel’s Dissertation: http://www.terathon.com/lengyel/Lengyel-VoxelTerrain.pdf . If you got a custom voxel, that effects the resulting surface derive this class and reimplement vertexGotCreated() and vertexGotCreatedLod(). Private methods are undocumentated because they simply implement the code described in Eric Lengyel’s Dissertation. More...

#include <surface.hpp>

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

Public Types

typedef configType t_config
 
typedef base< surface< t_config > > t_base
 
typedef
t_config::t_surface::t_tile * 
t_thiz
 
typedef
t_config::t_accessor::t_tile 
t_voxelAccessor
 
typedef sharedPointer
< t_voxelAccessor > 
t_voxelAccessorPtr
 
typedef vector< typename
t_config::t_vertex
t_vertices
 
typedef vector< typename
t_config::t_index > 
t_indices
 
typedef t_config::t_data t_voxel
 
typedef t_config::t_vertex t_vertex
 
typedef array< t_voxel, 2 *2 *2 > t_calcVoxel
 
typedef array< t_voxel, 3 *3 *3+2 *2 > t_calcVoxelLod
 
- Public Types inherited from blub::procedural::voxel::tile::base< surface< configType > >
typedef sharedPointer< surface
< configType > > 
pointer
 
- Public Types inherited from blub::enableSharedFromThis< surface< configType > >
typedef
std::enable_shared_from_this
< surface< configType > > 
t_base
 
typedef blub::sharedPointer
< surface< configType >const > 
t_thisPtrConst
 
typedef blub::sharedPointer
< surface< configType > > 
t_thisPtr
 

Public Member Functions

 ~surface ()
 ~surface desctructor
 
void calculateSurface (const t_voxelAccessorPtr voxel, const real &voxelSize=1., const bool &calculateNormalCorrection=true, const int32 &lod=0)
 calculateSurface calculates the iso surface. More...
 
void clear ()
 clear erases all buffer/results.
 
bool getCaluculateTransvoxel () const
 does the transvoxel algo get applied. More...
 
bool getCaluculateLod () const
 same as getCaluculateTransvoxel() More...
 
const t_verticesgetVertices () const
 getPositions returns resulting position-list. More...
 
const t_indicesgetIndices () const
 getIndices returns resulting index-list. More...
 
const t_indicesgetIndicesLod (const uint16 &lod) const
 getPositions returns resulting transvoxel-list. Vertices for these indices are in getPositions() and getNormals(). More...
 
- Public Member Functions inherited from blub::enableSharedFromThis< surface< configType > >
t_thisPtrConst getSharedThisPtr () const
 
t_thisPtr getSharedThisPtr ()
 

Static Public Member Functions

static t_base::pointer create ()
 create creates an instance. More...
 
static t_base::pointer createCopy (typename t_base::pointer toCopy)
 createCopy copies an instance. More...
 

Protected Member Functions

 surface ()
 surface constructor
 
t_vertex createVertex (const vector3int32 &, const t_voxel &, const t_voxel &, const vector3 &position, const vector3 &normal)
 Creates a vertex.
 
t_vertex createVertexLod (const vector3int32 &, const t_voxel &, const t_voxel &, const vector3 &position, const vector3 &normal)
 Creates a vertex for lod.
 
- Protected Member Functions inherited from blub::procedural::voxel::tile::base< surface< configType > >
 base ()
 base constrcutor.
 

Protected Attributes

t_voxelAccessorPtr m_voxel
 
int32 m_lod
 
t_vertices m_vertices
 
t_indices m_indices
 
t_indices m_indicesLod [6]
 

Detailed Description

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

The surface class convertes a tile::accessor to an iso-surface. Call this class by one thread at a time. Uses marching cubes and transvoxel for surface-generation. http://www.terathon.com/voxels/ To understand this class and algos please read Eric Lengyel’s Dissertation: http://www.terathon.com/lengyel/Lengyel-VoxelTerrain.pdf . If you got a custom voxel, that effects the resulting surface derive this class and reimplement vertexGotCreated() and vertexGotCreatedLod(). Private methods are undocumentated because they simply implement the code described in Eric Lengyel’s Dissertation.

Examples:
customVertexInformation.cpp.

Member Function Documentation

template<class configType >
void blub::procedural::voxel::tile::surface< configType >::calculateSurface ( const t_voxelAccessorPtr  voxel,
const real &  voxelSize = 1.,
const bool &  calculateNormalCorrection = true,
const int32 &  lod = 0 
)
inline

calculateSurface calculates the iso surface.

Parameters
voxelContains the voxel needed for the surface calculation.
voxelSizevoxel-scale.
calculateNormalCorrectioncheck chapter 3.3 in Eric Lengyel’s Dissertation.
lodLod index starting with 0.
template<class configType >
static t_base::pointer blub::procedural::voxel::tile::surface< configType >::create ( )
inlinestatic

create creates an instance.

Returns
never nullptr.
template<class configType >
static t_base::pointer blub::procedural::voxel::tile::surface< configType >::createCopy ( typename t_base::pointer  toCopy)
inlinestatic

createCopy copies an instance.

Parameters
toCopy
Returns
never nullptr.
template<class configType >
bool blub::procedural::voxel::tile::surface< configType >::getCaluculateLod ( ) const
inline
template<class configType >
bool blub::procedural::voxel::tile::surface< configType >::getCaluculateTransvoxel ( ) const
inline

does the transvoxel algo get applied.

Returns
template<class configType >
const t_indices& blub::procedural::voxel::tile::surface< configType >::getIndices ( ) const
inline

getIndices returns resulting index-list.

Returns
template<class configType >
const t_indices& blub::procedural::voxel::tile::surface< configType >::getIndicesLod ( const uint16 &  lod) const
inline

getPositions returns resulting transvoxel-list. Vertices for these indices are in getPositions() and getNormals().

Returns
template<class configType >
const t_vertices& blub::procedural::voxel::tile::surface< configType >::getVertices ( ) const
inline

getPositions returns resulting position-list.

Returns

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