Toast Engine
Loading...
Searching...
No Matches
surface.hpp File Reference
#include "brick.hpp"
#include "voxel_constants.hpp"
#include "voxel_volume.hpp"
#include <bit>
#include <cstdint>
#include <glm/glm.hpp>
#include <span>
#include <toast/export.hpp>
#include <unordered_map>
#include <vector>
Include dependency graph for surface.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  voxel::SurfaceVoxel
class  voxel::VolumeSurface
 Keyed by brick slot not pool id since uniform bricks have no pool id and shared bricks differ per instance. More...

Enumerations

enum class  VoxelClass : uint8_t {
  empty = 0 , inside = 1 , face = 2 , edge = 3 ,
  corner = 4
}

Functions

auto voxel::normalIndexOf (glm::ivec3 direction) noexcept -> uint8_t
auto voxel::normalDirection (uint8_t index) noexcept -> glm::ivec3
constexpr auto voxel::packClassification (VoxelClass type, uint8_t normal) noexcept -> uint8_t
 Class in the low three bits and normal index in the high five.
constexpr auto voxel::classOf (uint8_t classification) noexcept -> VoxelClass
constexpr auto voxel::normalOf (uint8_t classification) noexcept -> uint8_t
auto voxel::classifyFromNeighbours (bool solid_neg_x, bool solid_pos_x, bool solid_neg_y, bool solid_pos_y, bool solid_neg_z, bool solid_pos_z) noexcept -> uint8_t
 Exposed faces that cancel (one voxel thick walls) promote to corner.
constexpr auto voxel::faceBit (int axis, bool positive) noexcept -> uint8_t
 One bit per face in the order neg x pos x neg y pos y neg z pos z.
constexpr auto voxel::exposureMask (bool solid_neg_x, bool solid_pos_x, bool solid_neg_y, bool solid_pos_y, bool solid_neg_z, bool solid_pos_z) noexcept -> uint8_t
 A set bit is a face with an empty neighbour behind it.
void voxel::buildBrickSurfaceInto (const BrickOccupancy &brick, const BrickNeighbourhood &neighbours, std::vector< SurfaceVoxel > &out)
auto voxel::buildBrickSurface (const BrickOccupancy &brick, const BrickNeighbourhood &neighbours) -> std::vector< SurfaceVoxel >

Variables

constexpr uint8_t voxel::k_normal_direction_count = 26
constexpr uint8_t voxel::k_normal_undefined = 26
constexpr uint8_t voxel::k_all_faces_exposed = 0x3F

Detailed Description

Author
dario
Date
10/09/2026