47 lines
1.9 KiB
C++
47 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <vector>
|
|
|
|
#include "util/uix.hpp"
|
|
#include "assets/components/mesh_vertex_components.hpp"
|
|
#include "assets/dynamic_read_buffers/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]] std::vector<components::mesh_vertex::position>& positions();
|
|
[[nodiscard]] std::vector<components::mesh_vertex::normal>& normals();
|
|
[[nodiscard]] std::vector<components::mesh_vertex::tex_coord>& tex_coords();
|
|
[[nodiscard]] std::vector<components::mesh_vertex::color>& colors();
|
|
[[nodiscard]] std::vector<components::mesh_vertex::reflectance>& reflectances();
|
|
[[nodiscard]] std::vector<triangle_type>& triangles();
|
|
[[nodiscard]] auto& material_id();
|
|
|
|
[[nodiscard]] const std::vector<components::mesh_vertex::position>& positions() const;
|
|
[[nodiscard]] const std::vector<components::mesh_vertex::normal>& normals() const;
|
|
[[nodiscard]] const std::vector<components::mesh_vertex::tex_coord>& tex_coords() const;
|
|
[[nodiscard]] const std::vector<components::mesh_vertex::color>& colors() const;
|
|
[[nodiscard]] const std::vector<components::mesh_vertex::reflectance>& reflectances() const;
|
|
[[nodiscard]] const std::vector<triangle_type>& triangles() const;
|
|
[[nodiscard]] const auto& material_id() const;
|
|
|
|
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
|