Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
destruction_material.hpp
Go to the documentation of this file.
1
8
9
#pragma once
10
#include "fracture_pattern.hpp"
11
#include "
fracture_profile.hpp
"
12
13
#include <
toast/assets/data.hpp
>
14
#include <
toast/physics/hardness.hpp
>
15
16
namespace
assets {
17
18
class
TOAST_API DestructionMaterial :
public
Data {
19
public
:
20
explicit
DestructionMaterial(
const
toml::table& table,
Handle<Schema>
schema = {});
21
22
[[nodiscard]]
23
auto
type()
const
-> std::string_view
override
{
24
return
"destruction_material"
;
25
}
26
27
[[nodiscard]]
28
auto
get()
const
-> toml::table;
29
31
[[nodiscard]]
32
auto
density
()
const
noexcept
-> float;
33
35
[[nodiscard]]
36
auto
toughness
()
const
noexcept
-> float;
37
39
[[nodiscard]]
40
auto
hardness
()
const
noexcept
-> physics::Hardness;
41
42
[[nodiscard]]
43
auto
fracturePatterh()
const
noexcept
-> physics::FracturePattern;
44
45
[[nodiscard]]
46
auto
fractureProfile()
const
noexcept
->
physics::PackedFractureProfile
;
47
49
[[nodiscard]]
50
auto
structuralStrength
()
const
noexcept
-> float;
51
53
[[nodiscard]]
54
auto
destructible
()
const
noexcept
-> bool;
55
56
[[nodiscard]]
57
auto
flammable()
const
noexcept
-> bool;
58
59
[[nodiscard]]
60
auto
burnRate()
const
noexcept
-> float;
61
62
protected
:
63
void
onReloaded()
override
;
64
65
private
:
66
void
readFields();
67
68
float
m_density = 0.0f;
69
float
m_toughness = 0.0f;
70
physics::Hardness m_hardness = physics::Hardness::medium;
71
physics::FracturePattern m_fracture_pattern = physics::FracturePattern::brittle;
72
physics::FractureValues
m_fracture_values;
73
float
m_structural_strength = 0.0f;
74
bool
m_destructible =
true
;
75
bool
m_flammable =
false
;
76
float
m_burn_rate = 0.0f;
77
};
78
79
}
assets::DestructionMaterial::hardness
auto hardness() const noexcept -> physics::Hardness
Damage that breaks only softer tiers never breaks this material.
Definition
destruction_material.cpp:115
assets::DestructionMaterial::density
auto density() const noexcept -> float
kg/m3; drives voxel mass through massPerVoxel()
Definition
destruction_material.cpp:107
assets::DestructionMaterial::destructible
auto destructible() const noexcept -> bool
False means voxels of this material never break, whatever hits them.
Definition
destruction_material.cpp:131
assets::DestructionMaterial::structuralStrength
auto structuralStrength() const noexcept -> float
Pascals.
Definition
destruction_material.cpp:127
assets::DestructionMaterial::toughness
auto toughness() const noexcept -> float
kJ/m3 it takes to break the material
Definition
destruction_material.cpp:111
assets::Handle
Type-safe smart pointer for assets.
Definition
core_types.hpp:149
data.hpp
Typed data asset backed by schema-driven TOML.
fracture_profile.hpp
How a material breaks: how the energy of a hit is spent and how coarse its cracks are.
hardness.hpp
Tiers of how hard a material is to break.
physics::FractureValues
Definition
fracture_profile.hpp:17
physics::PackedFractureProfile
Definition
fracture_profile.hpp:49
engine
src
toast
physics
destruction_material.hpp
Generated by
1.17.0