Toast Engine
Loading...
Searching...
No Matches
palette.hpp File Reference
#include "voxel_constants.hpp"
#include <array>
#include <cstdint>
#include <toast/physics/fracture_profile.hpp>
#include <toast/physics/hardness.hpp>
#include <toast/physics/material_defaults.hpp>
#include <vector>
Include dependency graph for palette.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  voxel::PaletteEntry
 16 bytes and the offsets are a shader contract More...
struct  voxel::Palette
 Entry 0 is the empty voxel and must stay all zero. More...
struct  voxel::PhysicalMaterial
struct  voxel::MaterialLibrary
struct  voxel::TableProblem
 index is a material index a palette index or a count More...

Enumerations

enum class  voxel::TableIssue : uint8_t {
  library_empty , library_too_large , zero_density , out_of_range ,
  reserved_slot_used , unknown_material
}

Functions

auto voxel::defaultPalette () -> const Palette &
auto voxel::emissiveIntensity (const Palette &palette, uint8_t index) noexcept -> float
auto voxel::resolveMaterialIndex (const Palette &palette, const MaterialLibrary &library, uint8_t palette_index) noexcept -> uint32_t
 The library must not be empty.
auto voxel::densityTable (const Palette &palette, const MaterialLibrary &library) -> std::array< uint32_t, k_palette_size >
auto voxel::massPerVoxel (const PhysicalMaterial &material, float voxel_size=k_voxel_size) noexcept -> float
auto voxel::validateLibrary (const MaterialLibrary &library) -> std::vector< TableProblem >
auto voxel::validatePalette (const Palette &palette, const MaterialLibrary &library) -> std::vector< TableProblem >

Variables

constexpr uint32_t voxel::k_max_physical_materials = 256
constexpr uint8_t voxel::k_default_material = 0
constexpr uint8_t voxel::k_entry_transparent = 1u << 0
constexpr uint8_t voxel::k_material_indestructible = 1u << 0
constexpr uint8_t voxel::k_material_passable = 1u << 1
 "Passable" so the zero default is solid
constexpr uint8_t voxel::k_material_flammable = 1u << 2

Detailed Description

Author
dario
Date
11/09/2026

Enumeration Type Documentation

◆ TableIssue

enum class voxel::TableIssue : uint8_t
strong
Enumerator
library_too_large 

index is the count