#pragma once #include "opengl/handles/mesh_handle.hpp" #include "util/uix.hpp" #include #include #include "assets/components/mesh_vertex_components.hpp" #include "GL/glew.h" namespace zgl { struct mesh_data { private: mesh_data( GLuint vertex_vbo_id, GLuint index_vbo_id, GLuint vao_id, ztu::u32 material_id, mesh_vertex_components::flags components, GLsizei index_count ); public: mesh_data() = default; [[nodiscard]] static std::error_code build_from( std::span vertex_buffer, std::span component_types, std::span component_lengths, GLsizei stride, std::span index_buffer, ztu::u32 material_id, mesh_vertex_components::flags components, mesh_data& data ); mesh_data(const mesh_data& other) = delete; mesh_data& operator=(const mesh_data& other) = delete; mesh_data(mesh_data&& other) noexcept; mesh_data& operator=(mesh_data&& other) noexcept; ~mesh_data(); [[nodiscard]] mesh_handle handle() const; [[nodiscard]] mesh_vertex_components::flags components() const; [[nodiscard]] ztu::u32 material_id() const; private: mesh_handle m_handle{}; GLuint m_vertex_vbo_id{ 0 }; GLuint m_index_vbo_id{ 0 }; ztu::u32 m_material_id{ 0 }; mesh_vertex_components::flags m_component_types{ mesh_vertex_components::flags::none }; }; } #define INCLUDE_MESH_DATA_IMPLEMENTATION #include "opengl/data/mesh_data.ipp" #undef INCLUDE_MESH_DATA_IMPLEMENTATION