void Renderer::set_material(const Material *m)
{
state->material = m;
+ changed |= MATERIAL_SHDATA;
}
void Renderer::set_lighting(const Lighting *l)
state->lighting = l;
state->lighting_matrix = mtx_stack.top();
if(l)
+ {
l->update_shader_data(standard_shdata, mtx_stack.top());
+ changed |= STANDARD_SHDATA;
+ }
changed |= LIGHTING;
}
LinAl::SquareMatrix<float, 3> nm = m.block<3, 3>(0, 0);
nm = transpose(invert(nm));
standard_shdata.uniform_matrix3("eye_obj_normal_matrix", &nm(0, 0));
- changed &= ~MODERN_MATRIX;
+ changed = (changed&~MODERN_MATRIX)|STANDARD_SHDATA;
}
- if(state->material)
+ if(state->material && (changed&MATERIAL_SHDATA))
+ {
state->material->get_shader_data().apply();
- standard_shdata.apply();
+ changed &= ~MATERIAL_SHDATA;
+ }
+
+ if(changed&STANDARD_SHDATA)
+ {
+ standard_shdata.apply();
+ changed &= ~STANDARD_SHDATA;
+ }
}
if((changed&SHADER_DATA) || shprog_changed)