LODCell Structure

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

Represents a cell with an LOD.

Fields

Name Type Default Value Description
Cell readonly Cell

The actual Cell this struct details.

LOD readonly int

The LOD of the LODCell.

Constructors

LODCell(Cell, int)

public LODCell(Cell cell, int lod)

Initializes a new instance of the LODCell structure.

Parameters

Name Type Description
cell Cell

The cell of the LODCell.

lod int

The LOD of the LODCell.

Methods

operator !=(LODCell, LODCell)

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

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

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

Parameters

Name Type Description
left LODCell

The first LODCell.

right LODCell

The second LODCell.

Returns

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


operator <(LODCell, LODCell)

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

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

Parameters

Name Type Description
left LODCell

The left LODCell.

right LODCell

The right LODCell.

Returns

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


operator <=(LODCell, LODCell)

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

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

Parameters

Name Type Description
left LODCell

The left LODCell.

right LODCell

The right LODCell.

Returns

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


operator ==(LODCell, LODCell)

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

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

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

Parameters

Name Type Description
left LODCell

The first LODCell.

right LODCell

The second LODCell.

Returns

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


operator >(LODCell, LODCell)

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

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

Parameters

Name Type Description
left LODCell

The left LODCell.

right LODCell

The right LODCell.

Returns

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


operator >=(LODCell, LODCell)

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

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

Parameters

Name Type Description
left LODCell

The left LODCell.

right LODCell

The right LODCell.

Returns

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


CompareTo(LODCell)

public int CompareTo(LODCell other)

Compares the input LODCell against this LODCell to determine whether this LODCell procedes, follows, or is at the same position of the input LODCell. This can be used to order a collection of LODCells in the same manner as they would appear in the scene (if they were associated with World LODCells, 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 LODCell to compare this LODCell against.

Returns

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

The following logic is used to determine the order. First, the LOD of the two LODCell's is 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 LODCell's layer is less than the input LODCell's layer, -1 is returned. If this LODCell's layer is greater than the input LODCell'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 LODCell'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, LODCell's with higher quality LODs are less than LODCell's with lower quality LODs.


Equals(LODCell)

public bool Equals(LODCell other)

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

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

Parameters

Name Type Description
other object

The other LODCell to compare this LODCell against.

Returns

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

Parameters

Name Type Description
obj object

The object to check this LODCell against.

Returns

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


GetHashCode()

public override int GetHashCode()

Returns a hash code for this LODCell. Uses all three indexes (row, column and layer) + the LOD to compute it, so the LODCell is treated as a 3D LODCell. 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 LODCell, calculated using all four fields (LOD, row, column, and layer).