VoxelGeneratorMultipassCB
Scriptable generator working on columns of blocks and multiple passes.
Scriptable generator working on columns of blocks and multiple passes.
This generator can be implemented with a script to generate terrain in columns of blocks instead of only block by block.
It allows to use multiple passes, where every pass can access results of the previous ones, and allowing access to neighbor columns.
The height of columns is not infinite, but it is possible to define what generates above and below, using a single-pass per-block fallback.
It may only be used with VoxelTerrain.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelGeneratorMultipassCBConstructor
public VoxelGeneratorMultipassCB();Properties3
ColumnBaseYBlocksProperty
public int ColumnBaseYBlocks { get; set; }Lowest altitude of columns, in blocks.
ColumnHeightBlocksProperty
public int ColumnHeightBlocks { get; set; }Height of columns, in blocks.
PassCountProperty
public int PassCount { get; set; }Number of passes columns will go through before being considered fully generated. More passes increases memory and processing cost.
Methods12
DebugGenerateTestColumnReckfell.Collections.Array<VoxelBuffer>
public Reckfell.Collections.Array<VoxelBuffer> DebugGenerateTestColumn(Vector2I columnPositionBlocks);Testing method that will fully generate all blocks of a specific column, and returns them. This function doesn't use any threads and doesn't use the internal cache, so it will be very slow. However, it allows to test or debug your script more easily, using an isolated scene for example.
| Name | Type | Default |
|---|---|---|
columnPositionBlocks | Vector2I | — |
Reckfell.Collections.Array<VoxelBuffer>GetColumnBaseYBlocksint
public int GetColumnBaseYBlocks();intGetColumnHeightBlocksint
public int GetColumnHeightBlocks();intGetPassCountint
public int GetPassCount();intGetPassExtentBlocksint
public int GetPassExtentBlocks(int passIndex);Gets how many blocks a pass can access around it (note: a block is 16x16x16 voxels by default).
| Name | Type | Default |
|---|---|---|
passIndex | int | — |
intSetColumnBaseYBlocksvoid
public void SetColumnBaseYBlocks(int y);| Name | Type | Default |
|---|---|---|
y | int | — |
SetColumnHeightBlocksvoid
public void SetColumnHeightBlocks(int y);| Name | Type | Default |
|---|---|---|
y | int | — |
SetPassCountvoid
public void SetPassCount(int count);| Name | Type | Default |
|---|---|---|
count | int | — |
SetPassExtentBlocksvoid
public void SetPassExtentBlocks(int passIndex, int extent);Sets how many blocks a pass can access around columns when they generate (note: a block is 16x16x16 voxels by default). By design, the first pass is not allowed to access neighbors, so it will remain 0. Following passes are designed to access at least 1 block away. Such passes don't support 0 because it would be the same as simply putting your logic in a previous pass. Increasing extent will also increase the cost of the generator, both in memory and processing time, so it should be balanced with caution.
| Name | Type | Default |
|---|---|---|
passIndex | int | — |
extent | int | — |
_GenerateBlockFallbackvoid
public virtual void _GenerateBlockFallback(VoxelBuffer outBuffer, Vector3I originInVoxels);Called for every block to generate above or below the column-based region. For example you can decide to generate air above, and bedrock below.
| Name | Type | Default |
|---|---|---|
outBuffer | VoxelBuffer | — |
originInVoxels | Vector3I | — |
_GeneratePassvoid
public virtual void _GeneratePass(VoxelToolMultipassGenerator voxelTool, int passIndex);Called once per pass for every column of blocks.
The passed voxel_tool must be used to get information about the area to generate, and fill/edit this area with voxels. Important: do not keep this object in a member variable for later re-use. You can only use it in the current call to this method.
You may use pass_index to do something different in each pass. For example, 0 could be base ground with Perlin noise, 1 could plant trees and other structures.
| Name | Type | Default |
|---|---|---|
voxelTool | VoxelToolMultipassGenerator | — |
passIndex | int | — |
_GetUsedChannelsMaskint
public virtual int _GetUsedChannelsMask();Use this to indicate which channels your generator will use. It returns a bitmask, so for example you may provide information like this: (1 << channel1) | (1 << channel2)
intFields and constants2
MaxPassExtentField
public const long MaxPassExtent = 2;MaxPassesField
public const long MaxPasses = 4;