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,45 @@
#ifndef INCLUDE_SHADER_PROGRAM_DATA_IMPLEMENTATION
# error Never include this file directly include 'shader_program_data.hpp'
#endif
#include <glm/gtc/type_ptr.hpp>
#include "util/for_each.hpp"
#include "util/logger.hpp"
#include "opengl/error.hpp"
namespace zgl
{
inline shader_program_data::shader_program_data(GLuint program_id)
: m_handle{ program_id } {}
inline shader_program_data::shader_program_data(shader_program_data&& other) noexcept
{
m_handle = other.m_handle;
other.m_handle.program_id = 0;
}
inline shader_program_data& shader_program_data::operator=(shader_program_data&& other) noexcept
{
if (&other != this)
{
this->~shader_program_data();
m_handle = other.m_handle;
other.m_handle.program_id = 0;
}
return *this;
}
inline shader_program_data::~shader_program_data()
{
if (m_handle.program_id) {
glDeleteProgram(m_handle.program_id);
}
}
[[nodiscard]] inline shader_program_handle shader_program_data::handle() const
{
return m_handle;
}
}