Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
voxel_volume.hpp
Go to the documentation of this file.
1
7
8
#pragma once
9
#include "
voxel_piece.hpp
"
10
11
namespace
toast {
12
17
class
[[ToastNode, Hidden, Interface]] TOAST_API
VoxelVolume
:
public
VoxelPiece
{
18
public
:
20
[[nodiscard,
Reflect
]]
21
auto
getId
()
const
-> int;
22
24
[[
Reflect
]]
25
void
setId
(
int
value);
26
28
[[
Reflect
]]
29
void
setSize
(glm::vec3 value);
30
32
[[nodiscard,
Reflect
]]
33
auto
getMode
()
const
->
voxel::WriteMode
;
34
35
[[
Reflect
]]
36
void
setMode(
voxel::WriteMode
value);
37
39
[[nodiscard,
Reflect
]]
40
auto
getMatchId
()
const
-> int;
41
42
[[
Reflect
]]
43
void
setMatchId(
int
value);
44
45
// Backend
46
47
[[nodiscard]]
48
auto
sizeVoxels()
const
noexcept
-> glm::ivec3;
49
50
void
setSizeVoxels(glm::ivec3 size);
51
52
[[nodiscard]]
53
auto
resizable
() const noexcept ->
bool
override
{
54
return
true
;
55
}
56
57
[[nodiscard]]
58
auto
writeMode() const noexcept -> voxel::WriteMode
override
{
59
return
mode;
60
}
61
62
[[nodiscard]]
63
auto
matchId() const noexcept -> uint8_t override;
64
65
protected:
66
void
init();
67
68
auto prepareGrid() -> std::unique_ptr<voxel::Volume> override;
69
void
finishGrid(voxel::Volume& grid) override;
70
auto pieceSize() -> glm::ivec3 override;
71
void
onReflectedFieldChanged(std::string_view field_name) override;
72
void
sizeChanged();
// redraws only when the size changed fr
73
74
glm::ivec3 m_sized_for {0};
75
76
[[Reflect, Name(
"Size"
), Unit(
"voxels"
)]]
77
glm::vec3 size = glm::vec3(10.0f);
78
80
[[Reflect, Name(
"Color"
)]]
81
int
id
= 1;
82
83
[[
Reflect
, Name(
"Fill Mode"
), Enum(
"Replace"
,
"Empty Only"
,
"Solid Only"
,
"Match"
)]]
84
voxel::WriteMode
mode =
voxel::WriteMode::replace
;
85
87
[[
Reflect
, Name(
"Match Color"
)]]
88
int
match_id
= 0;
89
};
90
91
}
toast::Reflect
Definition
reflect.hpp:244
toast::VoxelPiece
Definition
voxel_piece.hpp:41
toast::VoxelVolume
Definition
voxel_volume.hpp:17
toast::VoxelVolume::getMatchId
auto getMatchId() const -> int
Definition
voxel_volume.cpp:119
toast::VoxelVolume::match_id
int match_id
Definition
voxel_volume.hpp:88
toast::VoxelVolume::getMode
auto getMode() const -> voxel::WriteMode
Definition
voxel_volume.cpp:108
toast::VoxelVolume::setSize
void setSize(glm::vec3 value)
Definition
voxel_volume.cpp:104
toast::VoxelVolume::getId
auto getId() const -> int
Definition
voxel_volume.cpp:19
toast::VoxelVolume::resizable
auto resizable() const noexcept -> bool override
Definition
voxel_volume.hpp:53
toast::VoxelVolume::setId
void setId(int value)
Definition
voxel_volume.cpp:97
voxel::WriteMode
WriteMode
Which voxels we should override.
Definition
voxel_edit.hpp:26
voxel::WriteMode::replace
@ replace
Everything.
Definition
voxel_edit.hpp:27
voxel_piece.hpp
Base of everything a ProceduralVoxel builds itself from.
engine
src
toast
voxel
nodes
voxel_volume.hpp
Generated by
1.17.0