new: frame_time uniform

main
Dominik Madarász 2024-04-18 01:42:40 +02:00
parent 23c860ab99
commit 038386ef2d
3 changed files with 24 additions and 3 deletions

View File

@ -385942,6 +385942,14 @@ void model_set_uniforms(model_t m, int shader, mat44 mv, mat44 proj, mat44 view,
if ((loc = glGetUniformLocation(shader, "u_matcaps")) >= 0) { if ((loc = glGetUniformLocation(shader, "u_matcaps")) >= 0) {
glUniform1i(loc, m.flags & MODEL_MATCAPS ? GL_TRUE:GL_FALSE); glUniform1i(loc, m.flags & MODEL_MATCAPS ? GL_TRUE:GL_FALSE);
} }
if ((loc = glGetUniformLocation(shader, "frame_count")) >= 0) {
glUniform1i(loc, (unsigned)window_frame());
}
if ((loc = glGetUniformLocation(shader, "frame_time")) >= 0) {
glUniform1f(loc, (float)window_time());
}
if (m.shading == SHADING_PBR) { if (m.shading == SHADING_PBR) {
handle old_shader = last_shader; handle old_shader = last_shader;
@ -385961,7 +385969,6 @@ void model_set_uniforms(model_t m, int shader, mat44 mv, mat44 proj, mat44 view,
shader_texture( "tex_skyenv", m.sky_env ); shader_texture( "tex_skyenv", m.sky_env );
} }
shader_texture( "tex_brdf_lut", brdf_lut() ); shader_texture( "tex_brdf_lut", brdf_lut() );
shader_uint( "frame_count", (unsigned)window_frame() );
shader_bind(old_shader); shader_bind(old_shader);
} }
} }

View File

@ -3308,6 +3308,14 @@ void model_set_uniforms(model_t m, int shader, mat44 mv, mat44 proj, mat44 view,
if ((loc = glGetUniformLocation(shader, "u_matcaps")) >= 0) { if ((loc = glGetUniformLocation(shader, "u_matcaps")) >= 0) {
glUniform1i(loc, m.flags & MODEL_MATCAPS ? GL_TRUE:GL_FALSE); glUniform1i(loc, m.flags & MODEL_MATCAPS ? GL_TRUE:GL_FALSE);
} }
if ((loc = glGetUniformLocation(shader, "frame_count")) >= 0) {
glUniform1i(loc, (unsigned)window_frame());
}
if ((loc = glGetUniformLocation(shader, "frame_time")) >= 0) {
glUniform1f(loc, (float)window_time());
}
if (m.shading == SHADING_PBR) { if (m.shading == SHADING_PBR) {
handle old_shader = last_shader; handle old_shader = last_shader;
@ -3327,7 +3335,6 @@ void model_set_uniforms(model_t m, int shader, mat44 mv, mat44 proj, mat44 view,
shader_texture( "tex_skyenv", m.sky_env ); shader_texture( "tex_skyenv", m.sky_env );
} }
shader_texture( "tex_brdf_lut", brdf_lut() ); shader_texture( "tex_brdf_lut", brdf_lut() );
shader_uint( "frame_count", (unsigned)window_frame() );
shader_bind(old_shader); shader_bind(old_shader);
} }
} }

View File

@ -20481,6 +20481,14 @@ void model_set_uniforms(model_t m, int shader, mat44 mv, mat44 proj, mat44 view,
if ((loc = glGetUniformLocation(shader, "u_matcaps")) >= 0) { if ((loc = glGetUniformLocation(shader, "u_matcaps")) >= 0) {
glUniform1i(loc, m.flags & MODEL_MATCAPS ? GL_TRUE:GL_FALSE); glUniform1i(loc, m.flags & MODEL_MATCAPS ? GL_TRUE:GL_FALSE);
} }
if ((loc = glGetUniformLocation(shader, "frame_count")) >= 0) {
glUniform1i(loc, (unsigned)window_frame());
}
if ((loc = glGetUniformLocation(shader, "frame_time")) >= 0) {
glUniform1f(loc, (float)window_time());
}
if (m.shading == SHADING_PBR) { if (m.shading == SHADING_PBR) {
handle old_shader = last_shader; handle old_shader = last_shader;
@ -20500,7 +20508,6 @@ void model_set_uniforms(model_t m, int shader, mat44 mv, mat44 proj, mat44 view,
shader_texture( "tex_skyenv", m.sky_env ); shader_texture( "tex_skyenv", m.sky_env );
} }
shader_texture( "tex_brdf_lut", brdf_lut() ); shader_texture( "tex_brdf_lut", brdf_lut() );
shader_uint( "frame_count", (unsigned)window_frame() );
shader_bind(old_shader); shader_bind(old_shader);
} }
} }