#pragma once #include #include #include "opengl/handles/mesh_handle.hpp" #include "opengl/handles/matrix_handles.hpp" #include "opengl/handles/texture_handle.hpp" #include "opengl/handles/mesh_handle.hpp" #include "opengl/handles/material_handle.hpp" #include "geometry/aabb.hpp" class mesh_batch { public: using id_type = ztu::u32; inline id_type add( const zgl::mesh_handle& mesh, const aabb& bounding_box, const zgl::model_matrix_handle& transform, const zgl::material_handle& material ); inline std::optional bounding_box(id_type id); inline bool remove(id_type id); [[nodiscard]] inline std::span meshes() const; [[nodiscard]] inline std::span bounding_boxes() const; [[nodiscard]] inline std::span transforms() const; [[nodiscard]] inline std::span textures() const; [[nodiscard]] inline std::span surface_properties() const; [[nodiscard]] inline std::span alphas() const; private: std::vector m_meshes{}; std::vector m_bounding_boxes{}; std::vector m_transforms{}; std::vector m_textures{}; std::vector m_surface_properties{}; std::vector m_alphas{}; std::vector m_id_lookup{}; id_type m_next_mesh_id{ 0 }; }; #define INCLUDE_MESH_BATCH_IMPLEMENTATION #include "rendering/batches/mesh_batch.ipp" #undef INCLUDE_MESH_BATCH_IMPLEMENTATION