75 void setBool(
const std::string& name,
bool value);
76 void setInt(
const std::string& name,
int value);
77 void setFloat(
const std::string& name,
float value);
78 void setVec2(
const std::string& name,
const glm::vec2& value);
79 void setVec2(
const std::string& name,
float x,
float y);
80 void setVec3(
const std::string& name,
const glm::vec3& value);
81 void setVec3(
const std::string& name,
float x,
float y,
float z);
82 void setVec4(
const std::string& name,
const glm::vec4& value);
83 void setVec4(
const std::string& name,
float x,
float y,
float z,
float w);
84 void setMat2(
const std::string& name,
const glm::mat2& mat);
85 void setMat3(
const std::string& name,
const glm::mat3& mat);
86 void setMat4(
const std::string& name,
const glm::mat4& mat);
90 void Set(
const std::string& name,
bool value);
91 void Set(
const std::string& name,
int value);
92 void Set(
const std::string& name,
float value);
93 void Set(
const std::string& name,
const glm::vec2& value);
94 void Set(
const std::string& name,
float x,
float y);
95 void Set(
const std::string& name,
const glm::vec3& value);
96 void Set(
const std::string& name,
float x,
float y,
float z);
97 void Set(
const std::string& name,
const glm::vec4& value);
98 void Set(
const std::string& name,
float x,
float y,
float z,
float w);
99 void Set(
const std::string& name,
const glm::mat2& mat);
100 void Set(
const std::string& name,
const glm::mat3& mat);
101 void Set(
const std::string& name,
const glm::mat4& mat);
106 void SetMVP(
const glm::mat4& model,
const glm::mat4& view,
const glm::mat4& projection);
108 operator unsigned int()
const {
return program; }
116 return std::make_shared<ShaderProgram>(vert, frag);
121 return std::make_shared<ShaderProgram>(vert, frag, geom);
The base class for assets.
Definition: asset.h:157
std::string vert
Code for vertex shader.
Definition: shader.h:148
std::string geometry
Code for geometry file.
Definition: shader.h:154
Hjson::Value uniforms
Definition: shader.h:157
std::string frag
Code for fragment shader.
Definition: shader.h:151
ShaderProgram_t MakeShader()
Definition: shader.cpp:435
AssetType GetAssetType() override
Definition: shader.h:161
unsigned int id
Id of the shader.
Definition: shader.h:55
ShaderType shader_type
Definition: shader.h:52
~Shader()
Definition: shader.cpp:264
AssetType GetAssetType() override
Definition: shader.h:56
Shader(const Shader &)=default
void operator()(const std::string &code, ShaderType type)
Constructs a shader from the code provided.
Definition: shader.cpp:230
A shader program.
Definition: shader.h:68
~ShaderProgram()
Definition: shader.cpp:195
void setMat2(const std::string &name, const glm::mat2 &mat)
Definition: shader.cpp:111
void setFloat(const std::string &name, float value)
Definition: shader.cpp:83
void setVec3(const std::string &name, const glm::vec3 &value)
Definition: shader.cpp:95
void setVec4(const std::string &name, const glm::vec4 &value)
Definition: shader.cpp:103
void setBool(const std::string &name, bool value)
Definition: shader.cpp:75
void setMat4(const std::string &name, const glm::mat4 &mat)
Definition: shader.cpp:119
unsigned int program
Definition: shader.h:104
void setVec2(const std::string &name, const glm::vec2 &value)
Definition: shader.cpp:87
void SetMVP(const glm::mat4 &model, const glm::mat4 &view, const glm::mat4 &projection)
Definition: shader.cpp:173
void setInt(const std::string &name, int value)
Definition: shader.cpp:79
void UseProgram()
Definition: shader.cpp:171
void Set(const std::string &name, bool value)
Definition: shader.cpp:123
void setMat3(const std::string &name, const glm::mat3 &mat)
Definition: shader.cpp:115
ShaderProgram()
Definition: shader.cpp:180
std::string GetErrorLog(unsigned int shader)
Get the issues of the shader, up to 1024 characters of it.
Definition: shader.cpp:61
AssetType
Definition: asset.h:31
@ SHADER_DEFINITION
shader_def as the type parameter in resource.hjson
std::shared_ptr< ShaderProgram > ShaderProgram_t
The preferred way of using a shader program.
Definition: shader.h:112
@ SHADER
shader prototype
Definition: assetprototype.h:27
ShaderType
Definition: shader.h:31
ShaderProgram_t MakeShaderProgram(Shader &vert, Shader &frag)
Helper function to create a shader program.
Definition: shader.h:115
unsigned int LoadShaderData(const std::string &code, int type)
Definition: shader.cpp:27
When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to ...
Definition: clientctx.h:21