![]() |
naev 0.12.6
|
Handles shaders. More...
#include "nlua_shader.h"#include "array.h"#include "nlua_tex.h"#include "nluadef.h"#include "render.h"
Go to the source code of this file.
Macros | |
| #define | ATTRIB(name) |
| #define | UNIFORM(name) |
Functions | |
| static int | shaderL_gc (lua_State *L) |
| Frees a shader. | |
| static int | shaderL_eq (lua_State *L) |
| Compares two shaders to see if they are the same. | |
| static int | shaderL_new (lua_State *L) |
| Creates a new shader. | |
| static int | shaderL_send (lua_State *L) |
| Allows setting values of uniforms for a shader. Errors out if the uniform is unknown or unused (as in optimized out by the compiler). | |
| static int | shaderL_sendRaw (lua_State *L) |
| Allows setting values of uniforms for a shader, while ignoring unknown (or unused) uniforms. | |
| static int | shaderL_hasUniform (lua_State *L) |
| Checks to see if a shader has a uniform. | |
| static int | shaderL_addPostProcess (lua_State *L) |
| Sets a shader as a post-processing shader. | |
| static int | shaderL_rmPostProcess (lua_State *L) |
| Removes a shader as a post-processing shader. | |
| static int | shader_compareUniform (const void *a, const void *b) |
| static int | shader_searchUniform (const void *id, const void *u) |
| static LuaUniform_t * | shader_getUniform (const LuaShader_t *ls, const char *name) |
| static int | shaderL_sendHelper (lua_State *L, int ignore_missing) |
| Helper to set the uniform while handling unknown/inactive uniforms. | |
| int | nlua_loadShader (nlua_env env) |
| Loads the shader library. | |
| LuaShader_t * | lua_toshader (lua_State *L, int ind) |
| Lua bindings to interact with shaders. | |
| LuaShader_t * | luaL_checkshader (lua_State *L, int ind) |
| Gets shader at index or raises error if there is no shader at index. | |
| LuaShader_t * | lua_pushshader (lua_State *L, LuaShader_t shader) |
| Pushes a shader on the stack. | |
| int | lua_isshader (lua_State *L, int ind) |
| Checks to see if ind is a shader. | |
| void | shader_parseUniformArgsFloat (GLfloat values[4], lua_State *L, int idx, int n) |
| Helper to parse up float vector (or arguments). | |
| void | shader_parseUniformArgsInt (GLint values[4], lua_State *L, int idx, int n) |
| Helper to parse up integer vector (or arguments). | |
Variables | |
| static const luaL_Reg | shaderL_methods [] |
Handles shaders.
Definition in file nlua_shader.c.
| #define ATTRIB | ( | name | ) |
| #define UNIFORM | ( | name | ) |
| int lua_isshader | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a shader.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 112 of file nlua_shader.c.
| LuaShader_t * lua_pushshader | ( | lua_State * | L, |
| LuaShader_t | shader ) |
Pushes a shader on the stack.
| L | Lua state to push shader into. |
| shader | Shader to push. |
Definition at line 97 of file nlua_shader.c.
| LuaShader_t * lua_toshader | ( | lua_State * | L, |
| int | ind ) |
Lua bindings to interact with shaders.
Lua module: shader
Gets shader at index.
| L | Lua state to get shader from. |
| ind | Index position to find the shader. |
Definition at line 72 of file nlua_shader.c.
| LuaShader_t * luaL_checkshader | ( | lua_State * | L, |
| int | ind ) |
Gets shader at index or raises error if there is no shader at index.
| L | Lua state to get shader from. |
| ind | Index position to find shader. |
Definition at line 83 of file nlua_shader.c.
| int nlua_loadShader | ( | nlua_env | env | ) |
Loads the shader library.
| env | Environment to load shader library into. |
Definition at line 54 of file nlua_shader.c.
|
static |
Definition at line 167 of file nlua_shader.c.
|
static |
Definition at line 180 of file nlua_shader.c.
| void shader_parseUniformArgsFloat | ( | GLfloat | values[4], |
| lua_State * | L, | ||
| int | idx, | ||
| int | n ) |
Helper to parse up float vector (or arguments).
Definition at line 271 of file nlua_shader.c.
| void shader_parseUniformArgsInt | ( | GLint | values[4], |
| lua_State * | L, | ||
| int | idx, | ||
| int | n ) |
Helper to parse up integer vector (or arguments).
Definition at line 290 of file nlua_shader.c.
|
static |
Definition at line 175 of file nlua_shader.c.
|
static |
Sets a shader as a post-processing shader.
Lua function parameter: Shader shader Shader to set as a post-processing shader. Lua function parameter:[opt="final"] string layer Layer to add the shader to. Lua function parameter:[opt=0] number priority Priority of the shader to set. Higher values mean it is run later. Lua return parameter: boolean true on success.
| L | Lua State |
Lua function: addPPShader
Definition at line 441 of file nlua_shader.c.
|
static |
Compares two shaders to see if they are the same.
Lua function parameter: Shader f1 Shader 1 to compare. Lua function parameter: Shader f2 Shader 2 to compare. Lua return parameter: boolean true if both shaders are the same.
| L | Lua State |
Lua function: __eq
Definition at line 155 of file nlua_shader.c.
|
static |
Frees a shader.
Lua function parameter: Shader shader Shader to free.
| L | Lua State |
Lua function: __gc
Definition at line 134 of file nlua_shader.c.
|
static |
Checks to see if a shader has a uniform.
Lua function parameter: Shader shader Shader to send uniform to. Lua function parameter: string name Name of the uniform to check. Lua return parameter: boolean true if the shader has the uniform.
| L | Lua State |
Lua function: hasUniform
Definition at line 420 of file nlua_shader.c.
|
static |
Creates a new shader.
Lua function parameter: string vertex Script containing the vertex shader. Lua function parameter: string fragment String containing the fragment shader. Lua return parameter: Shader A newly created shader.
| L | Lua State |
Lua function: new
Definition at line 195 of file nlua_shader.c.
|
static |
Removes a shader as a post-processing shader.
Lua function parameter: Shader shader Shader to disable as post-processing shader. Lua return parameter: boolean True on success.
| L | Lua State |
Lua function: rmPPShader
Definition at line 475 of file nlua_shader.c.
|
static |
Allows setting values of uniforms for a shader. Errors out if the uniform is unknown or unused (as in optimized out by the compiler).
Lua function parameter: Shader shader Shader to send uniform to. Lua function parameter: string name Name of the uniform.
| L | Lua State |
Lua function: send
Definition at line 313 of file nlua_shader.c.
|
static |
Helper to set the uniform while handling unknown/inactive uniforms.
Definition at line 334 of file nlua_shader.c.
|
static |
Allows setting values of uniforms for a shader, while ignoring unknown (or unused) uniforms.
Lua function parameter: Shader shader Shader to send uniform to. Lua function parameter: string name Name of the uniform.
| L | Lua State |
Lua function: send
Definition at line 326 of file nlua_shader.c.
|
static |
Shader metatable methods.
Definition at line 30 of file nlua_shader.c.