Module shader
Lua bindings to interact with shaders.
Functions
__gc (shader) | Frees a shader. |
__eq (f1, f2) | Compares two shaders to see if they are the same. |
new (vertex, fragment) | Creates a new shader. |
send (shader, name) | Allows setting values of uniforms for a shader. |
send (shader, name) | Allows setting values of uniforms for a shader, while ignoring unknown (or unused) uniforms. |
hasUniform (shader, name) | Checks to see if a shader has a uniform. |
addPPShader (shader[, layer="final"[, priority=0]]) | Sets a shader as a post-processing shader. |
rmPPShader (shader) | Removes a shader as a post-processing shader. |
Functions
- __gc (shader)
-
Frees a shader.
Parameters:
- shader Shader Shader to free.
- __eq (f1, f2)
-
Compares two shaders to see if they are the same.
Parameters:
- f1 Shader Shader 1 to compare.
- f2 Shader Shader 2 to compare.
Returns:
-
boolean
true if both shaders are the same.
- new (vertex, fragment)
-
Creates a new shader.
Parameters:
- vertex string Script containing the vertex shader.
- fragment string String containing the fragment shader.
Returns:
-
Shader
A newly created shader.
- send (shader, name)
-
Allows setting values of uniforms for a shader. Errors out if the
uniform is unknown or unused (as in optimized out by the compiler).
Parameters:
- shader Shader Shader to send uniform to.
- name string Name of the uniform.
- send (shader, name)
-
Allows setting values of uniforms for a shader, while ignoring unknown
(or unused) uniforms.
Parameters:
- shader Shader Shader to send uniform to.
- name string Name of the uniform.
- hasUniform (shader, name)
-
Checks to see if a shader has a uniform.
Parameters:
- shader Shader Shader to send uniform to.
- name string Name of the uniform to check.
Returns:
-
boolean
true if the shader has the uniform.
- addPPShader (shader[, layer="final"[, priority=0]])
-
Sets a shader as a post-processing shader.
Parameters:
- shader Shader Shader to set as a post-processing shader.
- layer string Layer to add the shader to. (default "final")
- priority number Priority of the shader to set. Higher values mean it is run later. (default 0)
Returns:
-
boolean
true on success.
- rmPPShader (shader)
-
Removes a shader as a post-processing shader.
Parameters:
- shader Shader Shader to disable as post-processing shader.
Returns:
-
boolean
True on success.