This commit is contained in:
ZY4N
2024-12-22 16:58:40 +01:00
parent 2704814de2
commit db8db8f9d7
161 changed files with 17102 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
#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 shader_id, const GLenum type)
: m_handle{ shader_id }, m_type{ type } {}
inline shader_data::shader_data(shader_data&& other) noexcept
{
m_handle = other.m_handle;
m_type = other.m_type;
other.m_handle.shader_id = 0;
other.m_type = GL_INVALID_ENUM;
}
inline shader_data& shader_data::operator=(shader_data&& other) noexcept
{
if (&other != this)
{
this->~shader_data();
m_handle = other.m_handle;
m_type = other.m_type;
other.m_handle.shader_id = 0;
other.m_type = GL_INVALID_ENUM;
}
return *this;
}
inline shader_data::~shader_data()
{
if (m_handle.shader_id)
{
glDeleteShader(m_handle.shader_id);
}
m_type = GL_INVALID_ENUM;
}
inline shader_handle shader_data::handle() const
{
return m_handle;
}
}