diff -r bb60dda3093f -r caac957e9834 src/gl/partrenderer.cpp --- a/src/gl/partrenderer.cpp Sat Feb 01 15:49:28 2020 +0200 +++ b/src/gl/partrenderer.cpp Sat Feb 01 17:10:11 2020 +0200 @@ -49,7 +49,7 @@ abort(); } this->compiler->initialize(); - this->compiler->build(this->model, this->documents); + this->compiler->build(this->model, this->documents, this->renderPreferences); this->initialized = true; this->modelQuaternion = glm::angleAxis(glm::radians(30.0f), glm::vec3{-1, 0, 0}); this->modelQuaternion *= glm::angleAxis(glm::radians(225.0f), glm::vec3{-0, 1, 0}); @@ -105,7 +105,7 @@ glEnable(GL_DEPTH_TEST); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(1.0f, 1.0f); - switch (this->renderStyle) + switch (this->renderPreferences.style) { case gl::RenderStyle::Normal: this->setFragmentStyle(gl::FragmentStyle::Normal); @@ -224,9 +224,14 @@ * @brief Changes the way the scene is rendered * @param newStyle new render style to use */ -void PartRenderer::setRenderStyle(const gl::RenderStyle newStyle) +void PartRenderer::setRenderPreferences(const gl::RenderPreferences& newPreferences) { - this->renderStyle = newStyle; + bool mainColorChanged = this->renderPreferences.mainColor != newPreferences.mainColor; + this->renderPreferences = newPreferences; + if (mainColorChanged) + { + this->compiler->build(this->model, this->documents, this->renderPreferences); + } this->update(); }