Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
fragment_extraction.hpp
Go to the documentation of this file.
1
6
7
#pragma once
8
9
#include "
component_classification.hpp
"
10
11
#include <array>
12
#include <glm/glm.hpp>
13
#include <optional>
14
#include <
toast/voxel/mass_accumulator.hpp
>
15
#include <
toast/voxel/palette.hpp
>
16
#include <
toast/voxel/voxel_volume.hpp
>
17
18
namespace
physics {
19
20
using
DensityTable = std::array<uint32_t, voxel::k_palette_size>;
21
22
struct
RemovedVoxels
{
24
voxel::MassMoments
moments
;
25
uint32_t voxels = 0;
26
};
27
28
struct
ExtractedFragment
{
29
voxel::Volume
volume;
30
glm::ivec3 offset;
31
33
voxel::MassMoments
moments
;
34
uint32_t voxels = 0;
35
};
36
38
[[nodiscard]]
39
auto
extractFragmentVolume(
voxel::Volume
& source,
const
DetachedComponent
& component,
const
DensityTable& density)
40
-> std::optional<ExtractedFragment>;
41
42
void
restoreFragment(
voxel::Volume
& source,
voxel::Volume
& fragment, glm::ivec3 offset);
43
44
auto
discardComponent(
voxel::Volume
& source,
const
DetachedComponent
& component,
const
DensityTable& density) ->
RemovedVoxels
;
45
46
}
voxel::Volume
Definition
voxel_volume.hpp:21
component_classification.hpp
TODO: Brief description of the file's purpose.
mass_accumulator.hpp
palette.hpp
physics::DetachedComponent
Definition
component_classification.hpp:26
physics::ExtractedFragment
Definition
fragment_extraction.hpp:28
physics::ExtractedFragment::moments
voxel::MassMoments moments
In fragment voxel coordinates.
Definition
fragment_extraction.hpp:33
physics::RemovedVoxels
Definition
fragment_extraction.hpp:22
physics::RemovedVoxels::moments
voxel::MassMoments moments
In source voxel coordinates.
Definition
fragment_extraction.hpp:24
voxel::MassMoments
Definition
mass_accumulator.hpp:18
voxel_volume.hpp
engine
src
toast
physics
fragment_extraction.hpp
Generated by
1.17.0