80 [[nodiscard]] std::optional<Kakshya::MeshAccess>
access()
const
82 return m_mesh_data.access();
87 return m_mesh_data.vertex_count();
92 const auto* ib = std::get_if<std::vector<uint32_t>>(
93 &m_mesh_data.index_variant);
94 return ib ?
static_cast<uint32_t
>(ib->size()) : 0;
99 return m_mesh_data.face_count();
104 return m_mesh_data.layout;
107 [[nodiscard]]
const std::optional<Kakshya::RegionGroup>&
get_submeshes() const noexcept
109 return m_mesh_data.submeshes;
126 void set_vertex_data(std::span<const uint8_t> bytes);
135 void set_index_data(std::span<const uint32_t> indices);
148 return m_vertices_dirty.load(std::memory_order_acquire);
153 return m_indices_dirty.load(std::memory_order_acquire);
158 m_vertices_dirty.store(
false, std::memory_order_release);
163 m_indices_dirty.store(
false, std::memory_order_release);
172 return m_mesh_processor;
177 return m_render_processor;
187 void bind_diffuse_texture(
188 std::shared_ptr<Core::VKImage>
image,
189 std::string_view binding_name =
"diffuseTex");
195 [[nodiscard]] std::shared_ptr<Core::VKImage>
get_diffuse_texture() const noexcept {
return m_diffuse_texture; }
202 std::string m_diffuse_binding {
"diffuseTex" };
204 std::atomic<bool> m_vertices_dirty {
true };
205 std::atomic<bool> m_indices_dirty {
true };
uint32_t get_face_count() const noexcept
std::shared_ptr< RenderProcessor > get_render_processor() const override
Get a RenderProcessor suitable for rendering this buffer.
const Kakshya::VertexLayout & get_vertex_layout_ref() const noexcept
std::shared_ptr< RenderProcessor > m_render_processor
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.
void clear_indices_dirty() noexcept
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.