67 lines
1.3 KiB
C++
67 lines
1.3 KiB
C++
#ifndef INCLUDE_POINT_CLOUD_DATA_IMPLEMENTATION
|
|
# error Never include this file directly include 'point_cloud_data.hpp'
|
|
#endif
|
|
|
|
|
|
namespace zgl
|
|
{
|
|
inline point_cloud_data::point_cloud_data(
|
|
const GLuint vertex_vbo_id,
|
|
const GLuint vao_id,
|
|
const GLsizei point_count
|
|
) :
|
|
m_handle{
|
|
.vao_id = vao_id,
|
|
.point_count = point_count
|
|
},
|
|
m_vertex_vbo_id{ vertex_vbo_id } {}
|
|
|
|
inline point_cloud_data::point_cloud_data(point_cloud_data&& other) noexcept :
|
|
m_handle{ other.m_handle },
|
|
m_vertex_vbo_id{ other.m_vertex_vbo_id }
|
|
{
|
|
other.m_handle.vao_id = 0;
|
|
other.m_handle.point_count = 0;
|
|
other.m_vertex_vbo_id = 0;
|
|
}
|
|
|
|
inline point_cloud_data& point_cloud_data::operator=(point_cloud_data&& other) noexcept
|
|
{
|
|
if (&other != this)
|
|
{
|
|
this->~point_cloud_data();
|
|
|
|
m_handle = other.m_handle;
|
|
m_vertex_vbo_id = other.m_vertex_vbo_id;
|
|
|
|
other.m_handle.vao_id = 0;
|
|
other.m_handle.point_count = 0;
|
|
other.m_vertex_vbo_id = 0;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
inline point_cloud_data::~point_cloud_data()
|
|
{
|
|
if (m_vertex_vbo_id)
|
|
{
|
|
glDeleteBuffers(1, &m_vertex_vbo_id);
|
|
}
|
|
if (m_handle.vao_id)
|
|
{
|
|
glDeleteVertexArrays(1, &m_handle.vao_id);
|
|
}
|
|
}
|
|
|
|
inline point_cloud_handle point_cloud_data::handle() const
|
|
{
|
|
return m_handle;
|
|
}
|
|
|
|
inline components::point_cloud_vertex::flags point_cloud_data::components() const
|
|
{
|
|
return m_component_types;
|
|
}
|
|
}
|