| 47 if (glGetError() != GL_NO_ERROR) |
47 if (glGetError() != GL_NO_ERROR) |
| 48 { |
48 { |
| 49 abort(); |
49 abort(); |
| 50 } |
50 } |
| 51 this->compiler->initialize(); |
51 this->compiler->initialize(); |
| 52 this->compiler->build(this->model, this->documents); |
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); |
57 glLineWidth(2.0); |
| 103 glClearColor(0.8f, 0.8f, 0.8f, 1.0f); |
103 glClearColor(0.8f, 0.8f, 0.8f, 1.0f); |
| 104 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
104 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 105 glEnable(GL_DEPTH_TEST); |
105 glEnable(GL_DEPTH_TEST); |
| 106 glEnable(GL_POLYGON_OFFSET_FILL); |
106 glEnable(GL_POLYGON_OFFSET_FILL); |
| 107 glPolygonOffset(1.0f, 1.0f); |
107 glPolygonOffset(1.0f, 1.0f); |
| 108 switch (this->renderStyle) |
108 switch (this->renderPreferences.style) |
| 109 { |
109 { |
| 110 case gl::RenderStyle::Normal: |
110 case gl::RenderStyle::Normal: |
| 111 this->setFragmentStyle(gl::FragmentStyle::Normal); |
111 this->setFragmentStyle(gl::FragmentStyle::Normal); |
| 112 this->renderAllArrays(); |
112 this->renderAllArrays(); |
| 113 break; |
113 break; |
| 222 |
222 |
| 223 /** |
223 /** |
| 224 * @brief Changes the way the scene is rendered |
224 * @brief Changes the way the scene is rendered |
| 225 * @param newStyle new render style to use |
225 * @param newStyle new render style to use |
| 226 */ |
226 */ |
| 227 void PartRenderer::setRenderStyle(const gl::RenderStyle newStyle) |
227 void PartRenderer::setRenderPreferences(const gl::RenderPreferences& newPreferences) |
| 228 { |
228 { |
| 229 this->renderStyle = newStyle; |
229 bool mainColorChanged = this->renderPreferences.mainColor != newPreferences.mainColor; |
| |
230 this->renderPreferences = newPreferences; |
| |
231 if (mainColorChanged) |
| |
232 { |
| |
233 this->compiler->build(this->model, this->documents, this->renderPreferences); |
| |
234 } |
| 230 this->update(); |
235 this->update(); |
| 231 } |
236 } |
| 232 |
237 |