feat: simplified Internal_OnShaderLoaded

This commit is contained in:
Sara 2024-09-19 20:56:08 +02:00
parent 87e13e2069
commit 972ce010ac

View file

@ -63,14 +63,12 @@ void RenderNextFrame() {
void Internal_OnShaderLoaded(ShaderResource resource) {
list_add(&g_shaders, &resource);
int light_direction_loc = GetShaderLocation(*resource.resource, "lightDirection");
int ambient_level_loc = GetShaderLocation(*resource.resource, "ambientLight");
Vector3 lightdir = MATRIX_FORWARD(g_light_direction);
Vector4 ambient_color = {0.07, 0.08, 0.12, 1.0};
int const light_direction_loc = GetShaderLocation(*resource.resource, "lightDirection");
int const ambient_level_loc = GetShaderLocation(*resource.resource, "ambientLight");
if(light_direction_loc != -1)
SetShaderValue(*resource.resource, light_direction_loc, &MATRIX_FORWARD(g_light_direction), SHADER_UNIFORM_VEC3);
if(ambient_level_loc != -1)
SetShaderValue(*resource.resource, ambient_level_loc, &ambient_color, SHADER_UNIFORM_VEC4);
SetShaderValue(*resource.resource, ambient_level_loc, &(Vector4){0.07, 0.08, 0.12, 1.0}, SHADER_UNIFORM_VEC4);
}
void Internal_OnShaderUnloaded(ShaderResource resource) {