56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <span>
|
|
#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<aabb> bounding_box(id_type id);
|
|
|
|
inline bool remove(id_type id);
|
|
|
|
[[nodiscard]] inline std::span<const zgl::mesh_handle> meshes() const;
|
|
|
|
[[nodiscard]] inline std::span<const aabb> bounding_boxes() const;
|
|
|
|
[[nodiscard]] inline std::span<const zgl::model_matrix_handle> transforms() const;
|
|
|
|
[[nodiscard]] inline std::span<const zgl::texture_handle> textures() const;
|
|
|
|
[[nodiscard]] inline std::span<const zgl::surface_properties_handle> surface_properties() const;
|
|
|
|
[[nodiscard]] inline std::span<const zgl::alpha_handle> alphas() const;
|
|
|
|
private:
|
|
std::vector<zgl::mesh_handle> m_meshes{};
|
|
std::vector<aabb> m_bounding_boxes{};
|
|
std::vector<zgl::model_matrix_handle> m_transforms{};
|
|
std::vector<zgl::texture_handle> m_textures{};
|
|
std::vector<zgl::surface_properties_handle> m_surface_properties{};
|
|
std::vector<zgl::alpha_handle> m_alphas{};
|
|
|
|
std::vector<id_type> 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
|