Search Results for

    Show / Hide Table of Contents

    Class VoxelGrid

    A 3D grid of voxels that can be either "filled" or "empty".

    Inheritance
    System.Object
    VoxelGridAsset
    VoxelGrid
    Implements
    IVoxelGrid
    Namespace: CarbideFunction.Wildtile
    Syntax
    public class VoxelGrid : VoxelGridAsset, IVoxelGrid

    Fields

    createBottomTiles

    If enabled, the GridPlacer will use an extra layer of empty voxels at the bottom of the map. The GridPlacer will place end-caps on the bottom of your models (if available in the tileset).

    If disabled, the GridPlacer will use the bottom layer of the map directly. This may leave some models uncapped.

    If you are creating a standalone model, you probably want to set this flag. If you are creating a cave or a landscape, you probably want to clear this flag.

    Declaration
    public bool createBottomTiles
    Field Value
    Type Description
    System.Boolean

    createSideTiles

    If enabled, the GridPlacer will use an extra layer of empty voxels at the sides of the map. The GridPlacer will place end-caps on the sides of your models (if available in the tileset).

    If disabled, the GridPlacer will use the side layers of the map directly. This may leave some models uncapped.

    If you are creating a standalone model, you probably want to set this flag. If you are creating a cave, you probably want to clear this flag.

    Declaration
    public bool createSideTiles
    Field Value
    Type Description
    System.Boolean

    createTopTiles

    If enabled, the GridPlacer will use an extra layer of empty voxels at the top of the map. The GridPlacer will place end-caps on top of your models (if available in the tileset).

    If disabled, the GridPlacer will use the top layer of the map directly. This may leave some models uncapped.

    If you are creating a landscape or a standalone model, you probably want to set this flag. If you are creating a cave, you probably want to clear this flag.

    Declaration
    public bool createTopTiles
    Field Value
    Type Description
    System.Boolean

    voxelDataName

    Serialization name for voxelData.

    Not intended for users.

    Declaration
    public const string voxelDataName = "voxelData"
    Field Value
    Type Description
    System.String

    Properties

    Dimensions

    Get the size of the 3D voxel grid.

    Declaration
    public Vector3Int Dimensions { get; }
    Property Value
    Type Description
    Vector3Int

    Item[Int32]

    Access a voxel in the grid.

    Declaration
    public int this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type Description
    System.Int32

    1 if the voxel is filled, 0 otherwise.

    Item[Int32, Int32, Int32]

    Access a voxel in the grid.

    Declaration
    public int this[int x, int y, int z] { get; set; }
    Parameters
    Type Name Description
    System.Int32 x
    System.Int32 y
    System.Int32 z
    Property Value
    Type Description
    System.Int32

    1 if the voxel is filled, 0 otherwise.

    Item[Vector3Int]

    Access a voxel in the grid.

    Declaration
    public int this[Vector3Int coord] { get; set; }
    Parameters
    Type Name Description
    Vector3Int coord
    Property Value
    Type Description
    System.Int32

    1 if the voxel is filled, 0 otherwise.

    Voxels

    Declaration
    public override IReadOnlyList<IVoxelGrid.Voxel> Voxels { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyList<IVoxelGrid.Voxel>
    Overrides
    VoxelGridAsset.Voxels

    Methods

    GetCubeContents(Vector3Int)

    Get the marching cube at the cube with its top-right-front corner at the specified coordinates.

    For example, if you requested the cube contents of (3,6,4), this method would query the contents of voxels:

    • (2,5,3)
    • (2,5,4)
    • (2,6,3)
    • (2,6,4)
    • (3,5,3)
    • (3,5,4)
    • (3,6,3)
    • (3,6,4)
    Declaration
    public int GetCubeContents(Vector3Int coords)
    Parameters
    Type Name Description
    Vector3Int coords
    Returns
    Type Description
    System.Int32

    GetVoxel(Int32)

    Gets the voxel at flat-index index.

    Implementation of IVoxelGrid.GetVoxel.

    Declaration
    public override IVoxelGrid.Voxel GetVoxel(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    IVoxelGrid.Voxel
    Overrides
    VoxelGridAsset.GetVoxel(Int32)

    IsWithinBounds(Vector3Int)

    Test if a coordinate is within the bounds of the voxel grid.

    If this is false, do not call Item[Vector3Int].

    Declaration
    public bool IsWithinBounds(Vector3Int coord)
    Parameters
    Type Name Description
    Vector3Int coord
    Returns
    Type Description
    System.Boolean

    SetDimensionsAndClearGrid(Vector3Int)

    Resize the 3D grid and clear all previous contents.

    Declaration
    public void SetDimensionsAndClearGrid(Vector3Int newDimensions)
    Parameters
    Type Name Description
    Vector3Int newDimensions

    SetVoxelContents(Int32, Int32)

    Declaration
    public override void SetVoxelContents(int index, int newContents)
    Parameters
    Type Name Description
    System.Int32 index
    System.Int32 newContents
    Overrides
    VoxelGridAsset.SetVoxelContents(Int32, Int32)

    Visit(IVoxelGridVisitor)

    Declaration
    public override void Visit(IVoxelGridVisitor visitor)
    Parameters
    Type Name Description
    IVoxelGridVisitor visitor
    Overrides
    VoxelGridAsset.Visit(IVoxelGridVisitor)

    Implements

    IVoxelGrid
    In This Article
    Generated by DocFX Wildtile Documentation