Toast Engine
Loading...
Searching...
No Matches
procedural_voxel.hpp File Reference

Voxel shapes built from an ordered list of volumes. More...

#include "voxel_bucket.hpp"
#include "voxel_group.hpp"
#include "voxel_node.hpp"
#include "voxel_piece.hpp"
#include "voxel_volume.hpp"
#include <cstdint>
#include <future>
#include <memory>
#include <optional>
#include <span>
#include <toast/voxel/stamp.hpp>
#include <toast/voxel/voxel_edit.hpp>
#include <unordered_map>
#include <vector>
Include dependency graph for procedural_voxel.hpp:

Go to the source code of this file.

Classes

class  toast::ProceduralVoxel
struct  toast::ProceduralVoxel::PieceLayout
struct  toast::ProceduralVoxel::Composed

Functions

auto toast::insideProceduralVoxel (Node &node) -> bool
auto toast::owningProceduralVoxel (Node &node) -> ProceduralVoxel *
auto toast::parentToShape (Node &node) -> glm::mat4
auto toast::piecePlacement (VoxelPiece &piece) -> voxel::LatticePlacement
auto toast::pieceBounds (VoxelPiece &piece) -> voxel::EditBounds
void toast::placePiece (VoxelPiece &piece, const voxel::LatticeOrientation &orientation, glm::ivec3 min, glm::ivec3 max)
auto toast::planeToShape (glm::vec4 plane, const voxel::LatticePlacement &placement) noexcept -> glm::vec4
auto toast::planeToPiece (glm::vec4 plane, const voxel::LatticePlacement &placement) noexcept -> glm::vec4

Detailed Description

Voxel shapes built from an ordered list of volumes.

Author
Xein
Date
26 Sep 2026

A ProceduralVoxel rebuilds its shape from its children, top to bottom Groups are walked depth first and disabled children are skipped

Every piece draws into its own grid with its first script's editShape The grid is cached so moving, rotating or reordering pieces never runs a script again

Function Documentation

◆ insideProceduralVoxel()

TOAST_API auto toast::insideProceduralVoxel ( Node & node) -> bool
nodiscard
Returns
true when node sits in a ProceduralVoxel, through any groups

◆ owningProceduralVoxel()

TOAST_API auto toast::owningProceduralVoxel ( Node & node) -> ProceduralVoxel *
nodiscard

The ProceduralVoxel node is built into, through any groups, null when there is none

◆ parentToShape()

TOAST_API auto toast::parentToShape ( Node & node) -> glm::mat4
nodiscard

The transform from node's parent to its ProceduralVoxel, in metres

◆ pieceBounds()

TOAST_API auto toast::pieceBounds ( VoxelPiece & piece) -> voxel::EditBounds
nodiscard

The box the piece covers on the shape, its size and not the brick rounded grid

◆ piecePlacement()

TOAST_API auto toast::piecePlacement ( VoxelPiece & piece) -> voxel::LatticePlacement
nodiscard

Where the piece grid lands on the shape, snapped to the lattice

◆ placePiece()

TOAST_API void toast::placePiece ( VoxelPiece & piece,
const voxel::LatticeOrientation & orientation,
glm::ivec3 min,
glm::ivec3 max )

Moves and resizes piece so it covers min..max with orientation

Note
A VoxelMesh cannot resize so it keeps its size with its corner at min

◆ planeToPiece()

TOAST_API auto toast::planeToPiece ( glm::vec4 plane,
const voxel::LatticePlacement & placement ) -> glm::vec4
nodiscardnoexcept

A clip plane from shape voxels to piece voxels

◆ planeToShape()

TOAST_API auto toast::planeToShape ( glm::vec4 plane,
const voxel::LatticePlacement & placement ) -> glm::vec4
nodiscardnoexcept

A clip plane from piece voxels to shape voxels