Files
Z3D/include/rendering/batches/point_cloud_batch.hpp
2024-12-22 16:58:40 +01:00

47 lines
1.1 KiB
C++

#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