4#include <unordered_map>
17typedef std::string ShaderIdentifier;
37 void SetMat4x4(
const char* name,
const float* value);
53 void SetUniform3f(
const char* name,
float x,
float y,
float z);
61 void SetVector2(
const char* name,
float value0,
float value1);
127 NW_DECL_RES_LIST(ShaderIdentifier,
Shader);
The base class for all assets.
Definition Asset.h:9
Class representing a shader asset.
Definition Shader.h:22
Asset * LoadFromFile(const char *path, void *identifier) override
Load a shader asset from a file.
Definition Shader.cpp:73
ShaderIdentifier _identifier
Definition Shader.h:25
void SetUniformArrayi(const char *name, int *value, int size)
Set an array of integer uniforms in the shader.
Definition Shader.cpp:119
uint32 _glID
Definition Shader.h:24
void Delete()
Delete the shader.
Definition Shader.cpp:124
void Use()
Use this shader for rendering.
Definition Shader.cpp:90
void SetUniformArrayf(const char *name, float *value, int size)
Set an array of float uniforms in the shader.
Definition Shader.cpp:115
void SetVector2(const char *name, float value0, float value1)
Set a 2-component float vector uniform in the shader.
Definition Shader.cpp:102
void SetUniform3f(const char *name, float x, float y, float z)
Set a 3-component float vector uniform in the shader.
Definition Shader.cpp:110
void SetMat4x4(const char *name, const float *value)
Set a 4x4 matrix uniform in the shader.
Definition Shader.cpp:94
Asset * LoadFromBuffer(void *shaderTextPtr, void *identifier) override
Load a shader asset from a buffer.
Definition Shader.cpp:78
void _GlGen(ShaderText *shaderText)
Generate and bind the OpenGL shader program.
Definition Shader.cpp:26
static ShaderText parseShader(const char *path)
Parse a shader file and return the shader text.
Definition Shader.cpp:9
void SetUniform1f(const char *name, const float value)
Set a float uniform in the shader.
Definition Shader.cpp:98
Asset * GetFromCache(void *identifier) override
Get a shader asset from the cache.
Definition Shader.cpp:64
void SetUniform1i(const char *name, const int value)
Set an integer uniform in the shader.
Definition Shader.cpp:106
Struct representing the text of a shader.
Definition Shader.h:12
const char * fragment
Definition Shader.h:14
const char * vertex
Definition Shader.h:13