}
shdata_applied = min<unsigned>(shdata_applied, shdata_stack.size());
changed |= MATRIX;
- if(state->camera!=old_camera)
+ bool camera_changed = (state->camera!=old_camera);
+ if(camera_changed)
{
standard_shdata.uniform("projection_matrix", state->camera->get_projection_matrix());
changed |= STANDARD_SHDATA|LEGACY_PROJECTION;
}
- if(state->lighting!=old_lighting)
+ /* This actually should compare the relevant matrices rather than check for
+ camera, but in practice lighting and clipping is set right after the camera
+ and a boolean check is much faster than matrix comparison. */
+ if(state->lighting!=old_lighting || camera_changed)
{
if(state->lighting)
{
}
changed |= LEGACY_LIGHTING;
}
- if(state->clipping!=old_clipping)
+ if(state->clipping!=old_clipping || camera_changed)
{
if(state->clipping)
{