Nearby chunks 3x3x3 group container. More...
#include <cluster.hpp>
Classes | |
| struct | Position |
| Cluster 3D position container. More... | |
Public Types | |
| typedef C | Chunk |
| typedef V | Voxel |
Public Member Functions | |
| Cluster3D (Chunk *chunks[size]=nullptr) noexcept | |
| Creates a new chunk 3x3x3 cluster. | |
| Chunk * | getChunks () noexcept |
| Returns cluster chunk array. | |
| const Chunk * | getChunks () const noexcept |
| Returns constant cluster chunk array. | |
| bool | isComplete () const noexcept |
| Are all cluster chunks not null. | |
| Chunk * | getCentralChunk () const noexcept |
| Returns cluster central chunk. (It can be null). | |
| Chunk * | getChunk (uint8_t x, uint8_t y, uint8_t z) const noexcept |
| Returns cluster chunk at specified 3D position. (It can be null). | |
| Chunk * | getChunk (uint8_t index) const noexcept |
| Returns cluster chunk at specified array index. (It can be null). | |
| Chunk * | tryGetChunk (uint8_t x, uint8_t y, uint8_t z) const noexcept |
| Returns cluster chunk at specified 3D position. (It can be null). | |
| Chunk * | tryGetChunk (uint8_t index) const noexcept |
| Returns cluster chunk at specified array index. (It can be null). | |
| Chunk * | unsafeGetChunk (uint8_t x, uint8_t y, uint8_t z) const noexcept |
| Returns cluster chunk at specified 3D position. (It can be null). | |
| Chunk * | unsafeGetChunk (uint8_t index) const noexcept |
| Returns cluster chunk at specified array index. (It can be null). | |
| Chunk * | getVoxelChunk (int16_t &x, int16_t &y, int16_t &z) const noexcept |
| Returns cluster chunk at specified voxel 3D position relative to the central chunk. | |
| Chunk * | tryGetVoxelChunk (int16_t &x, int16_t &y, int16_t &z) const noexcept |
| Returns cluster chunk at specified voxel 3D position relative to the central chunk. | |
| Chunk * | unsafeGetVoxelChunk (int16_t &x, int16_t &y, int16_t &z) const noexcept |
| Returns cluster chunk at specified voxel 3D position relative to the central chunk. | |
| Voxel | getVoxel (int16_t x, int16_t y, int16_t z, Voxel nullVoxel=voxel::null) const noexcept |
| Returns voxel at specified 3D position relative to the central chunk. | |
| void | setVoxel (uint16_t x, uint16_t y, uint16_t z, Voxel voxel) noexcept |
| Sets voxel at specified 3D position relative to the central chunk. | |
| bool | tryGetVoxel (int16_t x, int16_t y, int16_t z, Voxel &voxel) const noexcept |
| Returns voxel at specified 3D position relative to the central chunk. | |
| bool | trySetVoxel (uint16_t x, uint16_t y, uint16_t z, Voxel voxel) noexcept |
| Sets voxel at specified 3D position relative to the central chunk. | |
| Voxel | unsafeGetVoxel (int16_t x, int16_t y, int16_t z, Voxel nullVoxel=voxel::null) const noexcept |
| Returns voxel at specified 3D position relative to the central chunk. | |
Static Public Member Functions | |
| static constexpr uint8_t | posToIndex (uint8_t x, uint8_t y, uint8_t z) noexcept |
| Calculates cluster chunk index from the 3D position. | |
| template<typename T> | |
| static constexpr void | indexToPos (uint8_t index, uint8_t &x, uint8_t &y, uint8_t &z) noexcept |
| Calculates cluster chunk 3D position from the index. | |
Static Public Attributes | |
| static constexpr uint8_t | length = 3 |
| static constexpr uint8_t | layerSize = 9 |
| static constexpr uint8_t | size = 27 |
| static constexpr Position | positions [size] |
| Cluster 3D positions 3x3x3. | |
| static constexpr uint8_t | centralIndex = posToIndex(1, 1, 1) |
| Central cluster chunk index. | |
Protected Attributes | |
| Chunk * | chunks [size] |
Nearby chunks 3x3x3 group container.
| C | cluster chunk type |
| V | chunk voxel ID type |
| typedef C Chunk |
Cluster chunk type.
|
inlinenoexcept |
Creates a new chunk 3x3x3 cluster.
| chunks | target cluster chunk array or null |
|
inlinestaticconstexprnoexcept |
Calculates cluster chunk index from the 3D position.
| x | chunk position along X-axis |
| y | chunk position along Y-axis |
| z | chunk position along Z-axis |
|
inlinestaticconstexprnoexcept |
Calculates cluster chunk 3D position from the index.
| index | chunk index inside the chunk | |
| [out] | x | chunk position along X-axis |
| [out] | y | chunk position along Y-axis |
| [out] | z | chunk position along Z-axis |
|
inlinenoexcept |
Returns cluster chunk at specified 3D position. (It can be null).
| x | chunk position along X-axis |
| y | chunk position along Y-axis |
| z | chunk position along Z-axis |
|
inlinenoexcept |
Returns cluster chunk at specified array index. (It can be null).
| index | target chunk index inside array |
|
inlinenoexcept |
Returns cluster chunk at specified 3D position. (It can be null).
| x | chunk position along X-axis |
| y | chunk position along Y-axis |
| z | chunk position along Z-axis |
|
inlinenoexcept |
Returns cluster chunk at specified array index. (It can be null).
| index | target chunk index inside array |
|
inlinenoexcept |
Returns cluster chunk at specified 3D position. (It can be null).
| x | chunk position along X-axis |
| y | chunk position along Y-axis |
| z | chunk position along Z-axis |
|
inlinenoexcept |
Returns cluster chunk at specified array index. (It can be null).
| index | target chunk index inside array |
|
inlinenoexcept |
Returns cluster chunk at specified voxel 3D position relative to the central chunk.
| [in,out] | x | voxel position along X-axis (Relative to the central chunk) |
| [in,out] | y | voxel position along Y-axis (Relative to the central chunk) |
| [in,out] | z | voxel position along Z-axis (Relative to the central chunk) |
|
inlinenoexcept |
Returns cluster chunk at specified voxel 3D position relative to the central chunk.
| [in,out] | x | voxel position along X-axis (Relative to the central chunk) |
| [in,out] | y | voxel position along Y-axis (Relative to the central chunk) |
| [in,out] | z | voxel position along Z-axis (Relative to the central chunk) |
|
inlinenoexcept |
Returns cluster chunk at specified voxel 3D position relative to the central chunk.
| [in,out] | x | voxel position along X-axis (Relative to the central chunk) |
| [in,out] | y | voxel position along Y-axis (Relative to the central chunk) |
| [in,out] | z | voxel position along Z-axis (Relative to the central chunk) |
|
inlinenoexcept |
Returns voxel at specified 3D position relative to the central chunk.
| x | voxel position along X-axis (Relative to the central chunk) |
| y | voxel position along Y-axis (Relative to the central chunk) |
| z | voxel position along Z-axis (Relative to the central chunk) |
| nullVoxel | voxel ID returned if chunk instance is null |
|
inlinenoexcept |
Sets voxel at specified 3D position relative to the central chunk.
| x | voxel position along X-axis |
| y | voxel position along Y-axis |
| z | voxel position along Z-axis |
| voxel | target voxel ID |
|
inlinenoexcept |
Returns voxel at specified 3D position relative to the central chunk.
| x | voxel position along X-axis (Relative to the central chunk) | |
| y | voxel position along Y-axis (Relative to the central chunk) | |
| z | voxel position along Z-axis (Relative to the central chunk) | |
| [out] | voxel | target voxel ID on success |
|
inlinenoexcept |
Sets voxel at specified 3D position relative to the central chunk.
| x | voxel position along X-axis |
| y | voxel position along Y-axis |
| z | voxel position along Z-axis |
| voxel | target voxel ID |
|
inlinenoexcept |
Returns voxel at specified 3D position relative to the central chunk.
| x | voxel position along X-axis (Relative to the central chunk) |
| y | voxel position along Y-axis (Relative to the central chunk) |
| z | voxel position along Z-axis (Relative to the central chunk) |
| nullVoxel | voxel ID returned if chunk instance is null |
|
staticconstexpr |
Cluster length in chunks.
|
staticconstexpr |
Cluster layer size in chunks. (length ^ 2)
|
staticconstexpr |
Cluster size in chunks. (length ^ 3)
Cluster 3D positions 3x3x3.