Files
Z3D/include/assets/data/mesh_data.hpp

54 lines
1.9 KiB
C++

#pragma once
#include <array>
#include <vector>
#include "util/uix.hpp"
#include "assets/components/mesh_vertex_components.hpp"
#include "generic/vertex_array_data.hpp"
#include "assets/data_stores/material_store.hpp"
namespace assets
{
class mesh_data : public vertex_array_data<
mesh_vertex_components::flags,
mesh_vertex_components::position,
mesh_vertex_components::normal,
mesh_vertex_components::tex_coord,
mesh_vertex_components::color,
mesh_vertex_components::reflectance
> {
public:
using index_type = ztu::u32;
using triangle_type = std::array<index_type, 3>;
[[nodiscard]] inline std::vector<mesh_vertex_components::position>& positions();
[[nodiscard]] inline std::vector<mesh_vertex_components::normal>& normals();
[[nodiscard]] inline std::vector<mesh_vertex_components::tex_coord>& tex_coords();
[[nodiscard]] inline std::vector<mesh_vertex_components::color>& colors();
[[nodiscard]] inline std::vector<mesh_vertex_components::reflectance>& reflectances();
[[nodiscard]] inline std::vector<triangle_type>& triangles();
[[nodiscard]] inline auto& material_id();
[[nodiscard]] inline const std::vector<mesh_vertex_components::position>& positions() const;
[[nodiscard]] inline const std::vector<mesh_vertex_components::normal>& normals() const;
[[nodiscard]] inline const std::vector<mesh_vertex_components::tex_coord>& tex_coords() const;
[[nodiscard]] inline const std::vector<mesh_vertex_components::color>& colors() const;
[[nodiscard]] inline const std::vector<mesh_vertex_components::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{};
material_store::id_type m_material_id{};
};
}
#define INCLUDE_DYNAMIC_MESH_DATA_IMPLEMENTATION
#include "assets/data/mesh_data.ipp"
#undef INCLUDE_DYNAMIC_MESH_DATA_IMPLEMENTATION