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

The noise class generates a random terrain using simplex noise http://en.wikipedia.org/wiki/Simplex_noise . Original code http://webstaff.itn.liu.se/~stegu/simplexnoise/SimplexNoise.java. More...

#include <noise.hpp>

Inheritance diagram for blub::procedural::voxel::edit::noise< configType >:
blub::procedural::voxel::edit::base< configType > blub::enableSharedFromThis< base< configType > > blub::noncopyable

Public Types

typedef boost::function< bool(vector3,
real &)> 
t_callbackInterpolation
 
typedef configType t_config
 
typedef base< t_config > t_base
 
typedef sharedPointer< noisepointer
 
typedef t_config::t_data t_voxel
 
- Public Types inherited from blub::procedural::voxel::edit::base< configType >
typedef configType t_config
 
typedef enableSharedFromThis
< base< t_config > > 
t_base
 
typedef sharedPointer< base
< t_config > > 
pointer
 
typedef
t_config::t_container::t_simple 
t_voxelContainerSimple
 
typedef
t_config::t_container::t_tile 
t_voxelContainerTile
 
typedef t_config::t_data t_voxel
 
- Public Types inherited from blub::enableSharedFromThis< base< configType > >
typedef
std::enable_shared_from_this
< base< configType > > 
t_base
 
typedef blub::sharedPointer
< base< configType >const > 
t_thisPtrConst
 
typedef blub::sharedPointer
< base< configType > > 
t_thisPtr
 

Public Member Functions

virtual ~noise ()
 ~noise destructor
 
blub::axisAlignedBox getAxisAlignedBoundingBox (const transform &trans) const override
 getAxisAlignedBoundingBox returns transformed aab of the to generate voxel More...
 
- Public Member Functions inherited from blub::procedural::voxel::edit::base< configType >
virtual ~base ()
 destructor
 
void calculateVoxel (const transform &trans) const
 calculates voxel in the container u have to set by setVoxelContainer() before. If setVoxelContainer() didn't get called before, method will assert. More...
 
virtual void calculateVoxel (t_voxelContainerTile *voxelContainer, const vector3int32 &voxelContainerOffset, const transform &trans) const
 calculates all voxel in getAxisAlignedBoundingBox() and inserts them into voxelContainer. Method gets called once per tile from various threads. Voxel only will get set if the interpolation is higher than the inerpoaltion before calculation. More...
 
void setCut (const bool &cut)
 Enable or disable cut. Don't change the value while active calculation. More...
 
const bool & getCut () const
 Returns if cutting is enabled. More...
 
void setVoxelContainer (t_voxelContainerSimple *toSet)
 Sets the voxelcontainer used by calculateVoxel(). More...
 
t_voxelContainerSimple * getVoxelContainer () const
 
- Public Member Functions inherited from blub::enableSharedFromThis< base< configType > >
t_thisPtrConst getSharedThisPtr () const
 
t_thisPtr getSharedThisPtr ()
 

Static Public Member Functions

static pointer create (const blub::axisAlignedBox &desc, const vector3 &scale, const uint32 &seed=0, const t_callbackInterpolation &callbackInterpolation=[](const vector3 &, real &value){value *=1024;return true;})
 creates an instance of the class and returns it as shared_ptr<> More...
 

Protected Member Functions

int32 permutation (const int32 index) const
 
bool calculateOneVoxel (const vector3 &pos, t_voxel *resultVoxel) const override
 calculateOneVoxel scales pos by scale set in constructor and calculates the noise. More...
 
 noise (const blub::axisAlignedBox &desc, const vector3 &scale, const uint32 &seed, const t_callbackInterpolation &callbackInterpolation)
 noise Contructor - same as create()
 
- Protected Member Functions inherited from blub::procedural::voxel::edit::base< configType >
virtual void createLine (t_voxelContainerTile *voxelContainer, const vector3int32 &posVoxel, const real &from, const real &len, const axis &ax, const blub::plane &planeA, const blub::plane &planeB) const
 createLine creates a voxel-line on one axis with a specific length More...
 

Static Protected Member Functions

static real fade (const real &t)
 
static real lerp (const real &t, const real &a, const real &b)
 
static real grad (const int32 &hash, const real &x, const real &y, const real &z)
 

Protected Attributes

const blub::axisAlignedBox m_aab
 
const vector3 m_scale
 
const t_callbackInterpolation m_callbackInterpolation
 
vector< uint8_t > m_permutation
 
- Protected Attributes inherited from blub::procedural::voxel::edit::base< configType >
t_voxelContainerSimple * m_voxelContainer
 
bool m_cut
 

Additional Inherited Members

- Protected Types inherited from blub::procedural::voxel::edit::base< configType >
enum  axis { x, y, z }
 The axis enum is used by createLine() for describing the direction.
 

Detailed Description

template<class configType>
class blub::procedural::voxel::edit::noise< configType >

The noise class generates a random terrain using simplex noise http://en.wikipedia.org/wiki/Simplex_noise . Original code http://webstaff.itn.liu.se/~stegu/simplexnoise/SimplexNoise.java.

Examples:
noise.cpp.

Member Function Documentation

template<class configType >
bool blub::procedural::voxel::edit::noise< configType >::calculateOneVoxel ( const vector3 pos,
t_voxel resultVoxel 
) const
inlineoverrideprotectedvirtual

calculateOneVoxel scales pos by scale set in constructor and calculates the noise.

Parameters
posabsolute voxel-position
resultVoxelgets set if interpolation larger -127
Returns
Returns true if interpolation larger -127

Reimplemented from blub::procedural::voxel::edit::base< configType >.

template<class configType >
static pointer blub::procedural::voxel::edit::noise< configType >::create ( const blub::axisAlignedBox desc,
const vector3 scale,
const uint32 &  seed = 0,
const t_callbackInterpolation &  callbackInterpolation = [] (const vector3&, real& value) {value*=1024;return true;} 
)
inlinestatic

creates an instance of the class and returns it as shared_ptr<>

Parameters
descDefines the size in which the terrain should get generated.
scaleGets used to scale the voxel-position before calculating the interpolation
seedUsed before calling std::random_shuffle
callbackInterpolationCallback for the generated interpolation.
Returns
An instance of the class as shared_ptr<>
Examples:
noise.cpp.
template<class configType >
blub::axisAlignedBox blub::procedural::voxel::edit::noise< configType >::getAxisAlignedBoundingBox ( const transform trans) const
inlineoverridevirtual

getAxisAlignedBoundingBox returns transformed aab of the to generate voxel

Parameters
transTransform
Returns

Implements blub::procedural::voxel::edit::base< configType >.


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