52 this->compiler->build(this->model, this->documents, this->renderPreferences); |
52 this->compiler->build(this->model, this->documents, this->renderPreferences); |
53 this->initialized = true; |
53 this->initialized = true; |
54 this->modelQuaternion = glm::angleAxis(glm::radians(30.0f), glm::vec3{-1, 0, 0}); |
54 this->modelQuaternion = glm::angleAxis(glm::radians(30.0f), glm::vec3{-1, 0, 0}); |
55 this->modelQuaternion *= glm::angleAxis(glm::radians(225.0f), glm::vec3{-0, 1, 0}); |
55 this->modelQuaternion *= glm::angleAxis(glm::radians(225.0f), glm::vec3{-0, 1, 0}); |
56 this->updateViewMatrix(); |
56 this->updateViewMatrix(); |
57 glLineWidth(2.0); |
|
58 this->update(); |
57 this->update(); |
59 } |
58 } |
60 |
59 |
61 void PartRenderer::resizeGL(int width, int height) |
60 void PartRenderer::resizeGL(int width, int height) |
62 { |
61 { |
108 1.0f); |
107 1.0f); |
109 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
108 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
110 glEnable(GL_DEPTH_TEST); |
109 glEnable(GL_DEPTH_TEST); |
111 glEnable(GL_POLYGON_OFFSET_FILL); |
110 glEnable(GL_POLYGON_OFFSET_FILL); |
112 glPolygonOffset(1.0f, 1.0f); |
111 glPolygonOffset(1.0f, 1.0f); |
|
112 glLineWidth(this->renderPreferences.lineThickness); |
113 switch (this->renderPreferences.style) |
113 switch (this->renderPreferences.style) |
114 { |
114 { |
115 case gl::RenderStyle::Normal: |
115 case gl::RenderStyle::Normal: |
116 this->setFragmentStyle(gl::FragmentStyle::Normal); |
116 this->setFragmentStyle(gl::FragmentStyle::Normal); |
117 this->renderAllArrays(); |
117 this->renderAllArrays(); |
230 * @param newStyle new render style to use |
230 * @param newStyle new render style to use |
231 */ |
231 */ |
232 void PartRenderer::setRenderPreferences(const gl::RenderPreferences& newPreferences) |
232 void PartRenderer::setRenderPreferences(const gl::RenderPreferences& newPreferences) |
233 { |
233 { |
234 bool mainColorChanged = this->renderPreferences.mainColor != newPreferences.mainColor; |
234 bool mainColorChanged = this->renderPreferences.mainColor != newPreferences.mainColor; |
|
235 bool backgroundColorChanged = this->renderPreferences.backgroundColor != newPreferences.backgroundColor; |
235 this->renderPreferences = newPreferences; |
236 this->renderPreferences = newPreferences; |
236 if (mainColorChanged) |
237 if (mainColorChanged or backgroundColorChanged) |
237 { |
238 { |
238 this->compiler->build(this->model, this->documents, this->renderPreferences); |
239 this->compiler->build(this->model, this->documents, this->renderPreferences); |
239 } |
240 } |
240 this->update(); |
241 this->update(); |
241 } |
242 } |