WorldGroupingCell Structure

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

Represents a cell on a Streamable Grid layer. In addition to regular cell indexes, contains the LOD and index of the World Grouping that the cell belongs to.

Fields

Name Type Default Value Description
Cell readonly Cell

The actual Cell this struct details.

LOD readonly int

The LOD of the WorldGroupingCell.

WorldGroupingIndex readonly int

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

Constructors

WorldGroupingCell(Cell, int, int)

public WorldGroupingCell(Cell cell, int groupingIndex, int lod)

Initializes a new instance of the WorldGroupingCell structure.

Parameters

Name Type Description
cell Cell

The cell of the WorldGroupingCell.

groupingIndex int

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

lod int

The LOD of the WorldGroupingCell.

Methods

operator !=(WorldGroupingCell, WorldGroupingCell)

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

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

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

Parameters

Name Type Description
left WorldGroupingCell

The first WorldGroupingCell.

right WorldGroupingCell

The second WorldGroupingCell.

Returns

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


operator <(WorldGroupingCell, WorldGroupingCell)

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

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

Parameters

Name Type Description
left WorldGroupingCell

The left WorldGroupingCell.

right WorldGroupingCell

The right WorldGroupingCell.

Returns

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


operator <=(WorldGroupingCell, WorldGroupingCell)

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

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

Parameters

Name Type Description
left WorldGroupingCell

The left WorldGroupingCell.

right WorldGroupingCell

The right WorldGroupingCell.

Returns

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


operator ==(WorldGroupingCell, WorldGroupingCell)

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

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

The two WorldGroupingCells will be equal if the GridLayerIndex, LOD, rows, columns, or layers all match each other from one WorldGroupingCell to the other (row == row, etc.)

Parameters

Name Type Description
left WorldGroupingCell

The first WorldGroupingCell.

right WorldGroupingCell

The second WorldGroupingCell.

Returns

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


operator >(WorldGroupingCell, WorldGroupingCell)

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

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

Parameters

Name Type Description
left WorldGroupingCell

The left WorldGroupingCell.

right WorldGroupingCell

The right WorldGroupingCell.

Returns

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


operator >=(WorldGroupingCell, WorldGroupingCell)

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

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

Parameters

Name Type Description
left WorldGroupingCell

The left WorldGroupingCell.

right WorldGroupingCell

The right WorldGroupingCell.

Returns

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


CompareTo(WorldGroupingCell)

public int CompareTo(WorldGroupingCell other)

Compares the input WorldGroupingCell against this WorldGroupingCell to determine whether this WorldGroupingCell procedes, follows, or is at the same position of the input WorldGroupingCell. This can be used to order a collection of WorldGroupingCells in the same manner as they would appear in the scene (if they were associated with World WorldGroupingCells, that is). The method utilizes the LOD, row, column, and layer values. If you know the layer value is not used (such as in a 2D world), you may choose to use a different method rather than this one.

Parameters

Name Type Description
other object

The other WorldGroupingCell to compare this WorldGroupingCell against.

Returns

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

The following logic is used to determine the order. First, the GridLayerIndex of the two cell's is compared. If this cell's GridLayerIndex is less than the input cell's GridLayerIndex, -1 is returned. If it is greater than the input cell's GridLayerIndex, +1 is returned. If they are equal, the LOD values are compared. If this cell's LOD value is less than the LOD value of the input cell, -1 is returned. If it is greater, +1 is returned. If they are the same, then the Layer value is copared in the same manner. If this WorldGroupingCell's layer is less than the input WorldGroupingCell's layer, -1 is returned. If this WorldGroupingCell's layer is greater than the input WorldGroupingCell's layer, +1 is returned. If the two have the same layer value, the row is compared in the same manner. If the rows are the same, the columns are compared. If the columns are compared, 0 is returned as the two WorldGroupingCell's are equal and have the same placement in the order.

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, WorldGroupingCell's with higher quality LODs are less than WorldGroupingCell'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.


Equals(WorldGroupingCell)

public bool Equals(WorldGroupingCell other)

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

This method compares the GridLayerIndex, 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 WorldGroupingCell EqualityComparer that ignores the layer

Parameters

Name Type Description
other object

The other WorldGroupingCell to compare this WorldGroupingCell against.

Returns

bool
false if the row, column, and/or layer value on the other WorldGroupingCell is not equal to this WorldGroupingCell'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 WorldGroupingCell to be boxed.

Parameters

Name Type Description
obj object

The object to check this WorldGroupingCell against.

Returns

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


GetHashCode()

public override int GetHashCode()

Returns a hash code for this WorldGroupingCell. Uses all five indexes (GridLayerIndex, LOD, Row, Column and Layer) to compute it, so the WorldGroupingCell is treated as a 3D WorldGroupingCell. You could also create a custom EqualityComparer that only utilizes the row, column, and LOD, if you know that you do not need the layer value.

Returns

int
The hash code of the WorldGroupingCell, calculated using all five fields (GridLayerIndex, LOD, row, column, and layer).