Show / Hide Table of Contents

Class ChunkData

Represents a chunk of the grid, containing heights and materials for each tile.

Inheritance
object
ChunkData
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TerraProc.Core.Terrain
Assembly: TerraProc.Core.dll
Syntax
public sealed class ChunkData

Properties

| Edit this page View Source

ByteSize

Size of the chunk data in bytes in memory.

Declaration
public int ByteSize { get; }
Property Value
Type Description
int

Size in bytes.

| Edit this page View Source

Heights

Read-only span of heights in the chunk.

Declaration
public ReadOnlySpan<Height> Heights { get; }
Property Value
Type Description
ReadOnlySpan<Height>
| Edit this page View Source

HeightsMemory

Read-only memory of heights in the chunk.

Declaration
public ReadOnlyMemory<Height> HeightsMemory { get; }
Property Value
Type Description
ReadOnlyMemory<Height>
| Edit this page View Source

this[int, int]

Get the Tile by the local coordinates within the chunk.

Declaration
public Tile this[int x, int y] { get; set; }
Parameters
Type Name Description
int x

Local X coordinate within the chunk (0 to ChunkSize-1)

int y

Local Y coordinate within the chunk (0 to ChunkSize-1)

Property Value
Type Description
Tile
| Edit this page View Source

this[TileCoords]

Get the Tile by the global tile coordinates.

Declaration
public Tile this[TileCoords coords] { get; set; }
Parameters
Type Name Description
TileCoords coords

Global tile coordinates.

Property Value
Type Description
Tile
| Edit this page View Source

Materials

Read-only span of materials in the chunk.

Declaration
public ReadOnlySpan<Material> Materials { get; }
Property Value
Type Description
ReadOnlySpan<Material>
| Edit this page View Source

MaterialsMemory

Read-only memory of materials in the chunk.

Declaration
public ReadOnlyMemory<Material> MaterialsMemory { get; }
Property Value
Type Description
ReadOnlyMemory<Material>
| Edit this page View Source

TileCount

Number of tiles in the chunk (should be equal to ChunkTileCount).

Declaration
public int TileCount { get; }
Property Value
Type Description
int

Methods

| Edit this page View Source

FromOwned(Height[], Material[])

Create a chunk from owned arrays of heights and materials. Caller promises that they will not be modified after being passed to this method. Arrays must be of length ChunkTileCount.

Declaration
public static ChunkData FromOwned(Height[] heights, Material[] materials)
Parameters
Type Name Description
Height[] heights
Material[] materials
Returns
Type Description
ChunkData

Created chunk.

| Edit this page View Source

FromSpan(ReadOnlySpan<Height>, ReadOnlySpan<Material>)

Create a chunk from spans of heights and materials. Spans will be copied into new arrays. Arrays must be of length ChunkTileCount.

Declaration
public static ChunkData FromSpan(ReadOnlySpan<Height> heights, ReadOnlySpan<Material> materials)
Parameters
Type Name Description
ReadOnlySpan<Height> heights
ReadOnlySpan<Material> materials
Returns
Type Description
ChunkData

Created chunk.

| Edit this page View Source

Zero()

Create a chunk with all heights set to zero and all materials set to Void.

Declaration
public static ChunkData Zero()
Returns
Type Description
ChunkData

Created chunk.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX