MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MeshSlot.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace MayaFlux::Core {
6class VKImage;
7}
8
10
11/**
12 * @struct MeshSlot
13 * @brief Named, independently transformable mesh unit within a MeshNetwork.
14 *
15 * Each slot owns a MeshWriterNode holding its CPU-side geometry and carries
16 * a local-space transform. Parent indices form a DAG; MeshNetwork resolves
17 * topological order so parents are always processed before children.
18 *
19 * World transform composes as: world = parent_world * local.
20 *
21 * slot.dirty signals the buffer layer that slot-level configuration changed
22 * (transform, texture binding, parent reassignment) independently of whether
23 * the node's vertex data changed. The processor checks both:
24 * slot.dirty || slot.node->needs_gpu_update()
25 *
26 * diffuse_texture is optional. When set, MeshNetworkBuffer binds it to the
27 * shader's diffuse slot for this slot's draw range. Slots sharing the same
28 * texture share one descriptor. Slots with distinct textures require the
29 * texture array path (deferred).
30 */
31struct MeshSlot {
32 /// @brief Position of this slot in MeshNetwork::m_slots. Stable after insertion.
33 uint32_t index {};
34
35 /// @brief Logical name. Used for lookup and logging only.
36 std::string name;
37
38 /// @brief Geometry node for this slot.
39 std::shared_ptr<GpuSync::MeshWriterNode> node;
40
41 /// @brief Local-space transform relative to parent (or world if root).
42 glm::mat4 local_transform { 1.0F };
43
44 /// @brief World-space transform, recomputed each cycle from the DAG.
45 glm::mat4 world_transform { 1.0F };
46
47 /// @brief Index of the parent slot, or nullopt for a root slot.
48 std::optional<uint32_t> parent_index;
49
50 /// @brief Indices of child slots. Populated by MeshNetwork::add_slot().
51 std::vector<uint32_t> child_indices;
52
53 /// @brief Set when local_transform or slot config changes since last upload.
54 bool dirty { true };
55
56 /// @brief Optional diffuse texture. Null means untextured for this slot.
57 std::shared_ptr<Core::VKImage> diffuse_texture;
58};
59
60} // namespace MayaFlux::Nodes::Network
std::string name
Logical name. Used for lookup and logging only.
Definition MeshSlot.hpp:36
bool dirty
Set when local_transform or slot config changes since last upload.
Definition MeshSlot.hpp:54
std::shared_ptr< GpuSync::MeshWriterNode > node
Geometry node for this slot.
Definition MeshSlot.hpp:39
std::vector< uint32_t > child_indices
Indices of child slots. Populated by MeshNetwork::add_slot().
Definition MeshSlot.hpp:51
std::shared_ptr< Core::VKImage > diffuse_texture
Optional diffuse texture. Null means untextured for this slot.
Definition MeshSlot.hpp:57
glm::mat4 local_transform
Local-space transform relative to parent (or world if root).
Definition MeshSlot.hpp:42
uint32_t index
Position of this slot in MeshNetwork::m_slots. Stable after insertion.
Definition MeshSlot.hpp:33
glm::mat4 world_transform
World-space transform, recomputed each cycle from the DAG.
Definition MeshSlot.hpp:45
std::optional< uint32_t > parent_index
Index of the parent slot, or nullopt for a root slot.
Definition MeshSlot.hpp:48
Named, independently transformable mesh unit within a MeshNetwork.
Definition MeshSlot.hpp:31