Files
Z3D/include/assets/dynamic_read_buffers/dynamic_mesh_buffer.hpp

49 lines
2.0 KiB
C++

#pragma once
#include <array>
#include <vector>
#include "util/uix.hpp"
#include "assets/components/mesh_vertex_components.hpp"
#include "generic/dynamic_vertex_buffer.hpp"
#include "assets/dynamic_data_stores/dynamic_material_store.hpp"
class dynamic_mesh_buffer : public dynamic_vertex_buffer<
components::mesh_vertex::flags,
components::mesh_vertex::position,
components::mesh_vertex::normal,
components::mesh_vertex::tex_coord,
components::mesh_vertex::color,
components::mesh_vertex::reflectance
> {
public:
using index_type = ztu::u32;
using triangle_type = std::array<index_type, 3>;
[[nodiscard]] inline std::vector<components::mesh_vertex::position>& positions();
[[nodiscard]] inline std::vector<components::mesh_vertex::normal>& normals();
[[nodiscard]] inline std::vector<components::mesh_vertex::tex_coord>& tex_coords();
[[nodiscard]] inline std::vector<components::mesh_vertex::color>& colors();
[[nodiscard]] inline std::vector<components::mesh_vertex::reflectance>& reflectances();
[[nodiscard]] inline std::vector<triangle_type>& triangles();
[[nodiscard]] inline auto& material_id();
[[nodiscard]] inline const std::vector<components::mesh_vertex::position>& positions() const;
[[nodiscard]] inline const std::vector<components::mesh_vertex::normal>& normals() const;
[[nodiscard]] inline const std::vector<components::mesh_vertex::tex_coord>& tex_coords() const;
[[nodiscard]] inline const std::vector<components::mesh_vertex::color>& colors() const;
[[nodiscard]] inline const std::vector<components::mesh_vertex::reflectance>& reflectances() const;
[[nodiscard]] inline const std::vector<triangle_type>& triangles() const;
[[nodiscard]] inline const auto& material_id() const;
inline void clear();
private:
std::vector<triangle_type> m_triangles{};
dynamic_material_store::id_type m_material_id{};
};
#define INCLUDE_DYNAMIC_MESH_DATA_IMPLEMENTATION
#include "assets/dynamic_read_buffers/dynamic_mesh_buffer.ipp"
#undef INCLUDE_DYNAMIC_MESH_DATA_IMPLEMENTATION