Class VoxelGrid
A 3D grid of voxels that can be either "filled" or "empty".
Inheritance
Namespace: CarbideFunction.Wildtile
Syntax
public class VoxelGrid : ScriptableObject
Fields
dimensionXName
Serialization name of dimensionX
Not intended for users.
Declaration
public const string dimensionXName = "dimensionX"
Field Value
Type | Description |
---|---|
System.String |
dimensionYName
Serialization name of dimensionY
Not intended for users.
Declaration
public const string dimensionYName = "dimensionY"
Field Value
Type | Description |
---|---|
System.String |
dimensionZName
Serialization name of dimensionZ
Not intended for users.
Declaration
public const string dimensionZName = "dimensionZ"
Field Value
Type | Description |
---|---|
System.String |
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, 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. |
Methods
GetCubeContents(Vector3Int)
Get the marching cube at the cube with its bottom-left-back corner at the specified coordinates.
For example, if you requested the cube contents of (2,5,3), 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 |
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 |