Merge pull request #98 from JayFoxRox/quickfix

Fix: all lights used same shader var since 9fd88f53
This commit is contained in:
espes 2017-05-26 19:46:46 +02:00 committed by GitHub
commit ca00a49331
3 changed files with 12 additions and 12 deletions

View File

@ -1921,20 +1921,20 @@ static void pgraph_shader_update_constants(PGRAPHState *pg,
for (i = 0; i < NV2A_MAX_LIGHTS; i++) {
GLint loc;
loc = binding->light_infinite_half_vector_loc;
loc = binding->light_infinite_half_vector_loc[i];
if (loc != -1) {
glUniform3fv(loc, 1, pg->light_infinite_half_vector[i]);
}
loc = binding->light_infinite_direction_loc;
loc = binding->light_infinite_direction_loc[i];
if (loc != -1) {
glUniform3fv(loc, 1, pg->light_infinite_direction[i]);
}
loc = binding->light_local_position_loc;
loc = binding->light_local_position_loc[i];
if (loc != -1) {
glUniform3fv(loc, 1, pg->light_local_position[i]);
}
loc = binding->light_local_attenuation_loc;
loc = binding->light_local_attenuation_loc[i];
if (loc != -1) {
glUniform3fv(loc, 1, pg->light_local_attenuation[i]);
}

View File

@ -930,14 +930,14 @@ ShaderBinding* generate_shaders(const ShaderState state)
}
for (i = 0; i < NV2A_MAX_LIGHTS; i++) {
snprintf(tmp, sizeof(tmp), "lightInfiniteHalfVector%d", i);
ret->light_infinite_half_vector_loc = glGetUniformLocation(program, tmp);
ret->light_infinite_half_vector_loc[i] = glGetUniformLocation(program, tmp);
snprintf(tmp, sizeof(tmp), "lightInfiniteDirection%d", i);
ret->light_infinite_direction_loc = glGetUniformLocation(program, tmp);
ret->light_infinite_direction_loc[i] = glGetUniformLocation(program, tmp);
snprintf(tmp, sizeof(tmp), "lightLocalPosition%d", i);
ret->light_local_position_loc = glGetUniformLocation(program, tmp);
ret->light_local_position_loc[i] = glGetUniformLocation(program, tmp);
snprintf(tmp, sizeof(tmp), "lightLocalAttenuation%d", i);
ret->light_local_attenuation_loc = glGetUniformLocation(program, tmp);
ret->light_local_attenuation_loc[i] = glGetUniformLocation(program, tmp);
}
return ret;

View File

@ -103,10 +103,10 @@ typedef struct ShaderBinding {
GLint fog_color_loc;
GLint fog_param_loc[2];
GLint light_infinite_half_vector_loc;
GLint light_infinite_direction_loc;
GLint light_local_position_loc;
GLint light_local_attenuation_loc;
GLint light_infinite_half_vector_loc[NV2A_MAX_LIGHTS];
GLint light_infinite_direction_loc[NV2A_MAX_LIGHTS];
GLint light_local_position_loc[NV2A_MAX_LIGHTS];
GLint light_local_attenuation_loc[NV2A_MAX_LIGHTS];
} ShaderBinding;