MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ MeshBuffer()

MayaFlux::Buffers::MeshBuffer::MeshBuffer ( Kakshya::MeshData  data)
explicit

Construct from an owning MeshData.

The VKBuffer base is sized to vertex_bytes. MeshProcessor allocates the index buffer separately on on_attach.

Parameters
dataLoaded or generated mesh. Must be valid (is_valid() == true).

Definition at line 15 of file MeshBuffer.cpp.

16 : VKBuffer(
17 [&data]() -> size_t {
18 const auto* vb = std::get_if<std::vector<uint8_t>>(
19 &data.vertex_variant);
20 return vb ? vb->size() : 0;
21 }(),
24 , m_mesh_data(std::move(data))
25{
26 if (!m_mesh_data.is_valid()) {
28 "MeshBuffer constructed with invalid MeshData — "
29 "GPU upload will be skipped until valid data is provided");
30 }
31
32 RenderConfig defaults;
33 defaults.vertex_shader = "triangle.vert.spv";
36
38
40 "MeshBuffer: {} vertices, {} indices ({} faces), stride {} bytes",
45}
#define MF_INFO(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
uint32_t get_index_count() const noexcept
Kakshya::MeshData m_mesh_data
Portal::Graphics::RenderConfig RenderConfig
Definition VKBuffer.hpp:69
void set_needs_depth_attachment(bool needs)
Mark this buffer as requiring depth testing when rendered.
Definition VKBuffer.hpp:569
void set_default_render_config(const RenderConfig &config)
Called by derived classes to set their context-specific defaults.
Definition VKBuffer.hpp:597
@ Init
Engine/subsystem initialization.
@ Buffers
Buffers, Managers, processors and processing chains.
uint32_t vertex_count() const noexcept
Number of vertices derived from vertex byte count and layout stride.
Definition MeshData.hpp:78
bool is_valid() const noexcept
True when both variants are non-empty and layout stride is set.
Definition MeshData.hpp:65
uint32_t face_count() const noexcept
Number of triangles (index count / 3).
Definition MeshData.hpp:93
uint32_t stride_bytes
Total bytes per vertex (stride in Vulkan terms) e.g., 3 floats (position) + 3 floats (normal) = 24 by...