Voxel 3D container. (array). More...
#include <chunk.hpp>
Public Types | |
| typedef V | Voxel |
| Chunk voxel ID type. | |
Public Member Functions | |
| Chunk3D () noexcept=default | |
| Creates a new uninitialized chunk. | |
| Chunk3D (Voxel voxel) noexcept | |
| Creates a new initialized chunk. | |
| Voxel * | getVoxels () noexcept |
| Returns chunk voxel array. | |
| const Voxel * | getVoxels () const noexcept |
| Returns constant chunk voxel array. | |
| Voxel | get (uint8_t x, uint8_t y, uint8_t z) const noexcept |
| Returns chunk voxel at specified 3D position. | |
| void | set (uint8_t x, uint8_t y, uint8_t z, Voxel voxel) noexcept |
| Sets chunk voxel at specified 3D position. | |
| Voxel | get (uint32_t index) const noexcept |
| Returns chunk voxel at specified array index. | |
| void | set (uint32_t index, Voxel voxel) noexcept |
| Sets chunk voxel at specified array index. | |
| bool | tryGet (uint8_t x, uint8_t y, uint8_t z, Voxel &voxel) const noexcept |
| Returns chunk voxel at specified 3D position if inside chunk bounds. | |
| bool | trySet (uint8_t x, uint8_t y, uint8_t z, Voxel voxel) noexcept |
| Sets chunk voxel at specified 3D position if inside chunk bounds. | |
| bool | tryGet (uint32_t index, Voxel &voxel) const noexcept |
| Returns chunk voxel at specified array index if inside array bounds. | |
| bool | trySet (uint32_t index, Voxel voxel) noexcept |
| Sets chunk voxel at specified array index if inside array bounds. | |
| Voxel | unsafeGet (uint8_t x, uint8_t y, uint8_t z) const noexcept |
| Returns chunk voxel at specified 3D position. | |
| void | unsafeSet (uint8_t x, uint8_t y, uint8_t z, Voxel voxel) noexcept |
| Sets chunk voxel at specified 3D position. | |
| Voxel | unsafeGet (uint32_t index) const noexcept |
| Returns chunk voxel at specified array index. | |
| void | unsafeSet (uint32_t index, Voxel voxel) noexcept |
| Sets chunk voxel at specified array index. | |
| void | clear () noexcept |
| Fills chunk with zeros. | |
| void | fill (Voxel voxel) noexcept |
| Fills chunk with specified voxel ID. | |
| void | copy (const Voxel *voxels) noexcept |
| Copies voxels from specified array to this chunk. | |
| void | copy (const Voxel *otherVoxels, uint8_t otherLength, uint16_t otherLayerSize, uint8_t countX, uint8_t countY, uint8_t countZ, uint8_t otherOffsetX=0, uint8_t otherOffsetY=0, uint8_t otherOffsetZ=0, uint8_t thisOffsetX=0, uint8_t thisOffsetY=0, uint8_t thisOffsetZ=0) noexcept |
| Copies voxels from specified array part to this chunk. | |
Static Public Member Functions | |
| static constexpr uint32_t | posToIndex (uint8_t x, uint8_t y, uint8_t z) noexcept |
| Calculates chunk voxel index from the 3D position. | |
| static constexpr void | indexToPos (uint32_t index, uint8_t &x, uint8_t &y, uint8_t &z) noexcept |
| Calculates chunk voxel 3D position from the index. | |
Protected Attributes | |
| Voxel | voxels [size] |
Voxel 3D container. (array).
| SX | chunk size in voxels along X-axis |
| SY | chunk size in voxels along Y-axis |
| SZ | chunk size in voxels along Z-axis |
| V | chunk voxel ID type |
|
defaultnoexcept |
Creates a new uninitialized chunk.
|
inlinenoexcept |
Creates a new initialized chunk.
| voxel | target voxel to fill chunk with |
|
inlinestaticconstexprnoexcept |
Calculates chunk voxel index from the 3D position.
| x | voxel position along X-axis |
| y | voxel position along Y-axis |
| z | voxel position along Z-axis |
|
inlinestaticconstexprnoexcept |
Calculates chunk voxel 3D position from the index.
| index | voxel index inside the chunk | |
| [out] | x | voxel position along X-axis |
| [out] | y | voxel position along Y-axis |
| [out] | z | voxel position along Z-axis |
|
inlinenoexcept |
Returns chunk voxel at specified 3D position.
| x | voxel position along X-axis |
| y | voxel position along Y-axis |
| z | voxel position along Z-axis |
|
inlinenoexcept |
Sets chunk voxel at specified 3D position.
| x | voxel position along X-axis |
| y | voxel position along Y-axis |
| z | voxel position along Z-axis |
| voxel | target voxel ID |
|
inlinenoexcept |
Returns chunk voxel at specified array index.
| index | target voxel index inside array |
|
inlinenoexcept |
Sets chunk voxel at specified array index.
| index | target voxel index inside array |
| voxel | target voxel ID |
|
inlinenoexcept |
Returns chunk voxel at specified 3D position if inside chunk bounds.
| x | voxel position along X-axis | |
| y | voxel position along Y-axis | |
| z | voxel position along Z-axis | |
| [out] | voxel | target voxel ID |
|
inlinenoexcept |
Sets chunk voxel at specified 3D position if inside chunk bounds.
| x | voxel position along X-axis |
| y | voxel position along Y-axis |
| z | voxel position along Z-axis |
| voxel | target voxel ID |
|
inlinenoexcept |
Returns chunk voxel at specified array index if inside array bounds.
| index | target voxel index inside array | |
| [out] | voxel | target voxel ID |
|
inlinenoexcept |
Sets chunk voxel at specified array index if inside array bounds.
| index | target voxel index inside array |
| voxel | target voxel ID |
|
inlinenoexcept |
Returns chunk voxel at specified 3D position.
| x | voxel position along X-axis |
| y | voxel position along Y-axis |
| z | voxel position along Z-axis |
|
inlinenoexcept |
Sets chunk voxel at specified 3D position.
| x | voxel position along X-axis |
| y | voxel position along Y-axis |
| z | voxel position along Z-axis |
| voxel | target voxel ID |
|
inlinenoexcept |
Returns chunk voxel at specified array index.
| index | target voxel index inside array |
|
inlinenoexcept |
Sets chunk voxel at specified array index.
| index | target voxel index inside array |
| voxel | target voxel ID |
|
inlinenoexcept |
Fills chunk with specified voxel ID.
| voxel | target voxel ID |
|
inlinenoexcept |
Copies voxels from specified array to this chunk.
| [in] | voxels | target voxel array |
|
inlinenoexcept |
Copies voxels from specified array part to this chunk.
| [in] | otherVoxels | target other voxel array |
| countX | voxel array part size along X-axis | |
| countY | voxel array part size along Y-axis | |
| countZ | voxel array part size along Z-axis | |
| otherLength | other voxel array length along X-axis | |
| otherLayerSize | other voxel array layer size along X * Y | |
| otherOffsetX | other voxel array part offset along X-axis | |
| otherOffsetY | other voxel array part offset along Y-axis | |
| otherOffsetZ | other voxel array part offset along Z-axis | |
| thisOffsetX | this voxel array part offset along X-axis | |
| thisOffsetY | this voxel array part offset along Y-axis | |
| thisOffsetZ | this voxel array part offset along Z-axis |