44 lines
852 B
C++
44 lines
852 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <system_error>
|
|
#include "GL/glew.h"
|
|
#include "opengl/handles/shader_handle.hpp"
|
|
|
|
namespace zgl
|
|
{
|
|
class shader_data
|
|
{
|
|
private:
|
|
explicit shader_data(GLuint shader_id, GLenum type);
|
|
|
|
public:
|
|
|
|
shader_data() = default;
|
|
|
|
[[nodiscard]] static std::error_code build_from(
|
|
GLenum type,
|
|
const std::string& source,
|
|
shader_data& data
|
|
);
|
|
|
|
shader_data(const shader_data& other) = delete;
|
|
shader_data& operator=(const shader_data& other) = delete;
|
|
|
|
shader_data(shader_data&& other) noexcept;
|
|
shader_data& operator=(shader_data&& other) noexcept;
|
|
|
|
[[nodiscard]] shader_handle handle() const;
|
|
|
|
~shader_data();
|
|
|
|
private:
|
|
shader_handle m_handle{};
|
|
GLenum m_type{ GL_INVALID_ENUM };
|
|
};
|
|
}
|
|
|
|
#define INCLUDE_SHADER_DATA_IMPLEMENTATION
|
|
#include "opengl/data/shader_data.ipp"
|
|
#undef INCLUDE_SHADER_DATA_IMPLEMENTATION
|