Files
Z3D/include/opengl/data/point_cloud_data.hpp

55 lines
1.3 KiB
C++

#pragma once
#include "util/uix.hpp"
#include <span>
#include <system_error>
#include "GL/glew.h"
#include "opengl/handles/point_cloud_handle.hpp"
#include "assets/components/point_cloud_vertex_components.hpp"
namespace zgl {
struct point_cloud_data {
private:
point_cloud_data(
GLuint vertex_buffer_id,
GLuint vao_id,
GLsizei point_count
);
public:
point_cloud_data() = default;
[[nodiscard]] static std::error_code build_from(
std::span<const std::uint8_t> point_buffer,
std::span<const GLenum> component_types,
std::span<const GLint> component_lengths,
GLsizei stride,
point_cloud_data& data
);
point_cloud_data(const point_cloud_data& other) = delete;
point_cloud_data& operator=(const point_cloud_data& other) = delete;
point_cloud_data(point_cloud_data&& other) noexcept;
point_cloud_data& operator=(point_cloud_data&& other) noexcept;
~point_cloud_data();
[[nodiscard]] point_cloud_handle handle() const;
[[nodiscard]] assets::point_cloud_vertex_components::flags components() const;
private:
point_cloud_handle m_handle{};
GLuint m_vertex_vbo_id{ 0 };
point_cloud_vertex_components::flags m_component_types{
point_cloud_vertex_components::flags::none
};
};
}
#define INCLUDE_POINT_CLOUD_DATA_IMPLEMENTATION
#include "opengl/data/point_cloud_data.ipp"
#undef INCLUDE_POINT_CLOUD_DATA_IMPLEMENTATION