This commit is contained in:
ZY4N
2024-12-22 16:58:40 +01:00
parent 2704814de2
commit db8db8f9d7
161 changed files with 17102 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
#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

View File

@@ -0,0 +1,46 @@
#pragma once
#include <vector>
#include "opengl/handles/point_cloud_handle.hpp"
#include "opengl/handles/matrix_handles.hpp"
#include <span>
#include "geometry/aabb.hpp"
#include <optional>
class point_cloud_batch
{
public:
using id_type = ztu::u32;
point_cloud_batch() = default;
inline id_type add(
const zgl::point_cloud_handle& point_cloud,
const aabb& bounding_box,
const zgl::model_matrix_handle& transform
);
inline std::optional<aabb> bounding_box(id_type id);
inline bool remove(id_type id);
[[nodiscard]] inline std::span<const zgl::point_cloud_handle> point_clouds() const;
[[nodiscard]] inline std::span<const zgl::model_matrix_handle> transforms() const;
[[nodiscard]] inline std::span<const aabb> bounding_boxes() const;
private:
std::vector<zgl::point_cloud_handle> m_point_clouds{};
std::vector<zgl::model_matrix_handle> m_transforms{};
std::vector<aabb> m_bounding_boxes{};
std::vector<id_type> m_id_lookup{};
id_type m_next_id{ 0 };
};
#define INCLUDE_POINT_CLOUD_BATCH_IMPLEMENTATION
#include "rendering/batches/point_cloud_batch.ipp"
#undef INCLUDE_POINT_CLOUD_BATCH_IMPLEMENTATION