Initial shader class & restructure
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 2m38s
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 2m38s
This commit is contained in:
@@ -17,10 +17,10 @@
|
||||
#include <Color3.hpp>
|
||||
#include <Color4.hpp>
|
||||
#include <Colors.hpp>
|
||||
#include <JGL/Texture.h>
|
||||
#include <JGL/enums.h>
|
||||
#include <JGL/FontCache.h>
|
||||
#include <JGL/Font.h>
|
||||
#include <JGL/types/Texture.h>
|
||||
#include <JGL/types/enums.h>
|
||||
#include <JGL/types/FontCache.h>
|
||||
#include <JGL/types/Font.h>
|
||||
#include <J3ML/LinearAlgebra.hpp>
|
||||
#include <J3ML/LinearAlgebra/Vector2.hpp>
|
||||
#include <J3ML/LinearAlgebra/Vector3.hpp>
|
||||
|
40
include/JGL/types/Shader.h
Normal file
40
include/JGL/types/Shader.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <J3ML/J3ML.hpp>
|
||||
#include <glad/glad.h>
|
||||
|
||||
namespace JGL {
|
||||
class Shader;
|
||||
|
||||
enum class ShaderType : u8 {
|
||||
VERTEX = 0,
|
||||
FRAGMENT = 1,
|
||||
COMBINED = 2,
|
||||
};
|
||||
}
|
||||
|
||||
class JGL::Shader {
|
||||
private:
|
||||
///Shader program.
|
||||
GLuint shader_program_handle = 0;
|
||||
///Shader type.
|
||||
ShaderType shader_type = ShaderType::COMBINED;
|
||||
|
||||
///Individual shaders which are compiled into the shader program.
|
||||
GLuint vertex_shader = 0;
|
||||
GLuint fragment_shader = 0;
|
||||
private:
|
||||
void load(const char* file_path, ShaderType type);
|
||||
void load(const std::string& shader_program_text, ShaderType type);
|
||||
void link();
|
||||
public:
|
||||
[[nodiscard]] GLuint GetGLShaderProgramHandle() const;
|
||||
[[nodiscard]] ShaderType GetShaderType() const;
|
||||
void Erase() const;
|
||||
public:
|
||||
Shader(const char* vertex_shader_file, const char* fragment_shader_file);
|
||||
Shader(const char* shader_file, ShaderType type);
|
||||
Shader(const std::string& vertex_shader_text, const std::string& fragment_shader_text);
|
||||
Shader(const std::string& shader_text, ShaderType type);
|
||||
~Shader();
|
||||
};
|
Reference in New Issue
Block a user