VoxelFarm::CHeightmapTerrain Class Reference

A Voxel Layer object that outputs terrain voxels based on a heightmap. More...

#include <Biome.h>

Inheritance diagram for VoxelFarm::CHeightmapTerrain:
VoxelFarm::IVoxelLayer

Classes

struct  ThreadContext
 

Public Member Functions

 CHeightmapTerrain (CMaterialLibrary *materialLibrary, CHeightmap *heightmap, IMask *instanceMask, IMask *waterMask, int downsampling)
 
virtual void getContourData (CellId cell, ContourVoxelData *data, bool &empty, void *threadContext) override
 Returns voxel data for the specified cell (IVoxelLayer) More...
 
virtual void * createThreadContext () override
 The voxel layer can use this method to return a structure that will be unique for each calling thread. This allows to have lock-free work buffers assigned to each worker thread.
 
virtual void disposeThreadContext (void *threadContext) override
 Destroys the specified thread context.
 
int getStatsContourId () override
 Returns the stats ID to be used for measuring performance of the getContourData() method.
 
- Public Member Functions inherited from VoxelFarm::IVoxelLayer
virtual void planJobs (Scene *scene)
 This is called when a new scene is discovered. It can be used to create objects that will be later returned in voxel form.
 
virtual void runJobs ()
 Execute any additional generation task.
 
virtual int getStatsPlanJobsId ()
 Returns the stats ID to be used for measuring performance of the planJobs() method.
 
virtual int getStatsRunJobsId ()
 Returns the stats ID to be used for measuring performance of the runJobs() method.
 
virtual bool isCacheable ()
 Returns true if the layer's output can be cached. Return true if the output for a cell will always be the same.
 

Static Public Member Functions

static double biLinearInterpolate (double p[2][2], double x, double y)
 
static double getDisplacementMapValue (unsigned char *displacementData, int displacementDataSize, double x, double y)
 
static double getDisplacement (unsigned char *displacementData, int displacementDataSize, double pos[3], Algebra::Vector &normal, double freq)
 

Public Attributes

CMaterialLibrarymaterialLibrary
 
CHeightmapheightmap
 
IMaskinstanceMask
 
IMaskwaterMask
 
int downsampling
 
CBiomeunderwaterBiome
 

Static Public Attributes

static const int CornerMap [8][3]
 
static const int EdgeMap [12][2]
 

Protected Member Functions

void getContourDataRegular (CellId cell, ContourVoxelData *data, bool &empty, void *threadContext)
 Returns voxel data for the specified cell (IVoxelLayer) More...
 
void getContourDataAdaptive (CellId cell, ContourVoxelData *data, bool &empty, void *threadContext)
 Returns voxel data for the specified cell (IVoxelLayer) More...
 

Detailed Description

A Voxel Layer object that outputs terrain voxels based on a heightmap.

Definition at line 278 of file Biome.h.

Constructor & Destructor Documentation

VoxelFarm::CHeightmapTerrain::CHeightmapTerrain ( CMaterialLibrary materialLibrary,
CHeightmap heightmap,
IMask instanceMask,
IMask waterMask,
int  downsampling 
)
Parameters
materialLibraryMaterialLibrary object that will be used by the Generator
heightmapHeightmap object that will be used for the generation

Member Function Documentation

virtual void VoxelFarm::CHeightmapTerrain::getContourData ( CellId  cell,
ContourVoxelData data,
bool &  empty,
void *  threadContext 
)
overridevirtual

Returns voxel data for the specified cell (IVoxelLayer)

Parameters
cellID of the cell
dataA buffer where the voxel data will be copied.
emptyA flag notifying the entire cell is empty and could be discarded by the caller

Implements VoxelFarm::IVoxelLayer.

void VoxelFarm::CHeightmapTerrain::getContourDataAdaptive ( CellId  cell,
ContourVoxelData data,
bool &  empty,
void *  threadContext 
)
protected

Returns voxel data for the specified cell (IVoxelLayer)

Parameters
cellID of the cell
dataA buffer where the voxel data will be copied.
emptyA flag notifying the entire cell is empty and could be discarded by the caller
void VoxelFarm::CHeightmapTerrain::getContourDataRegular ( CellId  cell,
ContourVoxelData data,
bool &  empty,
void *  threadContext 
)
protected

Returns voxel data for the specified cell (IVoxelLayer)

Parameters
cellID of the cell
dataA buffer where the voxel data will be copied.
emptyA flag notifying the entire cell is empty and could be discarded by the caller

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