fixes
This commit is contained in:
66
source/opengl/data/point_cloud_data.ipp
Normal file
66
source/opengl/data/point_cloud_data.ipp
Normal file
@@ -0,0 +1,66 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user