public struct WorldGroupingChunk : IEquatable<WorldGroupingChunk>, IComparable<WorldGroupingChunk>
Represents an asset chunk that is part of a World Grouping. In addition to regular cell indexes, contains the LOD and index of the World Grouping that the cell belongs to, as well as the assetChunkIndex of the asset chunk.
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 WorldGroupingChunk. |
|
WorldGroupingIndex | readonly int |
The index of the World Grouping that this cell is associated with. |
public WorldGroupingChunk(Cell cell, int groupingIndex, int lod)
Initializes a new instance of the WorldGroupingChunk structure.
Name | Type | Description |
---|---|---|
cell | Cell |
The cell of the WorldGroupingChunk. |
groupingIndex | int |
The index of the World Grouping that this cell is associated with. |
lod | int |
The LOD of the WorldGroupingChunk. |
assetChunkIndex | int |
The index of the asset chunk in relation to other asset chunks associated with the World Cell. |
public static bool operator !=(WorldGroupingChunk left, WorldGroupingChunk right)
!= operater implementation that allows you check if two WorldGroupingChunks are not
equal
The two WorldGroupingChunks will not be equal if the GridLayerIndex, LOD, rows, columns,
or
layers do not match each other from one WorldGroupingChunk to
the other (row != row, etc.)
Name | Type | Description |
---|---|---|
left | WorldGroupingChunk |
The first WorldGroupingChunk. |
right | WorldGroupingChunk |
The second WorldGroupingChunk. |
bool
Returns true if the WorldGroupingChunks are not equal, false if they are equal.
public static bool operator <(WorldGroupingChunk left, WorldGroupingChunk right)
< operater implementation that allows you check if the left WorldGroupingChunk is less than the right WorldGroupingChunk.
Name | Type | Description |
---|---|---|
left | WorldGroupingChunk |
The left WorldGroupingChunk. |
right | WorldGroupingChunk |
The right WorldGroupingChunk. |
bool
Please refer to the CompareTo method documentation to understand
how WorldGroupingChunk comparison works.
public static bool operator <=(WorldGroupingChunk left, WorldGroupingChunk right)
<= operater implementation that allows you check if the left WorldGroupingChunk is less than or equal to the right WorldGroupingChunk.
Name | Type | Description |
---|---|---|
left | WorldGroupingChunk |
The left WorldGroupingChunk. |
right | WorldGroupingChunk |
The right WorldGroupingChunk. |
bool
Please refer to the CompareTo method documentation to understand
how WorldGroupingChunk comparison works.
public static bool operator ==(WorldGroupingChunk left, WorldGroupingChunk right)
!= operater implementation that allows you check if two WorldGroupingChunks are equal
The two WorldGroupingChunks will be equal if the GridLayerIndex, LOD, rows, columns,
or layers all match each other from one WorldGroupingChunk to
the other (row == row, etc.)
Name | Type | Description |
---|---|---|
left | WorldGroupingChunk |
The first WorldGroupingChunk. |
right | WorldGroupingChunk |
The second WorldGroupingChunk. |
bool
Returns true if the WorldGroupingChunks are equal, false if they are not equal.
public static bool operator >(WorldGroupingChunk left, WorldGroupingChunk right)
> operater implementation that allows you check if the left WorldGroupingChunk is greater than the right WorldGroupingChunk.
Name | Type | Description |
---|---|---|
left | WorldGroupingChunk |
The left WorldGroupingChunk. |
right | WorldGroupingChunk |
The right WorldGroupingChunk. |
bool
Please refer to the CompareTo method documentation to understand
how WorldGroupingChunk comparison works.
public static bool operator >=(WorldGroupingChunk left, WorldGroupingChunk right)
>= operater implementation that allows you check if the left WorldGroupingChunk is greater than or equal to the right WorldGroupingChunk.
Name | Type | Description |
---|---|---|
left | WorldGroupingChunk |
The left WorldGroupingChunk. |
right | WorldGroupingChunk |
The right WorldGroupingChunk. |
bool
Please refer to the CompareTo method documentation to understand
how WorldGroupingChunk comparison works.
public int CompareTo(WorldGroupingChunk other)
Compares the input WorldGroupingChunk against this WorldGroupingChunk to determine whether this WorldGroupingChunk procedes, follows, or is at the same position of the input WorldGroupingChunk. This can be used to order a collection of WorldGroupingChunks in the same manner as they would appear in the scene (if they were associated with World WorldGroupingChunks, 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.
Name | Type | Description |
---|---|---|
other | object |
The other WorldGroupingChunk to compare this WorldGroupingChunk against. |
int
-1 if this WorldGroupingChunk precedes (is less than) the input "other" WorldGroupingChunk,
+1 if this WorldGroupingChunk follows (is greater than)
the input "other" WorldGroupingChunk, and 0 if the WorldGroupingChunks 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 WorldGroupingChunk's
layer is less than the input WorldGroupingChunk's layer, -1 is returned. If this WorldGroupingChunk's
layer is greater than the input WorldGroupingChunk'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 WorldGroupingChunk'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, WorldGroupingChunk's with higher quality LODs are
less than WorldGroupingChunk'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.
public bool Equals(WorldGroupingChunk other)
Implementation of IEquatable<WorldGroupingChunk>.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
WorldGroupingChunk EqualityComparer
that ignores the layer
Name | Type | Description |
---|---|---|
other | object |
The other WorldGroupingChunk to compare this WorldGroupingChunk against. |
bool
false if the row, column, and/or layer value on
the other WorldGroupingChunk is not equal to this WorldGroupingChunk's LOD, row, column,
and/or layer value.
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 WorldGroupingChunk to be boxed.
Name | Type | Description |
---|---|---|
obj | object |
The object to check this WorldGroupingChunk against. |
bool
false if the object is not a WorldGroupingChunk or it is but the LOD, row, column,
and/or layer value on
the obj is not equal to this WorldGroupingChunk's LOD, row, column, and/or layer value.
public override int GetHashCode()
Returns a hash code for this WorldGroupingChunk. Uses all five indexes (GridLayerIndex, LOD, Row, Column and Layer) to compute it, so the WorldGroupingChunk is treated as a 3D WorldGroupingChunk. 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.
int
The hash code of the WorldGroupingChunk, calculated using all five fields (GridLayerIndex,
LOD, row, column, and layer).