NWengine 0.9
|
Class representing a shader asset. More...
#include <Shader.h>
Public Member Functions | |
void | Use () |
Use this shader for rendering. | |
void | SetMat4x4 (const char *name, const float *value) |
Set a 4x4 matrix uniform in the shader. | |
void | SetUniform1f (const char *name, const float value) |
Set a float uniform in the shader. | |
void | SetUniform3f (const char *name, float x, float y, float z) |
Set a 3-component float vector uniform in the shader. | |
void | SetVector2 (const char *name, float value0, float value1) |
Set a 2-component float vector uniform in the shader. | |
void | SetUniform1i (const char *name, const int value) |
Set an integer uniform in the shader. | |
void | SetUniformArrayf (const char *name, float *value, int size) |
Set an array of float uniforms in the shader. | |
void | SetUniformArrayi (const char *name, int *value, int size) |
Set an array of integer uniforms in the shader. | |
Asset * | GetFromCache (void *identifier) override |
Get a shader asset from the cache. | |
Asset * | LoadFromFile (const char *path, void *identifier) override |
Load a shader asset from a file. | |
Asset * | LoadFromBuffer (void *shaderTextPtr, void *identifier) override |
Load a shader asset from a buffer. | |
void | Delete () |
Delete the shader. | |
void | _GlGen (ShaderText *shaderText) |
Generate and bind the OpenGL shader program. | |
NW_DECL_RES_LIST (ShaderIdentifier, Shader) | |
Public Member Functions inherited from Asset | |
virtual Asset * | LoadFromFileOrGetFromCache (void *identifier, const char *path, void *data) |
Load the asset from file or get it from the cache based on the identifier and file path. | |
virtual Asset * | LoadFromBufferOrGetFromCache (void *identifier, void *buffer, void *data) |
Load the asset from a buffer or get it from the cache based on the identifier. | |
virtual void | Clean () |
Clean up the asset. | |
Static Public Member Functions | |
static ShaderText | parseShader (const char *path) |
Parse a shader file and return the shader text. | |
Public Attributes | |
uint32 | _glID = 0 |
ShaderIdentifier | _identifier |
Public Attributes inherited from Asset | |
int | _usageCounter = 0 |
Class representing a shader asset.
void Shader::_GlGen | ( | ShaderText * | shaderText | ) |
Generate and bind the OpenGL shader program.
shaderText | A pointer to the ShaderText struct. |
Get a shader asset from the cache.
identifier | The identifier of the shader. |
Reimplemented from Asset.
Load a shader asset from a buffer.
shaderTextPtr | A pointer to the ShaderText struct. |
identifier | The identifier of the shader. |
Reimplemented from Asset.
Load a shader asset from a file.
path | The path to the shader file. |
identifier | The identifier of the shader. |
Reimplemented from Asset.
|
static |
Parse a shader file and return the shader text.
path | The path to the shader file. |
Set a 4x4 matrix uniform in the shader.
name | The name of the uniform. |
value | The value of the uniform. |
Set a float uniform in the shader.
name | The name of the uniform. |
value | The value of the uniform. |
Set an integer uniform in the shader.
name | The name of the uniform. |
value | The value of the uniform. |
Set a 3-component float vector uniform in the shader.
name | The name of the uniform. |
x | The x component of the vector. |
y | The y component of the vector. |
z | The z component of the vector. |
Set an array of float uniforms in the shader.
name | The name of the uniform. |
value | The array of float values. |
size | The size of the array. |
Set an array of integer uniforms in the shader.
name | The name of the uniform. |
value | The array of integer values. |
size | The size of the array. |
Set a 2-component float vector uniform in the shader.
name | The name of the uniform. |
value0 | The first component of the vector. |
value1 | The second component of the vector. |
uint32 Shader::_glID = 0 |
The OpenGL ID of the shader.
ShaderIdentifier Shader::_identifier |
The identifier of the shader.