From: Mikko Rasa Date: Sat, 26 Nov 2016 04:52:39 +0000 (+0200) Subject: Set the appropriate flags on Renderer state changes X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7503b8514cfcc9861c74cfebb0c60db3f72fa29b;p=libs%2Fgl.git Set the appropriate flags on Renderer state changes --- diff --git a/source/renderer.cpp b/source/renderer.cpp index 3bef74b3..a0dc4151 100644 --- a/source/renderer.cpp +++ b/source/renderer.cpp @@ -59,6 +59,7 @@ void Renderer::begin(const Camera *c) state->modelview_matrix = MatrixStack::modelview().top(); standard_shdata.uniform("projection_matrix", MatrixStack::projection().top()); } + changed |= MATRIX|STANDARD_SHDATA; } void Renderer::set_matrix(const Matrix &matrix) @@ -113,7 +114,10 @@ void Renderer::set_clipping(const Clipping *c) state->clipping = c; state->clipping_matrix = state->modelview_matrix; if(c) + { c->update_shader_data(standard_shdata, state->clipping_matrix); + changed |= STANDARD_SHDATA; + } changed |= LEGACY_CLIPPING; } @@ -171,13 +175,19 @@ void Renderer::pop_state() if(state->lighting!=old_lighting) { if(state->lighting) + { state->lighting->update_shader_data(standard_shdata, state->lighting_matrix); + changed |= STANDARD_SHDATA; + } changed |= LEGACY_LIGHTING; } if(state->clipping!=old_clipping) { if(state->clipping) + { state->clipping->update_shader_data(standard_shdata, state->clipping_matrix); + changed |= STANDARD_SHDATA; + } changed |= LEGACY_CLIPPING; } }