69 MeshBuffer(std::shared_ptr<Nodes::GpuSync::MeshWriterNode> node);
93 [[nodiscard]] std::optional<Kakshya::MeshAccess>
access()
const
95 return m_mesh_data.access();
112 return m_mesh_data.vertex_count();
117 const auto* ib = std::get_if<std::vector<uint32_t>>(
118 &m_mesh_data.index_variant);
119 return ib ?
static_cast<uint32_t
>(ib->size()) : 0;
124 return m_mesh_data.face_count();
129 return m_mesh_data.layout;
132 [[nodiscard]]
const std::optional<Kakshya::RegionGroup>&
get_submeshes() const noexcept
134 return m_mesh_data.submeshes;
137 [[nodiscard]] std::shared_ptr<Nodes::GpuSync::MeshWriterNode>
get_node()
const
156 void set_vertex_data(std::span<const uint8_t> bytes);
165 void set_index_data(std::span<const uint32_t>
indices);
178 return m_vertices_dirty.load(std::memory_order_acquire);
183 return m_indices_dirty.load(std::memory_order_acquire);
188 m_vertices_dirty.store(
false, std::memory_order_release);
193 m_indices_dirty.store(
false, std::memory_order_release);
202 return m_mesh_processor;
212 void bind_diffuse_texture(
213 std::shared_ptr<Core::VKImage>
image,
214 std::string_view binding_name =
"diffuseTex");
220 [[nodiscard]] std::shared_ptr<Core::VKImage>
get_diffuse_texture() const noexcept {
return m_diffuse_texture; }
226 std::shared_ptr<Nodes::GpuSync::MeshWriterNode>
m_node;
228 std::string m_diffuse_binding {
"diffuseTex" };
230 std::atomic<bool> m_vertices_dirty {
true };
231 std::atomic<bool> m_indices_dirty {
true };
std::vector< uint32_t > indices
uint32_t get_face_count() const noexcept
std::shared_ptr< Nodes::GpuSync::MeshWriterNode > get_node() const
const Kakshya::VertexLayout & get_vertex_layout_ref() const noexcept
std::shared_ptr< Core::VKImage > m_diffuse_texture
bool has_diffuse_texture() const noexcept
std::shared_ptr< Core::VKImage > get_diffuse_texture() const noexcept
~MeshBuffer() override=default
const std::optional< Kakshya::RegionGroup > & get_submeshes() const noexcept
std::optional< Kakshya::MeshAccess > access() const
Produce a non-owning MeshAccess view over the internal MeshData.
std::shared_ptr< Nodes::GpuSync::MeshWriterNode > m_node
void clear_indices_dirty() noexcept
const Kakshya::MeshData & get_mesh_data() const noexcept
Read-only access to the owning MeshData.
std::shared_ptr< MeshProcessor > m_mesh_processor
std::shared_ptr< MeshProcessor > get_mesh_processor() const
bool indices_dirty() const noexcept
bool vertices_dirty() const noexcept
uint32_t get_vertex_count() const noexcept
uint32_t get_index_count() const noexcept
void clear_vertices_dirty() noexcept
Kakshya::MeshData m_mesh_data
VKBuffer subclass that owns a MeshData and manages its GPU upload.
Default processor for MeshBuffer: handles CPU-to-GPU upload of vertex and index data with selective d...
Vulkan-backed buffer wrapper used in processing chains.
ProcessingToken
Bitfield enum defining processing characteristics and backend requirements for buffer operations.
Owning CPU-side representation of a loaded or generated mesh.
Complete description of vertex data layout in a buffer.
Unified rendering configuration for graphics buffers.