VoxelFarm Namespace Reference

Contains all classes and functions for the VoxelFarm engine. More...

Namespaces

 Algebra
 3D algebra functions and data types
 
 Architecture
 Contains classes, functions and structs for the architecture system.
 
 GL
 The GL namespace implements rendering over OpenGL.
 

Classes

struct  BillboardCellCache
 An entry in the billboard cache. More...
 
struct  BillboardPackData
 Structure used to cache billboards and material instances. More...
 
class  CBillboardCache
 Keeps an billboard cache entry for each cell that had its billboards and material instances generated. More...
 
struct  CBillboardLODPacking
 Texture coordinate packing for billboard atlases. More...
 
class  CBiome
 Defines a type of biome. Several biomes can coexist in the same world. Each biome has a density mask function that determines which biome will prevail at a given location. A biome also specifies a list of terrain materials and planting rules for instances. More...
 
class  CBitStream
 A class for binary streams. More...
 
class  CBlockData
 A default implementation of IBlockData that also acts as a VoxelLayer. More...
 
class  CBoxMesh
 
class  CBufferBlockData
 An implementation of IBlockData for merging a buffer into another IBlockData. More...
 
class  CCellData
 Stores the information for a Cell that has already been converted to a polygonal mesh. More...
 
class  CClipboardData
 
class  CClipmapView
 Represents a moving view within a world. Computes new scenes as the view moves. More...
 
class  CClipmapVisibility
 
class  CCopyPasteMesh
 Mesh collection for copy & paste. More...
 
class  CCornerTileSet
 A tileset with matching corners and two data channels. More...
 
struct  CFaceLink
 An entry in a linked list of face adjacencies for a vertex. More...
 
class  CFastQuadrics
 An efficient mesh representation that features Quadratic Error function simplification using a Multiple-Choice Algorithm. More...
 
class  CGenerator
 Combines several voxel layers into the final dataset sent to the contouring phase. More...
 
class  CHeightLayer
 One layer of an elevation map (heightmap). A VoxelFarm terrains starts with an elevation map. This map is a sum of the contributions of multiple height layers. Each biome can specify a different height layer. More...
 
class  CHeightmap
 Defines the world elevation at any XZ point. Contains a collection of biomes. More...
 
class  CHeightmapTerrain
 A Voxel Layer object that outputs terrain voxels based on a heightmap. More...
 
class  CHeightmapTerrainPage
 
class  CHeightmapWaterLayer
 
class  CHydroTile
 It generates the water information for an area. More...
 
class  CInstanceHeightMap
 Handles instanced voxel data. More...
 
class  CInstanceManager
 Handles instanced voxel data. More...
 
class  CInstanceSimplexWorld
 Handles instanced voxel data. More...
 
class  ClassData
 Defines a voxel class that can be instanced many times over. More...
 
struct  CMaterial
 A material definition for the VoxelFarm.com engine. More...
 
class  CMaterialLibrary
 Contains all materials available in the system. More...
 
class  COceanLayer
 
class  ContourThreadContext
 Generation of voxel data and then meshes out if it can be time consuming. The engine allows multiple threads to call the contouring functions so the workload can be split among them. Each calling thread must create its own ContourThreadContext object. More...
 
class  CPeriodicTileSet
 Periodic tileset. More...
 
class  CPinkNoise
 
class  CPlantingRule
 
class  CSeamCellData
 
class  CSimplexWorld
 
class  CSimplexWorldTerrainPage
 
class  CSimplexWorldVoxelLayer
 
class  CStaticWaterLayer
 
class  CTileSet
 Implement an aperiodic tiling set. More...
 
class  CUnionFind
 
class  CWhiteNoise
 Implements deterministic 3D white noise for ints. More...
 
struct  DebugLine
 
struct  DebugPoint
 
struct  FQ_Vertex
 Specifies a vertex in a polygonal mesh. More...
 
class  IBlockData
 
class  ICellDataCache
 An interface for caching data. More...
 
class  IClipboard
 Clipboard interface. More...
 
class  IHydroHeightmapPage
 
class  IInputStream
 An interface to abstract reading resource data. More...
 
class  IMacroColorSource
 
class  IMask
 An interface for a 3D mask. A mask can be used to control the application of other features. More...
 
class  IMeshStamMaterialSource
 It translates a given material depending of the position in the world. More...
 
class  IMeshStampSource
 It allows to access to the faces and materials of a list of solids. More...
 
struct  InstanceData
 Information about one instance. More...
 
struct  InstanceDescriptor
 Describes a material instance. More...
 
class  IOceanDataExtents
 This class is used to request the ocean mask for a given area (in world coordinates) More...
 
class  IOceanMap
 
class  IStaticWaterDataExtents
 This class is used to request the static water mask for a given area (in world coordinates) More...
 
class  IStaticWaterMap
 
class  ITileSet
 
class  IVoxelLayer
 An interface for a voxel layer. By implementing this interface, very different modules can contribute their voxel data into the final representation for the world. More...
 
class  MapIndex
 An index of which Cells are empty and which ones contain information. For offline mode only. More...
 
struct  MaterialMesh
 An link between a polygonal mesh and a material. More...
 
struct  OctreeNode
 A node in the contouring octree. This octree is used to compress the polygonal output of the contouring stage. More...
 
class  RTFileStream
 
class  RTree
 
struct  StampSmoothData
 Used for partially voxelization operations. More...
 
struct  StatTracker
 An object to track stats. Contains two different counters. More...
 
struct  TGA
 Describes a TGA file. More...
 
struct  TGAHeader
 Header for TGA files. More...
 
struct  TGATexture
 Image information from TGA file. More...
 
struct  Voxel
 
class  VoxelData
 
struct  VoxelHitInfo
 
struct  VoxelMaskData
 A structure for storing voxel information when we generate a mask from a mesh. More...
 

Typedefs

typedef enum VoxelFarm::InstanceMirror_T InstanceMirror
 Defines a rule for scattering instances.
 
typedef enum VoxelFarm::InstanceRotation_T InstanceRotation
 
typedef VoxelData< BLOCK_DIMENSION, BLOCK_DIMENSION, BLOCK_DIMENSION, unsigned short > BlockVoxelData
 
typedef TVector< BillboardPackDataBillboardCacheList
 An array of billboard information.
 
typedef VoxelData< BLOCK_MARGIN, BLOCK_SIZE, BLOCK_SIZE, unsigned int > XSeamSliceData
 
typedef VoxelData< BLOCK_SIZE, BLOCK_MARGIN, BLOCK_SIZE, unsigned int > YSeamSliceData
 
typedef VoxelData< BLOCK_SIZE, BLOCK_SIZE, BLOCK_MARGIN, unsigned int > ZSeamSliceData
 
typedef XSeamSliceDataXSeamLODSlices[2][2]
 
typedef YSeamSliceDataYSeamLODSlices[2][2]
 
typedef ZSeamSliceDataZSeamLODSlices[2][2]
 
typedef TVector< MaterialMesh * > MaterialMeshArray
 A list of MaterialMesh.
 
typedef enum VoxelFarm::ClipboardRotation_T ClipboardRotation
 
typedef enum VoxelFarm::ClipboardMirror_T ClipboardMirror
 
typedef int FQ_Face[4]
 
typedef unsigned __int64 CellId
 A 64bit integer that identifies a single world octree Cell.
 
typedef TSet< CellIdCells
 A set of cells.
 
typedef Cells Scene
 A Scene is a set of cells.
 
typedef uint32_t ShortVoxel
 A compact 32 bit representation for a voxel.
 
typedef CUnionFind< uint16_t > CUnionFind16
 
typedef CUnionFind< uint32_t > CUnionFind32
 
typedef void OnError(int code, const char *message, const char *data, bool &terminate)
 Prototype for error event.
 
typedef signed char int8_t
 
typedef unsigned char uint8_t
 
typedef signed short int16_t
 
typedef unsigned short uint16_t
 
typedef signed int int32_t
 
typedef unsigned int uint32_t
 
typedef signed __int64 int64_t
 
typedef unsigned __int64 uint64_t
 
typedef float float32_t
 
typedef double float64_t
 
template<typename T >
using TVector = std::vector< T >
 
template<typename T >
using TList = std::list< T >
 
template<typename K , typename V >
using TMap = std::map< K, V >
 
template<typename K >
using TSet = std::set< K >
 
template<typename K >
using TQueue = std::queue< K >
 
template<typename K >
using TDeque = std::deque< K >
 
typedef std::string String
 
typedef unsigned char VoxelType
 
typedef unsigned short MaterialId
 
typedef StatTracker LODStats[LEVELS][STAT_NULL]
 Used to track stats across all LOD.
 
typedef VoxelData< BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, unsigned int > ContourVoxelData
 

Enumerations

enum  InstanceMirror_T { m_N, m_X, m_Y, m_Z }
 Defines a rule for scattering instances. More...
 
enum  InstanceRotation_T {
  n_R, RX_090, RX_180, RX_270,
  RY_090, RY_180, RY_270, RZ_090,
  RZ_180, RZ_270
}
 
enum  ClipboardRotation_T {
  X_090, X_180, X_270, Y_090,
  Y_180, Y_270, Z_090, Z_180,
  Z_270
}
 
enum  ClipboardMirror_T { X, Y, Z }
 
enum  BuildCursorMode { BUILD_CURSOR_ADD, BUILD_CURSOR_SMOOTH, BUILD_CURSOR_STAMP }
 Build cursor mode.
 
enum  StatId {
  STAT_VOXELS, STAT_TRIANGLES, STAT_TRIANGLES_MEDIUM_0, STAT_TRIANGLES_MEDIUM_1,
  STAT_TRIANGLES_MEDIUM_2, STAT_TRIANGLES_MEDIUM_3, STAT_TRIANGLES_BILLBOARDS, STAT_TERRAIN,
  STAT_INSTANCES, STAT_WATER, STAT_SANDBOX, STAT_ARCH,
  STAT_CUSTOM, STAT_CUSTOM_JOB_PLAN, STAT_CUSTOM_JOB_RUN, STAT_CONTOUR,
  STAT_MESH, STAT_GENERATION, STAT_CONTOUR_LOOP, STAT_LSYS_RUN,
  STAT_CONTOUR_LOOP_IDLE, STAT_SCENE_DELTA, STAT_SCENE_DELTA_REQUEST, STAT_SCENE_UPDATE,
  STAT_SCENE_ADD_1, STAT_SCENE_ADD_2, STAT_SCENE_ADD_3, STAT_SCENE_ADD_4,
  STAT_SCENE_ADD_1_FAN, STAT_SCENE_ADD_2_FAN, STAT_SCENE_ADD_3_FAN, STAT_SCENE_ADD_4_FAN,
  STAT_SCENE_REPAIR_1, STAT_SCENE_REPAIR_2, STAT_SCENE_REPAIR_3, STAT_SCENE_REPAIR_4,
  STAT_SCENE_REPAIR_1_FAN, STAT_SCENE_REPAIR_2_FAN, STAT_SCENE_REPAIR_3_FAN, STAT_SCENE_REPAIR_4_FAN,
  STAT_SCENE_REMOVE_1, STAT_SCENE_REMOVE_2, STAT_SCENE_REMOVE_3, STAT_SCENE_REMOVE_4,
  STAT_SCENE_REMOVE_1_FAN, STAT_SCENE_REMOVE_2_FAN, STAT_SCENE_REMOVE_3_FAN, STAT_SCENE_REMOVE_4_FAN,
  STAT_MAT_INSTANCES, STAT_MAT_INSTANCE_TRIANGLES, STAT_SCENE_CLEAR_USER_1, STAT_NULL
}
 Enummerates different stat IDs supported by the system.
 

Functions

template<typename T >
void expandInterpolationKernel (T *dest, T *source, int size)
 
void updateBlockLOD (IBlockData *blocks, CellId cell)
 Computes voxel data for a block using its eight octree children.
 
void getBlockContourData (IBlockData *blockData, CellId cell, ContourVoxelData *data, bool &empty, BlockVoxelData *blockKernel[3][3][3])
 Copies voxel data from a block and its neighbors. More...
 
int getCuboidIntersections (VoxelFarm::Algebra::Vector *result, int sizeX, int sizeY, int sizeZ, int x, int y, int z)
 
int getVoxelListIntersections (VoxelFarm::Algebra::Vector *result, unsigned int *data, int xsize, int ysize, int zsize, int x, int y, int z)
 
void convertOldData (BlockVoxelData *data, double oldMinValue=0.0, double oldMaxValue=1.0)
 
int getContourIntersections (VoxelFarm::Algebra::Vector *result, ContourVoxelData *data, int x, int y, int z)
 
int getVoxelIntersections (VoxelFarm::Algebra::Vector *result, VoxelFarm::IBlockData *blocks, BlockVoxelData *data, CellId cell, int x, int y, int z, bool air=true)
 
int getMaskVoxelIntersections (VoxelFarm::Algebra::Vector *result, VoxelMaskData *data, int xsize, int ysize, int zsize, int x, int y, int z)
 
bool BillboardSort (const BillboardPackData *a, const BillboardPackData *b)
 Sort criteria for billboards.
 
CCellData::CInstanceMeshLODloadInstanceMesh (char *filename)
 Loads all LOD for an instance mesh.
 
bool copyToClipboard (IBlockData *blockData, IClipboard *clipboard, CellId c1, int x1, int y1, int z1, CellId c2, int x2, int y2, int z2)
 Copy voxels from block layer to clipboard. More...
 
bool pasteFromClipboard (IBlockData *blockData, IClipboard *clipboard, CellId c, int x, int y, int z, TSet< CellId > *changedCells)
 Paste voxels from clipboard into block layer. More...
 
bool copyToClipboard (IMeshStampSource *volumen, IBlockData *blockData, IClipboard *clipboard, int vx, int vy, int vz, int sizeX, int sizeY, int sizeZ)
 Copy voxels from block layer to clipboard using a volume as a mask. More...
 
bool pasteFromClipboard (IBlockData *blockData, IClipboard *clipboard, double worldPos[3], bool air, Algebra::Matrix &transform, TSet< CellId > *changedCells)
 Paste voxels from clipboard into block layer. More...
 
MaterialMeshArray getClipboardMesh (IClipboard *clipboard, bool air)
 Generates a polygonal mesh from the clipboard for each material. More...
 
bool rotateClipboard (const IClipboard *src, IClipboard *dst, ClipboardRotation rotation)
 Fill destination clipboard with a rotated version of source clipboard. More...
 
bool mirrorClipboard (const IClipboard *src, IClipboard *dst, ClipboardMirror mirror)
 Fill destination clipboard with a mirror version of source clipboard. More...
 
void ClearBoxArea (IBlockData *blockData, const double kernel[8][3], bool fullErase, TSet< CellId > *changedCells)
 
int getVoxelOccupancyIndex (int x, int y, int z)
 Return the index into the voxel occupancy data for a given x, y, z offset.
 
int contour (int level, ContourVoxelData *data, CMaterialLibrary *materialLibrary, OctreeNode *nodes, CCellData::CVert *points, int *pointIndex, int *quadIndex, int *quadType, bool *edgeSign, MaterialId *materials, int &lastPointId)
 Performs contouring on the voxel data. More...
 
int contour (int level, ContourVoxelData *data, CMaterialLibrary *materialLibrary, CCellData::CVert *points, int *pointIndex, int *quadIndex, int *vertexType, bool *edgeSign, MaterialId *materials, int &lastPointId)
 Performs isocontouring on the voxel data. More...
 
bool contourCellData (ContourThreadContext *tc, CMaterialLibrary *materialLibrary, CCellData *cellData, CBillboardCache *billboardCache, CCellData::ThreadContext *cellDataThreadContext, LODStats stats)
 Contours voxel data and stores the output in a polygonal mesh (CCellData) object. More...
 
bool contourCellDataMCA (ContourThreadContext *tc, CMaterialLibrary *materialLibrary, CCellData *cellData, CBillboardCache *billboardCache, CCellData::ThreadContext *cellDataThreadContext, bool compress, LODStats stats)
 
bool processCellDataMCA (CMaterialLibrary *materialLibrary, CCellData *cellData, CBillboardCache *billboardCache, CCellData::ThreadContext *cellDataThreadContext, LODStats stats)
 
int contourCellDataLayerGroup (ContourThreadContext *tc, CMaterialLibrary *materialLibrary, CCellData *cellData, bool compress, LODStats stats)
 Contours voxel data of each group of layers and stores the output in a polygonal mesh (CCellData) object. More...
 
void getCellChildrenNavigationMeshes (ICellDataCache *cellDataCache, CGenerator *generator, CellId cell, int childLevel, double featureSize, double maxError, bool computeMedium[CCellData::MEDIUM_MAX], CFastQuadrics *meshes[CCellData::MEDIUM_MAX], CMaterialLibrary *materialLibrary)
 Get the simplified mesh for a cell using child cells. More...
 
void removePockets (CFastQuadrics *mesh)
 
long getFileSize (const char *fileName)
 Returns the size in bytes of the specified file.
 
bool fileExists (const char *fileName)
 Returns whether the specified file exists.
 
int getGeneratorIntersections (CMaterialLibrary *materialLibrary, Algebra::Vector *result, CGenerator *generator, CellId cell, int x, int y, int z)
 Returns all triangles that intercept a voxel. More...
 
void computeOceanHeightmap (IOceanDataExtents *source, int margin, bool *oceanMask, unsigned short *heights)
 
void computeOceanMask (IOceanDataExtents *source, double *heights, bool *mask)
 
void computeStaticWater (IStaticWaterDataExtents *source, bool *oceanMask, IHydroHeightmapPage *heightmap, double *heights, bool *lakeMask)
 
bool intersectPointPlane (const double orig[3], const double dir[3], const double vert0[3], const double vert1[3], const double vert2[3], double *x, double *y, double *z)
 
int planeBoxOverlap (const double normal[3], double d, const double maxbox[3])
 
int intersectTriangleAABB (const double boxcenter[3], const double boxhalfsize[3], const double triverts[3][3])
 
int intersectTriangle (const double orig[3], const double dir[3], const double vert0[3], const double vert1[3], const double vert2[3], double *t, double *u, double *v)
 
int intersectPointTriangle (const double orig[3], const double dir[3], const double vert0[3], const double vert1[3], const double vert2[3], double *x, double *y, double *z, double *t, double *u, double *v)
 
CellId packCellId (int level, int x, int y, int z)
 Compose a CellId from the location of a Cell in the octree.
 
void unpackCellId (CellId id, int &level, int &x, int &y, int &z)
 Obtain location of a Cell in the octree from its CellId identifier.
 
bool CellSort (const CellId &a, const CellId &b)
 A sorting criteria for cells in a scene so closer cells appear first.
 
void getChildCells (CellId cell, CellId childCells[2][2][2])
 Given a cell's ID computes its eight children.
 
void initPerlin (void)
 
double noise1 (double)
 
double noise2 (double *)
 
double noise3 (double *)
 
void normalize3 (double *)
 
void normalize2 (double *)
 
double PerlinNoise1D (double, double, double, int)
 
double PerlinNoise2D (double, double, double, double, int)
 
double PerlinNoise3D (double, double, double, double, double, int)
 
ScenecreateScene (MapIndex *index, int levels, int xo, int yo, int zo, int resolution, int radiusLOD0)
 Creates a Scene based on a center octree coordinate.
 
void stampMesh (IBlockData *blockData, IMeshStampSource *mesh, IMeshStamMaterialSource *materials, const double worldPos[3], const Algebra::Matrix &transform, TSet< CellId > *changedCells)
 It voxelizes a mesh and stamps it into a block layer. More...
 
void stampMeshQEF (IBlockData *blockData, IMeshStampSource *mesh, IMeshStamMaterialSource *materials, const double worldPos[3], const Algebra::Matrix &transform, TSet< CellId > *changedCells, Physics::CNoiseBrush *noise=NULL, Physics::CVoxelBuffer *nVoxBuffer=NULL, const TMap< CellId, unsigned char * > *voxelCache=NULL, const int hitMaterial=0)
 It voxelizes a mesh and stamps it into a block layer and minimizes the error with the existing data. More...
 
void stampVoxels (IBlockData *blockData, ShortVoxel *source, int xsize, int ysize, int zsize, IMeshStamMaterialSource *materials, const double worldPos[3], TSet< CellId > *changedCells)
 It stamps a block of voxels into a block layer. More...
 
void stampVoxelsQEF (IBlockData *blockData, ShortVoxel *source, int xsize, int ysize, int zsize, IMeshStamMaterialSource *materials, const double worldPos[3], TSet< CellId > *changedCells)
 It stamps a block of voxels into a block layer and minimizes the error with the existing data. More...
 
void voxelizeMesh (ShortVoxel *voxelData, IMeshStampSource *mesh, int lod, const float meshOrigin[3], const float meshRotation[3], int xsize, int ysize, int zsize, Algebra::Vector &voxelMin, Algebra::Vector &voxelMax)
 It voxelizes a mesh and returns a block of voxels. More...
 
void deleteMeshVoxels (CBlockData *blockData, IMeshStampSource *mesh, const double worldPos[3], const int deletionLOD, CMaterialLibrary *materialLibrary, Physics::CMassInfo *mass, std::set< CellId > *changedCells)
 It deletes voxels associated with physics meshes. More...
 
void voxelizeTriangles (ShortVoxel *voxelData, VoxelFarm::Algebra::Vector *vertexes, int vertexCount, double kernelX, double kernelY, double kernelZ, int kernelMargin, int kernelSizeX, int kernelSizeY, int kernelSizeZ, double &minDistance, double &maxDistance, bool &lostData)
 It voxelizes a list of triangles. More...
 
void voxelizeSmoothMesh (StampSmoothData *voxelData, CFastQuadrics *mesh, double kernelX, double kernelY, double kernelZ, int kernelSizeX, int kernelSizeY, int kernelSizeZ)
 Voxelizes partially a mesh based on precomputed data. More...
 
void voxelMeshMask (VoxelMaskData *voxelMask, IMeshStampSource *mesh, int xsize, int ysize, int zsize)
 Returns a mask of voxels from a mesh. More...
 
void voxelRLECompress (ShortVoxel *data, int sizeX, int sizeY, int sizeZ, ShortVoxel *compIndex, unsigned char *compData, int &compSize)
 
bool LoadUncompressedTGA (TGATexture *texture, const char *filename, FILE *fTGA)
 Load uncompressed TGA file.
 
bool LoadCompressedTGA (TGATexture *texture, const char *filename, FILE *fTGA)
 Load compressed TGA file.
 
bool LoadTGA (TGATexture *texture, const char *filename)
 Load TGA file.
 
bool compressCell (BlockVoxelData *data, unsigned char *output, long &outputSize)
 Compresses voxel data. More...
 
bool decompressCell (BlockVoxelData *data, unsigned char *compressed, long compressedSize)
 Uncompresses voxel data. More...
 
bool compressCell (ContourVoxelData *data, unsigned char *output, long &outputSize)
 Compresses voxel data. More...
 
bool decompressCell (ContourVoxelData *data, unsigned char *compressed, long compressedSize)
 Uncompresses voxel data. More...
 
int compressBytes (unsigned char *compressedData, long &compressedSize, unsigned char *data, long size)
 
void notifyError (int code, const char *message, const char *data, bool terminate)
 Notifies there was an error.
 
unsigned char encodeVectorCoord (double coord)
 It encodes a double coord in an unsigned char one.
 
double decodeVectorCoord (unsigned char coord)
 It decodes an unsigned char coord in a double one.
 
template<int xDim, int yDim, int zDim, typename IdxType >
IdxType getCellBlockIndex (int x, int y, int z)
 Return the index into the cell blocks for a given x, y, z offset.
 
void adjustCellCoordinates (CellId &cell, int &x, int &y, int &z)
 Checks the provided coordinates to make sure the fall within the cell's range. If they are outside range, the cell ID is modified and the coordinates are adjusted relative to the new cell.
 
void smoothKernel (VoxelFarm::CellId targetCell, int targetCellX, int targetCellY, int targetCellZ, int kernelMargin, int kernelSizeX, int kernelSizeY, int kernelSizeZ, int iterations, float blendWeight, IBlockData &blockData, VoxelFarm::CGenerator &generator, TSet< CellId > *changedCells, MaterialId *kernelMaterials, double *kernelPoints, double *kernelPointsNext, int *kernelVertexLinks, int *kernelVertexLinkCount, float *kernelWeight, CMaterialLibrary *materialLibrary)
 
void addSmoothBlock (IBlockData &blockData, CellId c1, int x1, int y1, int z1, int dx, int dy, int dz, int kernelMargin, int iterations, float blendWeight, VoxelFarm::CGenerator &generator, TSet< CellId > *changedCells, MaterialId material)
 
void raiseKernel (VoxelFarm::CellId targetCell, int targetCellX, int targetCellY, int targetCellZ, int kernelMargin, int kernelSizeX, int kernelSizeY, int kernelSizeZ, int iterations, float blendWeight, IBlockData &blockData, VoxelFarm::CGenerator &generator, TSet< CellId > *changedCells, MaterialId *kernelMaterials, double *kernelPoints, double *kernelPointsNext, int *kernelVertexLinks, int *kernelVertexLinkCount, float *kernelWeight, CMaterialLibrary *materialLibrary)
 
void Worley (double at[3], long max_order, double F[2], double delta[2][3], unsigned long ID[2])
 Cellular noise. More...
 

Variables

const double HEIGHT_INFINITE = 1e+20
 Maximum possible height.
 
const double CAVE_MAX_HEIGHT = 500.0
 Maximum ceiling height for a cave.
 
const double CAVE_TOP_MIN_HEIGHT = 150.0
 Minimum depth of ground layer on top of a cave.
 
const int BILLBOARD_MAX_LEVEL_TYPE0 = 4
 Maximum LOD to include type 0 billboards (grass)
 
const int BILLBOARD_MAX_LEVEL_TYPE1 = 10
 Maximum LOD to include type 1 billboards (foliage)
 
const int BILLBOARD_MAX = 50000
 Maximum billboard and material instances in one cell.
 
const int MAX_VERTICES = 100000
 Maximum vertices in one cell.
 
const int BILLBOARD_CACHE_LEVELS = LOD_0 + 2
 Maximum LOD that will have its billboards and material instances cached.
 
const int BILLBOARD_OCCUPANCY_GRID_0 = 30
 Billboard cache density for type 0 billboards (grass and ground instances)
 
const int BILLBOARD_OCCUPANCY_GRID_1 = 4
 Billboard cache density for type 1 billboards (foliage)
 
TMap< int, CCellData::CInstanceMeshLOD * > instanceMeshes
 A map containing all the material instance meshes.
 
TMap< String, int > instanceSliceMap
 A map that links the string form ID for texture map in material instance meshes to the numeric ID that will can used in texture arrays.
 
const int VOXEL_OCCUPANCY_BLOCK = BLOCK_SIZE/2
 Dimensions for additional set to store voxel occupancy within a cell.
 
const int VOXEL_OCCUPANCY_BLOCK_DATASIZE = VOXEL_OCCUPANCY_BLOCK*VOXEL_OCCUPANCY_BLOCK*VOXEL_OCCUPANCY_BLOCK
 Number of voxels to store voxel occupancy within a cell.
 
const int VoxelCorners [8][3]
 
const int CONTOUR_OCTREE_LEVELS = 7
 How many times the contouring octree can subdivide.
 
const int CONTOUR_OCTREE_SIZE = 64
 Number of voxels along one dimension in the contouring octree.
 
const int MAX_INSTANCE_LOD = LEVELS
 Maximum cell level for which instances will be generated.
 
const int MASTER_GENERATION_LEVEL = 10
 Level at which the instance index will be kept.
 
const int GENERATION_GRID_SIZE = 128
 Resolution of an instance index page.
 
const int CELL_BITS_X = 24
 Bits to encode octree X coordinate in Cell Id.
 
const int CELL_BITS_Y = 12
 Bits to encode octree Y coordinate in Cell Id.
 
const int CELL_BITS_Z = 24
 Bits to encode octree Z coordinate in Cell Id.
 
const int ERROR_MATERIAL_FILE_NOT_FOUND = 301
 A file needed for a material was not found.
 
GLubyte uTGAcompare [12]
 TGA header bytes.
 
GLubyte cTGAcompare [12]
 TGA header bytes.
 
const int ERROR_UNKNOWN = 1
 
const int ERROR_INVALID_SIZE = 2
 
const int ERROR_FILENOTFOUND = 3
 
OnErroronError
 Error event handler.
 
std::ofstream logstream
 
const double VECTOR_MIN_VALUE = -1.0
 How much the vector can overfloat the voxel.
 
const double VECTOR_MAX_VALUE = 2.0
 
const double VECTOR_MAX_CODE = 255.0 / (VECTOR_MAX_VALUE - VECTOR_MIN_VALUE)
 
const double VECTOR_DEFAULT_VALUE = ((int)(floor((VECTOR_MAX_CODE*(0.5-VECTOR_MIN_VALUE)) + 0.5))) / VECTOR_MAX_CODE + VECTOR_MIN_VALUE
 
const int BLOCK_DIMENSION = 40
 Number of voxels along one Cell Dim.
 
const int BLOCK_MARGIN = 2
 Number of voxels a Cell will overlap to its neighbors.
 
const int BLOCK_DATA_SIZE = BLOCK_DIMENSION*BLOCK_DIMENSION*BLOCK_DIMENSION
 Number of voxels in a Cell.
 
const int BLOCK_SIZE = (BLOCK_DIMENSION + 2*BLOCK_MARGIN)
 Actual number of voxels in one Cell Dim once the margin is considered.
 
const int BLOCK_CUBE_SIZE = BLOCK_SIZE*BLOCK_SIZE*BLOCK_SIZE
 Actual number of voxels in a Cell once margins are considered.
 
const int MAX_BLOCK_LOD = LEVELS - 2
 Maximum level to retain block data.
 
const VoxelType VOXEL_HAS_MATERIAL = 0x01
 
const VoxelType VOXEL_HAS_VECTOR = 0x02
 
const VoxelType VOXEL_HAS_ROTATION = 0x04
 
const int VOXEL_BITS_MATERIAL = 16
 
const int VOXEL_NIL = ~(-1 << VOXEL_BITS_MATERIAL)
 A special material ID that specified no information is defined for the voxel.
 
const int VOXEL_ONLY_COORDS = VOXEL_NIL - 1
 A special material ID that specified material information is undefined, only voxel coordinates should be considered.
 
const int VOXEL_EMPTY = 0
 
TVector< DebugPointdebugPoints
 
TVector< DebugLinedebugLines
 
ExternalMutex::Mutex debugLock
 
const int SMOOTH_KERNEL_LINK_MAX = 16
 
const int RAISE_KERNEL_LINK_MAX = 48
 

Detailed Description

Contains all classes and functions for the VoxelFarm engine.

Root namespace for the VoxelFarm engine.

Typedef Documentation

typedef int VoxelFarm::FQ_Face[4]

A face in the mesh. The first three componens are the vertex indices. The fourth component is the material type.

Definition at line 32 of file FastQuadrics.h.

Enumeration Type Documentation

Enumerator

Mirror on YZ/ZY plane...

Mirror on XZ/ZX plane...

Definition at line 144 of file Clipboard.h.

Enumerator
X_090 

Rotations around X axis.

Y_090 

Rotations around Y axis.

Z_090 

Rotations around Z axis.

Definition at line 118 of file Clipboard.h.

Defines a rule for scattering instances.

Enumerator
m_X 

no Mirror

m_Y 

Mirror on YZ/ZY plane...

m_Z 

Mirror on XZ/ZX plane...

Definition at line 67 of file Biome.h.

Enumerator
RX_090 

Rotations around X axis.

RY_090 

Rotations around Y axis.

RZ_090 

Rotations around Z axis.

Definition at line 75 of file Biome.h.

Function Documentation

bool VoxelFarm::compressCell ( BlockVoxelData data,
unsigned char *  output,
long &  outputSize 
)

Compresses voxel data.

Parameters
dataPointer to the data to be compressed
outputArray of bytes containing the compressed data
outputSizeNumber of bytes in the compressed output
bool VoxelFarm::compressCell ( ContourVoxelData data,
unsigned char *  output,
long &  outputSize 
)

Compresses voxel data.

Parameters
dataPointer to the data to be compressed
outputArray of bytes containing the compressed data
outputSizeNumber of bytes in the compressed output
void VoxelFarm::computeOceanHeightmap ( IOceanDataExtents source,
int  margin,
bool *  oceanMask,
unsigned short *  heights 
)

Returns a 2D array of unsigned shorts. The dimensions of this array are the ones returned by IOceanDataExtents The array contains the height values for ocean water, where 0xFFFF means sealevel The margin parameter controls the falloff

void VoxelFarm::computeOceanMask ( IOceanDataExtents source,
double *  heights,
bool *  mask 
)

Returns a 2D array of booleans. The dimensions of this array are the ones returned by IOceanDataExtents The array contains whether a coordinate is in the ocean

void VoxelFarm::computeStaticWater ( IStaticWaterDataExtents source,
bool *  oceanMask,
IHydroHeightmapPage heightmap,
double *  heights,
bool *  lakeMask 
)

Returns two 2D arrays. The dimensions of these arrays are the ones returned by IStaticWaterDataExtents One array contains the height values for static water and the other one contains whether a coordinate is in a lake

int VoxelFarm::contour ( int  level,
ContourVoxelData data,
CMaterialLibrary materialLibrary,
OctreeNode nodes,
CCellData::CVert points,
int *  pointIndex,
int *  quadIndex,
int *  quadType,
bool *  edgeSign,
MaterialId *  materials,
int &  lastPointId 
)

Performs contouring on the voxel data.

Parameters
levelWorld octree level for the cell being contured
dataA buffer containing the voxel data
materialLibraryThe material library that will be used for material properties like simplification errors
nodesA buffer to store temporary octree nodes
pointsA buffer for the resulting isosurface points
pointIndexA buffer to store temporary point information
quadIndexAn array containing the quads extracted. Each quad is defined as four integer indices to the points in the quad
quadTypeAn array containing the types for the quads extracted.
edgeSignAn array of booleans indicating whether the corresponding quad must be flipped
materialsAn array containing the materials for the quads extracted.
lastPointIdReturns the number of points that were extracted.
int VoxelFarm::contour ( int  level,
ContourVoxelData data,
CMaterialLibrary materialLibrary,
CCellData::CVert points,
int *  pointIndex,
int *  quadIndex,
int *  vertexType,
bool *  edgeSign,
MaterialId *  materials,
int &  lastPointId 
)

Performs isocontouring on the voxel data.

Parameters
levelWorld octree level for the cell being contured
dataA buffer containing the voxel data
materialLibraryThe material library that will be used for material properties like simplification errors
pointsA buffer for the resulting isosurface points
pointIndexA buffer to store temporary point information
quadIndexAn array containing the quads extracted. Each quad is defined as four integer indices to the points in the quad
vertexTypeAn array containing the types for the extracted vertices.
edgeSignAn array of booleans indicating whether the corresponding quad must be flipped
materialsAn array containing the materials for the quads extracted.
lastPointIdReturns the number of points that were extracted.
bool VoxelFarm::contourCellData ( ContourThreadContext tc,
CMaterialLibrary materialLibrary,
CCellData cellData,
CBillboardCache billboardCache,
CCellData::ThreadContext cellDataThreadContext,
LODStats  stats 
)

Contours voxel data and stores the output in a polygonal mesh (CCellData) object.

Parameters
tcA ContourThreadContext instance containing the work buffers for the contouring operation
materialLibraryMaterial library to be used in contouring
cellDataThe CCellData object that will receive the polygonal output
billboardCacheA billboard cache so billboards and material instances can be shared by overlapping LOD meshes
statsObject for collecting stats
int VoxelFarm::contourCellDataLayerGroup ( ContourThreadContext tc,
CMaterialLibrary materialLibrary,
CCellData cellData,
bool  compress,
LODStats  stats 
)

Contours voxel data of each group of layers and stores the output in a polygonal mesh (CCellData) object.

Parameters
tcA ContourThreadContext instance containing the work buffers for the contouring operation
materialLibraryMaterial library to be used in contouring
cellDataThe CCellData object that will receive the polygonal output
compressIt signals whether simplificate the meshes
statsObject for collecting stats
bool VoxelFarm::contourCellDataMCA ( ContourThreadContext tc,
CMaterialLibrary materialLibrary,
CCellData cellData,
CBillboardCache billboardCache,
CCellData::ThreadContext cellDataThreadContext,
bool  compress,
LODStats  stats 
)
Parameters
tcA ContourThreadContext instance containing the work buffers for the contouring operation
materialLibraryMaterial library to be used in contouring
cellDataThe CCellData object that will receive the polygonal output
billboardCacheA billboard cache so billboards and material instances can be shared by overlapping LOD meshes
cellDataThreadContextA ContourThreadContext instance containing the work buffers for the contouring operation
compressIt signals whether simplificate the meshes
statsObject for collecting stats
bool VoxelFarm::copyToClipboard ( IBlockData blockData,
IClipboard clipboard,
CellId  c1,
int  x1,
int  y1,
int  z1,
CellId  c2,
int  x2,
int  y2,
int  z2 
)

Copy voxels from block layer to clipboard.

Parameters
blockDataData interface to block layer
clipboardClipboard
c1Start coordinate for copy area
c2End coordinate for copy area
bool VoxelFarm::copyToClipboard ( IMeshStampSource volumen,
IBlockData blockData,
IClipboard clipboard,
int  vx,
int  vy,
int  vz,
int  sizeX,
int  sizeY,
int  sizeZ 
)

Copy voxels from block layer to clipboard using a volume as a mask.

Parameters
volumenA mask for copy. It only copies what is inside of the volume
blockDataA block layer
clipboardClipboard interface
vxStart coordinate for copy area
sizeXSize in each direction for copy area
bool VoxelFarm::decompressCell ( BlockVoxelData data,
unsigned char *  compressed,
long  compressedSize 
)

Uncompresses voxel data.

Parameters
dataPointer to where data will be uncompressed
compressedArray of compressed bytes
compressedSizeLength of the compressed byte array
bool VoxelFarm::decompressCell ( ContourVoxelData data,
unsigned char *  compressed,
long  compressedSize 
)

Uncompresses voxel data.

Parameters
dataPointer to where data will be uncompressed
compressedArray of compressed bytes
compressedSizeLength of the compressed byte array
void VoxelFarm::deleteMeshVoxels ( CBlockData blockData,
IMeshStampSource mesh,
const double  worldPos[3],
const int  deletionLOD,
CMaterialLibrary materialLibrary,
Physics::CMassInfo mass,
std::set< CellId > *  changedCells 
)

It deletes voxels associated with physics meshes.

Parameters
blockDataA reference to the block layer
meshThe mesh source
worldPosPosition in world units
deletionLODLOD at which to delete
materialLibraryUsed to determine material class
massstores voxel mass information for the deleted regions
changedCellsReturns a list of all affected cells during the process
void VoxelFarm::getBlockContourData ( IBlockData blockData,
CellId  cell,
ContourVoxelData data,
bool &  empty,
BlockVoxelData blockKernel[3][3][3] 
)

Copies voxel data from a block and its neighbors.

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
blockKernelA 3x3x3 matrix containing Voxel arrays for the block being computed and its neighbors. The Voxel data for the computed block is located at [1][1][1]. The neighbors are placed in the matrix based on their relative main axis coordinates.
void VoxelFarm::getCellChildrenNavigationMeshes ( ICellDataCache cellDataCache,
CGenerator generator,
CellId  cell,
int  childLevel,
double  featureSize,
double  maxError,
bool  computeMedium[CCellData::MEDIUM_MAX],
CFastQuadrics meshes[CCellData::MEDIUM_MAX],
CMaterialLibrary materialLibrary 
)

Get the simplified mesh for a cell using child cells.

Parameters
cellDataCacheCache interface
generatorThis object is able to generate voxel data from a number of abstract layers (IVoxelLayer).
cellCell identifier
featureSizeIt is the cluster size in the cluster simplificacion
maxErrorIt is the allowed error in the simplification
computeMediumRequest to the wanted mediums
meshesWanted mesh by medium
materialLibraryMaterialLibrary object that will be used by the contour to find the material medium
MaterialMeshArray VoxelFarm::getClipboardMesh ( IClipboard clipboard,
bool  air 
)

Generates a polygonal mesh from the clipboard for each material.

Parameters
clipboardClipboard
airIt decides whether to copy the erased data (material=0)
int VoxelFarm::getGeneratorIntersections ( CMaterialLibrary materialLibrary,
Algebra::Vector result,
CGenerator generator,
CellId  cell,
int  x,
int  y,
int  z 
)

Returns all triangles that intercept a voxel.

Parameters
materialLibraryPoints to the material library to be used by the view
resultList of neighbor vertices forming a quad with the voxel's vertex. Each 3 entries there is a quad
generatorVoxel data source
cellCoordinates of the voxel in the form cell, x, y, z
bool VoxelFarm::mirrorClipboard ( const IClipboard src,
IClipboard dst,
ClipboardMirror  mirror 
)

Fill destination clipboard with a mirror version of source clipboard.

Parameters
srcSource clipboard...
dstDestination clipboard...
mirrorMirror...
bool VoxelFarm::pasteFromClipboard ( IBlockData blockData,
IClipboard clipboard,
CellId  c,
int  x,
int  y,
int  z,
TSet< CellId > *  changedCells 
)

Paste voxels from clipboard into block layer.

Parameters
blockDataData interface to block layer
clipboardClipboard
cCoordinate for paste location
changedCellsA set to collect which cells were changed. Pass NULL if not interested in this info
bool VoxelFarm::pasteFromClipboard ( IBlockData blockData,
IClipboard clipboard,
double  worldPos[3],
bool  air,
Algebra::Matrix transform,
TSet< CellId > *  changedCells 
)

Paste voxels from clipboard into block layer.

Parameters
blockDataData interface to block layer
clipboardClipboard
worldPosCoordinate for paste location
airIt decides if copy or not the data for removing (material=0)
transformA transform matrix to be applied to the clipmap data
changedCellsA set to collect which cells were changed. Pass NULL if not interested in this info
bool VoxelFarm::processCellDataMCA ( CMaterialLibrary materialLibrary,
CCellData cellData,
CBillboardCache billboardCache,
CCellData::ThreadContext cellDataThreadContext,
LODStats  stats 
)
Parameters
materialLibraryMaterial library to be used in contouring
cellDataThe CCellData object that will receive the polygonal output
billboardCacheA billboard cache so billboards and material instances can be shared by overlapping LOD meshes
cellDataThreadContextA ContourThreadContext instance containing the work buffers for the contouring operation
statsObject for collecting stats
void VoxelFarm::raiseKernel ( VoxelFarm::CellId  targetCell,
int  targetCellX,
int  targetCellY,
int  targetCellZ,
int  kernelMargin,
int  kernelSizeX,
int  kernelSizeY,
int  kernelSizeZ,
int  iterations,
float  blendWeight,
IBlockData blockData,
VoxelFarm::CGenerator generator,
TSet< CellId > *  changedCells,
MaterialId *  kernelMaterials,
double *  kernelPoints,
double *  kernelPointsNext,
int *  kernelVertexLinks,
int *  kernelVertexLinkCount,
float *  kernelWeight,
CMaterialLibrary materialLibrary 
)

Relaxes the inner coordinate points for voxels within a specified kernel. Voxels are read from a CGenerator object and stored into a CBlockData instance.

Parameters
targetCellSpecifies the target cell for the operation. Depending on the kernel's size the operation may bleed to neighboring cells
targetCellXSpecifies the target location along the X axis, in voxels relative to the origin of the cell
targetCellYSpecifies the target location along the Y axis, in voxels relative to the origin of the cell
targetCellZSpecifies the target location along the Z axis, in voxels relative to the origin of the cell
kernelMarginDefines the transition size of the kernel's area of influence. Voxels in the kernel boundaries are not affected by the operation to avoid discontinuities.
kernelSizeXKernel dimensions along the X axis
kernelSizeYKernel dimensions along the Y axis
kernelSizeZKernel dimensions along the Z axis
iterationsNumber of raising iterations to be performed
blendWeightControls the raise increment of each voxel. Higher values produce higher changes.
blockDataA CBlockData instance where the results of the operation will be stored
generatorA CGenerator instance that provides the contents of the voxels to be smoothen
changedCellsAn optional set to return which cells were changed by the operation.
kernelMaterialsUsed to buffer voxel materials. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ elements.
kernelPointsUsed to buffer voxel coordinates. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ*3 elements.
kernelPointsNextUsed to buffer voxel coordinates for the next iteration. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ*3 elements.
kernelVertexLinksUsed to buffer surface connections. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ*SMOOTH_KERNEL_LINK_MAX elements.
kernelVertexLinkCountUsed to buffer surface connection counts. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ elements.
kernelWeightUsed to buffer kernel weights. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ elements.
bool VoxelFarm::rotateClipboard ( const IClipboard src,
IClipboard dst,
ClipboardRotation  rotation 
)

Fill destination clipboard with a rotated version of source clipboard.

Parameters
srcSource clipboard...
dstDestination clipboard...
rotationRotation...
void VoxelFarm::smoothKernel ( VoxelFarm::CellId  targetCell,
int  targetCellX,
int  targetCellY,
int  targetCellZ,
int  kernelMargin,
int  kernelSizeX,
int  kernelSizeY,
int  kernelSizeZ,
int  iterations,
float  blendWeight,
IBlockData blockData,
VoxelFarm::CGenerator generator,
TSet< CellId > *  changedCells,
MaterialId *  kernelMaterials,
double *  kernelPoints,
double *  kernelPointsNext,
int *  kernelVertexLinks,
int *  kernelVertexLinkCount,
float *  kernelWeight,
CMaterialLibrary materialLibrary 
)

Relaxes the inner coordinate points for voxels within a specified kernel. Voxels are read from a CGenerator object and stored into a CBlockData instance.

Parameters
targetCellSpecifies the target cell for the operation. Depending on the kernel's size the operation may bleed to neighboring cells
targetCellXSpecifies the target location along the X axis, in voxels relative to the origin of the cell
targetCellYSpecifies the target location along the Y axis, in voxels relative to the origin of the cell
targetCellZSpecifies the target location along the Z axis, in voxels relative to the origin of the cell
kernelMarginDefines the transition size of the kernel's area of influence. Voxels in the kernel boundaries are not affected by the operation to avoid discontinuities.
kernelSizeXKernel dimensions along the X axis
kernelSizeYKernel dimensions along the Y axis
kernelSizeZKernel dimensions along the Z axis
iterationsNumber of smoothing iterations to be performed
blendWeightControls the weight of each voxel compared to its neighbors. Higher values produce changes at lower rates.
blockDataA CBlockData instance where the results of the operation will be stored
generatorA CGenerator instance that provides the contents of the voxels to be smoothen
changedCellsAn optional set to return which cells were changed by the operation.
kernelMaterialsUsed to buffer voxel materials. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ elements.
kernelPointsUsed to buffer voxel coordinates. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ*3 elements.
kernelPointsNextUsed to buffer voxel coordinates for the next iteration. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ*3 elements.
kernelVertexLinksUsed to buffer surface connections. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ*SMOOTH_KERNEL_LINK_MAX elements.
kernelVertexLinkCountUsed to buffer surface connection counts. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ elements.
kernelWeightUsed to buffer kernel weights. Must allocate least kernelSizeX*kernelSizeY*kernelSizeZ elements.
void VoxelFarm::stampMesh ( IBlockData blockData,
IMeshStampSource mesh,
IMeshStamMaterialSource materials,
const double  worldPos[3],
const Algebra::Matrix transform,
TSet< CellId > *  changedCells 
)

It voxelizes a mesh and stamps it into a block layer.

Parameters
blockDataA reference to the block layer
meshThe mesh to be stamped
materialsIt translates a given material depending of the position in the world
worldPosPosition in world to stamp the mesh
transformA matrix for transforming the mesh before process it
changedCellsReturns a list of all affected cells during the process
void VoxelFarm::stampMeshQEF ( IBlockData blockData,
IMeshStampSource mesh,
IMeshStamMaterialSource materials,
const double  worldPos[3],
const Algebra::Matrix transform,
TSet< CellId > *  changedCells,
Physics::CNoiseBrush noise = NULL,
Physics::CVoxelBuffer nVoxBuffer = NULL,
const TMap< CellId, unsigned char * > *  voxelCache = NULL,
const int  hitMaterial = 0 
)

It voxelizes a mesh and stamps it into a block layer and minimizes the error with the existing data.

Parameters
blockDataA reference to the block layer
meshThe mesh to be stamped
materialsIt translates a given material depending of the position in the world
worldPosPosition in world to stamp the mesh
transformA matrix for transforming the mesh before process it
changedCellsReturns a list of all affected cells during the process
noisePhysics -—
void VoxelFarm::stampVoxels ( IBlockData blockData,
ShortVoxel source,
int  xsize,
int  ysize,
int  zsize,
IMeshStamMaterialSource materials,
const double  worldPos[3],
TSet< CellId > *  changedCells 
)

It stamps a block of voxels into a block layer.

Parameters
blockDataA reference to the block layer
sourceA block of voxel information
xsizeDimension of the block of data
materialsIt translates a given material depending of the position in the world
worldPosPosition in world units to stamp the voxels
changedCellsReturns a list of all affected cells during the process
void VoxelFarm::stampVoxelsQEF ( IBlockData blockData,
ShortVoxel source,
int  xsize,
int  ysize,
int  zsize,
IMeshStamMaterialSource materials,
const double  worldPos[3],
TSet< CellId > *  changedCells 
)

It stamps a block of voxels into a block layer and minimizes the error with the existing data.

Parameters
blockDataA reference to the block layer
sourceA block of voxel information
xsizeDimension of the block of data
materialsIt translates a given material depending of the position in the world
worldPosPosition in world units to stamp the voxels
changedCellsReturns a list of all affected cells during the process
void VoxelFarm::voxelizeMesh ( ShortVoxel voxelData,
IMeshStampSource mesh,
int  lod,
const float  meshOrigin[3],
const float  meshRotation[3],
int  xsize,
int  ysize,
int  zsize,
Algebra::Vector voxelMin,
Algebra::Vector voxelMax 
)

It voxelizes a mesh and returns a block of voxels.

Parameters
voxelDataReturns voxel information from the voxelization
meshThe mesh to be voxelized
lodThe resolution for the voxelization
meshOriginA displacement to be applied to the mesh
meshRotationA rotation to be applied to the mesh
xsizeSizes of block of data. It normalizes the mesh using these sizes
void VoxelFarm::voxelizeSmoothMesh ( StampSmoothData voxelData,
CFastQuadrics mesh,
double  kernelX,
double  kernelY,
double  kernelZ,
int  kernelSizeX,
int  kernelSizeY,
int  kernelSizeZ 
)

Voxelizes partially a mesh based on precomputed data.

Parameters
voxelDataA precomputed voxel data. If the field "ready" is setted there is no need to calculate that voxel.
meshThe mesh to be voxelized
kernelXThe mesh coordinates are relative to a kernel
kernelSizeXSizes of the block of precomputed voxel data
void VoxelFarm::voxelizeTriangles ( ShortVoxel voxelData,
VoxelFarm::Algebra::Vector vertexes,
int  vertexCount,
double  kernelX,
double  kernelY,
double  kernelZ,
int  kernelMargin,
int  kernelSizeX,
int  kernelSizeY,
int  kernelSizeZ,
double &  minDistance,
double &  maxDistance,
bool &  lostData 
)

It voxelizes a list of triangles.

Parameters
voxelDataReturns voxel information from voxelization
vertexesList of vertices of all triangles
vertexCountNumber of vertices in the list
kernelXDimensions of the volumen
minDistanceReturns the minimum distance inside the mesh
maxDistanceReturns the maxim distance inside the mesh
lostDataSignals whether any material was lost
void VoxelFarm::voxelMeshMask ( VoxelMaskData voxelMask,
IMeshStampSource mesh,
int  xsize,
int  ysize,
int  zsize 
)

Returns a mask of voxels from a mesh.

Parameters
voxelMaskReturns voxel information from the voxelization
meshThe mesh to be voxelized
xsizeDimensions of the returned block of data
void VoxelFarm::Worley ( double  at[3],
long  max_order,
double  F[2],
double  delta[2][3],
unsigned long  ID[2] 
)

Cellular noise.

Parameters
atThe input sample location.
max_orderSmaller values compute faster. < 5, read the book to extend it.
FThe output values of F_1, F_2, ..F[n] in F[0], F[1], F[n-1]
deltaThe output vector difference between the sample point and the n-th closest feature point.
IDThe output 32 bit ID number which labels the feature point.