Initial shader class & restructure
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 2m38s

This commit is contained in:
2024-08-23 12:25:46 -04:00
parent 6650af4fc4
commit f3c2fd5e93
12 changed files with 180 additions and 11 deletions

View File

@@ -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>

View 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();
};