40 lines
632 B
C++
40 lines
632 B
C++
#ifndef INCLUDE_TEXTURE_DATA_IMPLEMENTATION
|
|
# error Never include this file directly include 'texture_data.hpp'
|
|
#endif
|
|
|
|
namespace zgl
|
|
{
|
|
inline texture_data::texture_data(texture_data&& other) noexcept
|
|
: handle{ other.handle }
|
|
{
|
|
other.handle.id = 0;
|
|
}
|
|
|
|
inline texture_data& texture_data::operator=(texture_data&& other) noexcept
|
|
{
|
|
if (&other != this)
|
|
{
|
|
this->~texture_data();
|
|
|
|
handle = other.handle;
|
|
|
|
other.handle.id = 0;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
inline texture_data::~texture_data()
|
|
{
|
|
if (handle.id)
|
|
{
|
|
glDeleteTextures(1, &handle.id);
|
|
}
|
|
}
|
|
|
|
inline texture_handle texture_data::handle() const
|
|
{
|
|
return { handle.id };
|
|
}
|
|
}
|