ZoneGroupingChunk Structure

public struct ZoneGroupingChunk : IEquatable<ZoneGroupingChunk>, IComparable<ZoneGroupingChunk>

Represents an asset chunk that is part of a Zone Grouping. In addition to regular cell indexes, contains the LOD and index of the Zone/World Grouping that the cell belongs to, as well as the assetChunkIndex of the asset chunk.

Fields

Name Type Default Value Description
AssetChunkIndex readonly int

The index of the asset chunk in relation to other asset chunks associated with the World Cell.

Cell readonly Cell

The actual Cell this struct details.

LOD readonly int

The LOD of the ZoneGroupingChunk.

WorldGroupingIndex readonly int

The index of the World Grouping that this chunk is associated with.

ZoneIndex int

The index of the Zone that this chunk is associated with.

Constructors

ZoneGroupingChunk(Cell, int, int, int)

public ZoneGroupingChunk(Cell cell, int zoneIndex, int groupingIndex, int lod)

Initializes a new instance of the ZoneGroupingChunk structure.

Parameters

Name Type Description
cell Cell

The cell of the ZoneGroupingChunk.

zoneIndex int

The index of the Zone that this cell is associated with.

groupingIndex int

The index of the World Grouping that this cell is associated with.

lod int

The LOD of the ZoneGroupingChunk.

assetChunkIndex int

The index of the asset chunk in relation to other asset chunks associated with the World Cell.

Methods

operator !=(ZoneGroupingChunk, ZoneGroupingChunk)

public static bool operator !=(ZoneGroupingChunk left, ZoneGroupingChunk right)

!= operater implementation that allows you check if two ZoneGroupingChunks are not equal

The two ZoneGroupingChunks will not be equal if the ZoneIndex, WorldGroupingIndex, LOD, rows, columns, or layers do not match each other from one ZoneGroupingChunk to the other (row != row, etc.)

Parameters

Name Type Description
left ZoneGroupingChunk

The first ZoneGroupingChunk.

right ZoneGroupingChunk

The second ZoneGroupingChunk.

Returns

bool
Returns true if the ZoneGroupingChunks are not equal, false if they are equal.


operator <(ZoneGroupingChunk, ZoneGroupingChunk)

public static bool operator <(ZoneGroupingChunk left, ZoneGroupingChunk right)

< operater implementation that allows you check if the left ZoneGroupingChunk is less than the right ZoneGroupingChunk.

Parameters

Name Type Description
left ZoneGroupingChunk

The left ZoneGroupingChunk.

right ZoneGroupingChunk

The right ZoneGroupingChunk.

Returns

bool
Please refer to the CompareTo method documentation to understand how ZoneGroupingChunk comparison works.


operator <=(ZoneGroupingChunk, ZoneGroupingChunk)

public static bool operator <=(ZoneGroupingChunk left, ZoneGroupingChunk right)

<= operater implementation that allows you check if the left ZoneGroupingChunk is less than or equal to the right ZoneGroupingChunk.

Parameters

Name Type Description
left ZoneGroupingChunk

The left ZoneGroupingChunk.

right ZoneGroupingChunk

The right ZoneGroupingChunk.

Returns

bool
Please refer to the CompareTo method documentation to understand how ZoneGroupingChunk comparison works.


operator ==(ZoneGroupingChunk, ZoneGroupingChunk)

public static bool operator ==(ZoneGroupingChunk left, ZoneGroupingChunk right)

!= operater implementation that allows you check if two ZoneGroupingChunks are equal

The two ZoneGroupingChunks will be equal if the ZoneIndex, WorldGroupingIndex, LOD, rows, columns, or layers all match each other from one ZoneGroupingChunk to the other (row == row, etc.)

Parameters

Name Type Description
left ZoneGroupingChunk

The first ZoneGroupingChunk.

right ZoneGroupingChunk

The second ZoneGroupingChunk.

Returns

bool
Returns true if the ZoneGroupingChunks are equal, false if they are not equal.


operator >(ZoneGroupingChunk, ZoneGroupingChunk)

public static bool operator >(ZoneGroupingChunk left, ZoneGroupingChunk right)

> operater implementation that allows you check if the left ZoneGroupingChunk is greater than the right ZoneGroupingChunk.

Parameters

Name Type Description
left ZoneGroupingChunk

The left ZoneGroupingChunk.

right ZoneGroupingChunk

The right ZoneGroupingChunk.

Returns

bool
Please refer to the CompareTo method documentation to understand how ZoneGroupingChunk comparison works.


operator >=(ZoneGroupingChunk, ZoneGroupingChunk)

public static bool operator >=(ZoneGroupingChunk left, ZoneGroupingChunk right)

>= operater implementation that allows you check if the left ZoneGroupingChunk is greater than or equal to the right ZoneGroupingChunk.

Parameters

Name Type Description
left ZoneGroupingChunk

The left ZoneGroupingChunk.

right ZoneGroupingChunk

The right ZoneGroupingChunk.

Returns

bool
Please refer to the CompareTo method documentation to understand how ZoneGroupingChunk comparison works.


CompareTo(ZoneGroupingChunk)

public int CompareTo(ZoneGroupingChunk other)

Compares the input ZoneGroupingChunk against this ZoneGroupingChunk to determine whether this ZoneGroupingChunk procedes, follows, or is at the same position of the input ZoneGroupingChunk. This can be used to order a collection of ZoneGroupingChunks in the same manner as they would appear in the scene (if they were associated with World ZoneGroupingChunks, that is). The method utilizes the ZoneIndex, WorldGroupingIndex, LOD, row, column, and layer values, as well as the AssetChunkIndex.

Parameters

Name Type Description
other object

The other ZoneGroupingChunk to compare this ZoneGroupingChunk against.

Returns

int
-1 if this ZoneGroupingChunk precedes (is less than) the input "other" ZoneGroupingChunk, +1 if this ZoneGroupingChunk follows (is greater than) the input "other" ZoneGroupingChunk, and 0 if the ZoneGroupingChunks are at the same position (are equal).

The following logic is used to determine the order. First, the ZoneIndex of the two cell's is compared. If this cell's ZoneIndex is less than the input cell's ZoneIndex, -1 is returned. If it is greater than the input cell's ZoneIndex, +1 is returned. If they are equal, the WorldGroupingIndex values are compared in the same way, followed by the LOD values, then the Cell Indices, and finally the Asset Chunk Indexes.

An important thing to note is that higher quality LODs (which have a smaller value) will precede lower quality LODs. However, this also means that according to SAM, ZoneGroupingChunk's with higher quality LODs are less than ZoneGroupingChunk's with lower quality LODs. In addition, lower World Groupings (which are actually probably more important) will be before higher World Groupings. As such, they are considered less than the higher World Grouping cells. The same goes for Zone Groupings.


Equals(ZoneGroupingChunk)

public bool Equals(ZoneGroupingChunk other)

Implementation of IEquatable<ZoneGroupingChunk>.Equals method. Use this, as it does not box input struct.

This method compares the ZoneIndex, WorldGroupingIndex, AssetChunkIndex, LOD, row, column, and layer. In some instances where you know the layer does not matter (on 2D worlds for instance), it may be slightly more performant to use a custom ZoneGroupingChunk EqualityComparer that ignores the layer.

Parameters

Name Type Description
other object

The other ZoneGroupingChunk to compare this ZoneGroupingChunk against.

Returns

bool
false if the row, column, and/or layer value on the other ZoneGroupingChunk is not equal to this ZoneGroupingChunk's LOD, row, column, and/or layer value.


Equals(object)

public override bool Equals(object obj)

Override of Equals method. You shouldn't need to use this, and you should not use it since it will cause the input ZoneGroupingChunk to be boxed.

Parameters

Name Type Description
obj object

The object to check this ZoneGroupingChunk against.

Returns

bool
false if the object is not a ZoneGroupingChunk or it is but the ZoneIndex, WorldGroupingIndex, LOD, AssetChunkIndex, row, column, and/or layer value on the obj is not equal to this ZoneGroupingChunk's ZoneIndex, WorldGroupingIndex, LOD, AssetChunkIndex, row, column, and/or layer value.


GetHashCode()

public override int GetHashCode()

Returns a hash code for this ZoneGroupingChunk. Uses all seven indexes (ZoneIndex, WorldGroupingIndex, LOD, Row, Column, Layer, and AsseChunkIndex) to compute it, so the ZoneGroupingChunk is treated as a 3D ZoneGroupingChunk.

Returns

int
The hash code of the ZoneGroupingChunk.