Untitled Game engine no.5
1.0
|
12 None = 0, Float, Float2, Float3, Float4,
14 Int, Int2, Int3, Int4,
19 static int F_SIZE =
sizeof(float);
21 static int I_SIZE =
sizeof(int);
23 static int B_SIZE =
sizeof(bool);
29 case ShaderDataType::Mat3:
30 case ShaderDataType::Mat4:
31 case ShaderDataType::Float:
32 case ShaderDataType::Float2:
33 case ShaderDataType::Float3:
34 case ShaderDataType::Float4:
return GL_FLOAT;
35 case ShaderDataType::Int:
36 case ShaderDataType::Int2:
37 case ShaderDataType::Int3:
38 case ShaderDataType::Int4:
return GL_INT;
39 case ShaderDataType::Bool:
return GL_BOOL;
48 case ShaderDataType::Float:
return F_SIZE;
49 case ShaderDataType::Float2:
return F_SIZE * 2;
50 case ShaderDataType::Float3:
return F_SIZE * 3;
51 case ShaderDataType::Float4:
return F_SIZE * 4;
52 case ShaderDataType::Mat3:
return F_SIZE * 3 * 3;
53 case ShaderDataType::Mat4:
return F_SIZE * 4 * 4;
54 case ShaderDataType::Int:
return I_SIZE;
55 case ShaderDataType::Int2:
return I_SIZE * 2;
56 case ShaderDataType::Int3:
return I_SIZE * 3;
57 case ShaderDataType::Int4:
return I_SIZE *4;
58 case ShaderDataType::Bool:
return B_SIZE;
70 std::string m_FilePath;
73 Shader(
const std::string& vert,
const std::string& frag);
75 Shader(
const std::string& path);
86 void SetUniformIntN(
const std::string& name,
int* values,
const uint32_t& n);
92 void SetUniformFloat3(
const std::string& name,
float v0,
float v1,
float v2);
94 void SetUniformFloat4(
const std::string& name,
float v0,
float v1,
float v2,
float v3);
98 unsigned int CreateShader(
const std::string& vert,
const std::string& frag);
101 int GetUniformLocation(
const std::string& name);
103 unsigned int CompileShader(
unsigned int type,
const std::string& source);
unsigned int CreateShader(const std::string &vert, const std::string &frag)
create a shader from vertex string and a fragment string returns a system id
Definition: Shader.cpp:42
void SetUniformFloat2(const std::string &name, float v0, float v1)
set a uniform float pair
Definition: Shader.cpp:116
ShaderDataType
data type enum for shader parameter
Definition: Shader.hpp:11
Shader(const std::string &vert, const std::string &frag)
constructor, requires a vertex shader and a fragment shader in text form
void SetUniformFloat3(const std::string &name, float v0, float v1, float v2)
set a uniform float triplet
Definition: Shader.cpp:120
void Bind()
bind the shader to drawspace
Definition: Shader.cpp:94
void SetUniformIntN(const std::string &name, int *values, const uint32_t &n)
set n uniform ints
Definition: Shader.cpp:108
void SetUniformInt1(const std::string &name, int i)
set a uniform int
Definition: Shader.cpp:104
void SetUniformFloat4(const std::string &name, float v0, float v1, float v2, float v3)
set a uniform float quad
Definition: Shader.cpp:124
void Unbind()
unbind the the shader from the drawing register
Definition: Shader.cpp:98
Definition: Animation.hpp:14
void SetUniformMat4(const std::string &name, const glm::mat4)
set a uniform float 4x4 matrix
Definition: Shader.cpp:128
Container for a shader.
Definition: Shader.hpp:67
void SetUniformFloat1(const std::string &name, float v0)
set a uniform float
Definition: Shader.cpp:112