38 lines
603 B
C++
38 lines
603 B
C++
#ifndef INCLUDE_SHADER_DATA_IMPLEMENTATION
|
|
# error Never include this file directly include 'shader_data.hpp'
|
|
#endif
|
|
|
|
namespace zgl
|
|
{
|
|
inline shader_data::shader_data(const GLuint id) :
|
|
handle{ id } {}
|
|
|
|
|
|
inline shader_data::shader_data(shader_data&& other) noexcept
|
|
{
|
|
handle = other.handle;
|
|
other.handle.id = 0;
|
|
}
|
|
|
|
inline shader_data& shader_data::operator=(shader_data&& other) noexcept
|
|
{
|
|
if (&other != this)
|
|
{
|
|
this->~shader_data();
|
|
|
|
handle = other.handle;
|
|
other.handle.id = 0;
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
inline shader_data::~shader_data()
|
|
{
|
|
if (handle.id)
|
|
{
|
|
glDeleteShader(handle.id);
|
|
}
|
|
}
|
|
|
|
}
|