VoxelFarm::CBiome Class Reference

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...

#include <Biome.h>

Inheritance diagram for VoxelFarm::CBiome:
VoxelFarm::IMacroColorSource

Public Member Functions

 CBiome (CHeightLayer *heightLayer, CCornerTileSet *caveLayer, int maskType, double maskFreq, double maskStep, double maskLacunarity, int maskOctaves, double maskShift, double maskClampMin, double maskClampMax, double snowHeight, int caveFloorMaterial, int caveWallMaterial)
 Constructs a biome object. More...
 
void setMacroColor (unsigned char *colors)
 
virtual void getColor (double x, double y, double z, unsigned char &r, unsigned char &g, unsigned char &b)
 
void addPlantingRule (CPlantingRule rule)
 Adds a new PlantingRule object.
 
void addMaterial (CMaterialLibrary *materialLibrary, int id)
 
double getMaskValue (double x, double z)
 Retrieves the mask value for the specified point in the world map.
 
bool getCaveProfile (double x, double z, double noiseHeight, double tileHeight, double tileHeightMin, double tileHeightMax, double displacement, double caveBottomDisplacement, double &height, double &caveBottom, double &caveTop)
 Retrieves cave profile for the biome. Returns true if the spot is exposed to open air. More...
 

Public Attributes

CHeightLayerheightLayer
 A HeightLayer object that specifies the height values for the biome.
 
CCornerTileSetcaveLayer
 A tileset to be used for underground features like caves.
 
int maskType
 Type of mask. Only 0 (Perlin) is currently supported.
 
double maskFreq
 Frequency of the mask signal.
 
double maskStep
 Increment in amplitude from one octave to the next for the mask signal.
 
double maskLacunarity
 Increment in frequency from one octave to the next for the mask signal.
 
int maskOctaves
 Number of octaves in the mask signal.
 
double maskShift
 Adds a global shift to the mask.
 
double maskClampMin
 Minimum value for the mask. Values below this point will be considered zero, and the remaining mask amplitude will be scaled to match this point.
 
double maskClampMax
 Maximum value for the mask. Values above this point will be considered one, and the remaining mask amplitude will be scaled to match this point.
 
double snowHeight
 Height at which snow stats to appear for the biome.
 
int caveFloorMaterial
 Material that will be applied to cave floors.
 
int caveWallMaterial
 Material that will be applied to cave walls.
 
unsigned char * macroColorMap
 Contains the values read from the macro color map.
 
TVector< CPlantingRuleplantingRules
 List of instance planting rules for the biome.
 
TVector< int > materials
 List of terrain materials that appear in the biome.
 

Detailed Description

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.

Definition at line 150 of file Biome.h.

Constructor & Destructor Documentation

VoxelFarm::CBiome::CBiome ( CHeightLayer heightLayer,
CCornerTileSet caveLayer,
int  maskType,
double  maskFreq,
double  maskStep,
double  maskLacunarity,
int  maskOctaves,
double  maskShift,
double  maskClampMin,
double  maskClampMax,
double  snowHeight,
int  caveFloorMaterial,
int  caveWallMaterial 
)

Constructs a biome object.

Parameters
heightLayerA HeightLayer object that specifies the height values for the biome
caveLayerA tileset to be used for underground features like caves
maskTypeType of mask. Only 0 (Perlin) is currently supported.
maskFreqFrequency of the mask signal
maskStepIncrement in amplitude from one octave to the next for the mask signal
maskLacunarityIncrement in frequency from one octave to the next for the mask signal
maskOctavesNumber of octaves in the mask signal
maskShiftAdds a global shift to the mask
maskClampMinMinimum value for the mask. Values below this point will be considered zero, and the remaining mask amplitude will be scaled to match this point
maskClampMaxMaximum value for the mask. Values above this point will be considered one, and the remaining mask amplitude will be scaled to match this point
snowHeightList of terrain materials that appear in the biome
caveFloorMaterialMaterial that will be applied to cave floors
caveWallMaterialMaterial that will be applied to cave walls

Member Function Documentation

void VoxelFarm::CBiome::addMaterial ( CMaterialLibrary materialLibrary,
int  id 
)

Links the material ID to the biome. This makes the material appear in the biome wherever it matches the material placement rules.

bool VoxelFarm::CBiome::getCaveProfile ( double  x,
double  z,
double  noiseHeight,
double  tileHeight,
double  tileHeightMin,
double  tileHeightMax,
double  displacement,
double  caveBottomDisplacement,
double &  height,
double &  caveBottom,
double &  caveTop 
)

Retrieves cave profile for the biome. Returns true if the spot is exposed to open air.

Parameters
xWorld X coordinate
zWorld Z coordinate
noiseHeightHeight of the noise component for the biome heightmap
tileHeightHeight of the tileset component for the biome heightmap
tileHeightMinFiltered minimum height of the tilese component
tileHeightMaxFiltered maximum height of the tilese component
displacementMaterial displacement at the point
caveBottomDisplacementCave ground displacement at the point
heightReturns the heigtmap value at the point
caveBottomReturns the heigtmap value for the cave's bottom
caveTopReturns the heigtmap value for the cave's top

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