Add booleans to uniform set list

This commit is contained in:
EmeraldLockdown 2026-04-01 14:39:53 -05:00
parent 0de475244d
commit cb515ac764
6 changed files with 60 additions and 0 deletions

View file

@ -11006,6 +11006,13 @@ function gfx_shader_set_int(loc, value)
-- ...
end
--- @param loc integer
--- @param value boolean
--- Sets the value of a shader uniform of type bool.
function gfx_shader_set_bool(loc, value)
-- ...
end
--- @param loc integer
--- @param value number
--- Sets the value of a shader uniform of type float.

View file

@ -961,6 +961,30 @@ Sets the value of a shader uniform of type int.
<br />
## [gfx_shader_set_bool](#gfx_shader_set_bool)
### Description
Sets the value of a shader uniform of type bool.
### Lua Example
`gfx_shader_set_bool(loc, value)`
### Parameters
| Field | Type |
| ----- | ---- |
| loc | `integer` |
| value | `boolean` |
### Returns
- None
### C Prototype
`void gfx_shader_set_bool(int loc, bool value);`
[:arrow_up_small:](#)
<br />
## [gfx_shader_set_float](#gfx_shader_set_float)
### Description

View file

@ -1967,6 +1967,7 @@
- [gfx_use_program](functions-7.md#gfx_use_program)
- [gfx_shader_get_uniform_location](functions-7.md#gfx_shader_get_uniform_location)
- [gfx_shader_set_int](functions-7.md#gfx_shader_set_int)
- [gfx_shader_set_bool](functions-7.md#gfx_shader_set_bool)
- [gfx_shader_set_float](functions-7.md#gfx_shader_set_float)
- [gfx_shader_set_vec2](functions-7.md#gfx_shader_set_vec2)
- [gfx_shader_set_vec3](functions-7.md#gfx_shader_set_vec3)

View file

@ -32651,6 +32651,25 @@ int smlua_func_gfx_shader_set_int(lua_State* L) {
return 1;
}
int smlua_func_gfx_shader_set_bool(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 2) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "gfx_shader_set_bool", 2, top);
return 0;
}
int loc = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "gfx_shader_set_bool"); return 0; }
bool value = smlua_to_boolean(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "gfx_shader_set_bool"); return 0; }
gfx_shader_set_bool(loc, value);
return 1;
}
int smlua_func_gfx_shader_set_float(lua_State* L) {
if (L == NULL) { return 0; }
@ -38835,6 +38854,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "gfx_use_program", smlua_func_gfx_use_program);
smlua_bind_function(L, "gfx_shader_get_uniform_location", smlua_func_gfx_shader_get_uniform_location);
smlua_bind_function(L, "gfx_shader_set_int", smlua_func_gfx_shader_set_int);
smlua_bind_function(L, "gfx_shader_set_bool", smlua_func_gfx_shader_set_bool);
smlua_bind_function(L, "gfx_shader_set_float", smlua_func_gfx_shader_set_float);
smlua_bind_function(L, "gfx_shader_set_vec2", smlua_func_gfx_shader_set_vec2);
smlua_bind_function(L, "gfx_shader_set_vec3", smlua_func_gfx_shader_set_vec3);

View file

@ -415,6 +415,12 @@ void gfx_shader_set_int(int loc, int value) {
}
}
void gfx_shader_set_bool(int loc, bool value) {
if (loc != -1) {
glUniform1i(loc, (int)value);
}
}
void gfx_shader_set_float(int loc, float value) {
if (loc != -1) {
glUniform1f(loc, value);

View file

@ -104,6 +104,8 @@ void gfx_use_program(u32 program);
int gfx_shader_get_uniform_location(u32 program, const char* name);
/* |description|Sets the value of a shader uniform of type int.|descriptionEnd| */
void gfx_shader_set_int(int loc, int value);
/* |description|Sets the value of a shader uniform of type bool.|descriptionEnd| */
void gfx_shader_set_bool(int loc, bool value);
/* |description|Sets the value of a shader uniform of type float.|descriptionEnd| */
void gfx_shader_set_float(int loc, float value);
/* |description|Sets the value of a shader uniform of type vec2.|descriptionEnd| */