src/gl/partrenderer.cpp

changeset 48
3c10f0e2fbe0
parent 47
cd6704009eb9
child 51
1a9eac27698d
equal deleted inserted replaced
47:cd6704009eb9 48:3c10f0e2fbe0
90 glShadeModel(GL_SMOOTH); 90 glShadeModel(GL_SMOOTH);
91 glEnable(GL_MULTISAMPLE); 91 glEnable(GL_MULTISAMPLE);
92 this->renderScene(); 92 this->renderScene();
93 } 93 }
94 94
95 static QVector3D vec3FromQColor(const QColor& color)
96 {
97 return {(float)color.redF(), (float)color.greenF(), (float)color.blueF()};
98 }
99
95 void PartRenderer::renderScene() 100 void PartRenderer::renderScene()
96 { 101 {
97 if (this->renderPreferences.lineAntiAliasing && this->renderPreferences.style != gl::RenderStyle::PickScene) 102 if (this->renderPreferences.lineAntiAliasing && this->renderPreferences.style != gl::RenderStyle::PickScene)
98 { 103 {
99 glEnable(GL_LINE_SMOOTH); 104 glEnable(GL_LINE_SMOOTH);
115 else 120 else
116 { 121 {
117 glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 122 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
118 this->compiler->setUniform("useLighting", false); 123 this->compiler->setUniform("useLighting", false);
119 } 124 }
125 this->compiler->setUniform("selectedColor", vec3FromQColor(this->renderPreferences.selectedColor));
126 this->compiler->setUniform("highlighted", this->highlighted.value);
120 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 127 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
121 glEnable(GL_DEPTH_TEST); 128 glEnable(GL_DEPTH_TEST);
122 glEnable(GL_POLYGON_OFFSET_FILL); 129 glEnable(GL_POLYGON_OFFSET_FILL);
123 glPolygonOffset(1.0f, 1.0f); 130 glPolygonOffset(1.0f, 1.0f);
124 glLineWidth(this->renderPreferences.lineThickness); 131 glLineWidth(this->renderPreferences.lineThickness);
272 this->compiler->build(this->model, this->documents, this->renderPreferences); 279 this->compiler->build(this->model, this->documents, this->renderPreferences);
273 } 280 }
274 this->update(); 281 this->update();
275 } 282 }
276 283
284 void PartRenderer::setHighlight(ldraw::Id highlightedId)
285 {
286 this->highlighted = highlightedId;
287 }
288

mercurial