Toast Engine
Loading...
Searching...
No Matches
voxel::Volume Class Reference

Classes

struct  VoxelWrite
struct  WritableBrick

Public Member Functions

 Volume (BrickPool &pool, glm::uvec3 brick_dims)
 Volume (const Volume &)=delete
auto operator= (const Volume &) -> Volume &=delete
 Volume (Volume &&other) noexcept
auto operator= (Volume &&other) noexcept -> Volume &
auto brickDims () const noexcept -> glm::uvec3
auto voxelDims () const noexcept -> glm::uvec3
auto brickCount () const noexcept -> uint32_t
auto containsBrick (glm::ivec3 brick) const noexcept -> bool
auto containsVoxel (glm::ivec3 voxel) const noexcept -> bool
auto entryAt (glm::ivec3 brick) const noexcept -> BrickEntry
auto materialAt (glm::ivec3 voxel) const noexcept -> uint8_t
auto isSolidAt (glm::ivec3 voxel) const noexcept -> bool
auto setVoxel (glm::ivec3 voxel, uint8_t material) -> VoxelWrite
void setBrickUniform (glm::ivec3 brick, uint8_t material)
auto tryCollapseUniform (glm::ivec3 brick) -> bool
auto setBrickMaterial (glm::ivec3 brick, std::span< const uint8_t, k_brick_material_bytes > material) -> bool
auto takeBrick (glm::ivec3 brick) -> BrickEntry
 Caller must adopt or free a pooled entry.
void adoptBrick (glm::ivec3 brick, BrickEntry entry)
 Slot must be empty and a pooled entry must be owned.
auto clearVoxels (glm::ivec3 brick, const BrickOccupancy &mask) -> bool
auto copyBrickFrom (glm::ivec3 brick, const Volume &source, glm::ivec3 source_brick) -> bool
auto beginBrickWrite (glm::ivec3 brick) -> std::optional< WritableBrick >
void finishBrickWrite (glm::ivec3 brick, bool changed)
auto occupancyPointer (glm::ivec3 brick) const noexcept -> const BrickOccupancy *
 Null when the brick holds nothing.
auto neighbourhoodOf (glm::ivec3 brick) const noexcept -> BrickNeighbourhood
auto solidVoxelCount () const -> uint32_t
auto ownedBrickCount () const -> uint32_t
auto sharedBrickCount () const -> uint32_t
auto revision () const noexcept -> uint32_t
 Bumped by writes that change a voxel and by a collapse since that changes the packed form.
auto pool () const noexcept -> BrickPool *
auto id () const noexcept -> uint64_t
 Unique to this content so a replaced volume never matches the id of the one before it.
auto dirtyBricksSince (uint32_t revision) const noexcept -> std::optional< std::span< const uint32_t > >
 Nullopt once the history from revision was discarded.
auto brickAtIndex (uint32_t index) const noexcept -> glm::ivec3
void discardDirty () const noexcept
 Forgets the history up to now and only the renderer reads it.

Static Public Member Functions

static auto instanceOf (const Volume &source) -> Volume
 Shares every brick with source until written.
static auto adoptResized (Volume &source, glm::ivec3 brick_offset, glm::uvec3 brick_dims) -> Volume

Member Function Documentation

◆ clearVoxels()

auto voxel::Volume::clearVoxels ( glm::ivec3 brick,
const BrickOccupancy & mask ) -> bool
Returns
false with nothing changed when the pool has no brick to copy into
Here is the caller graph for this function:

◆ copyBrickFrom()

auto voxel::Volume::copyBrickFrom ( glm::ivec3 brick,
const Volume & source,
glm::ivec3 source_brick ) -> bool

Makes brick hold what source_brick of source holds

Returns
true when the brick changed
Here is the caller graph for this function:

◆ setBrickMaterial()

auto voxel::Volume::setBrickMaterial ( glm::ivec3 brick,
std::span< const uint8_t, k_brick_material_bytes > material ) -> bool
Returns
false outside the volume or when the pool is exhausted
Here is the caller graph for this function:

The documentation for this class was generated from the following files:
  • engine/src/toast/voxel/voxel_volume.hpp
  • engine/src/toast/voxel/voxel_volume.cpp