# HG changeset patch # User Teemu Piippo # Date 1580597466 -7200 # Node ID c6114b3af3a675d3f799f8785322f2fd64a54a95 # Parent 08dc62e03a6deeef171f2a2db884149576922f0a added configurable line thickness diff -r 08dc62e03a6d -r c6114b3af3a6 src/gl/common.h --- a/src/gl/common.h Sun Feb 02 00:50:57 2020 +0200 +++ b/src/gl/common.h Sun Feb 02 00:51:06 2020 +0200 @@ -156,6 +156,6 @@ gl::RenderStyle style = gl::RenderStyle::Normal; QColor mainColor{255, 255, 64}; QColor backgroundColor{48, 48, 48}; - float lineThickness = 2.0f; + GLfloat lineThickness = 2.0f; }; } diff -r 08dc62e03a6d -r c6114b3af3a6 src/gl/partrenderer.cpp --- a/src/gl/partrenderer.cpp Sun Feb 02 00:50:57 2020 +0200 +++ b/src/gl/partrenderer.cpp Sun Feb 02 00:51:06 2020 +0200 @@ -54,7 +54,6 @@ 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}); this->updateViewMatrix(); - glLineWidth(2.0); this->update(); } @@ -110,6 +109,7 @@ glEnable(GL_DEPTH_TEST); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(1.0f, 1.0f); + glLineWidth(this->renderPreferences.lineThickness); switch (this->renderPreferences.style) { case gl::RenderStyle::Normal: @@ -232,8 +232,9 @@ void PartRenderer::setRenderPreferences(const gl::RenderPreferences& newPreferences) { bool mainColorChanged = this->renderPreferences.mainColor != newPreferences.mainColor; + bool backgroundColorChanged = this->renderPreferences.backgroundColor != newPreferences.backgroundColor; this->renderPreferences = newPreferences; - if (mainColorChanged) + if (mainColorChanged or backgroundColorChanged) { this->compiler->build(this->model, this->documents, this->renderPreferences); } diff -r 08dc62e03a6d -r c6114b3af3a6 src/mainwindow.cpp --- a/src/mainwindow.cpp Sun Feb 02 00:50:57 2020 +0200 +++ b/src/mainwindow.cpp Sun Feb 02 00:51:06 2020 +0200 @@ -317,6 +317,7 @@ this->renderPreferences.style = static_cast(this->settings.renderStyle()); this->renderPreferences.mainColor = this->settings.mainColor(); this->renderPreferences.backgroundColor = this->settings.backgroundColor(); + this->renderPreferences.lineThickness = this->settings.lineThickness(); const QString systemLocale = QLocale::system().name(); const QVariant defaultLocale = this->settings.locale(); this->changeLanguage(defaultLocale.toString()); diff -r 08dc62e03a6d -r c6114b3af3a6 src/settingseditor/settingseditor.cpp --- a/src/settingseditor/settingseditor.cpp Sun Feb 02 00:50:57 2020 +0200 +++ b/src/settingseditor/settingseditor.cpp Sun Feb 02 00:51:06 2020 +0200 @@ -40,6 +40,7 @@ this->settings->setLocale(this->ui.language->currentData().toString()); this->settings->setMainColor(this->ui.mainColorButton->selectedColor()); this->settings->setBackgroundColor(this->ui.backgroundColorButton->selectedColor()); + this->settings->setLineThickness(static_cast(this->ui.lineThickness->value())); this->librariesEditor.saveSettings(this->settings); } @@ -70,6 +71,7 @@ this->setCurrentLanguage(this->settings->locale()); this->ui.mainColorButton->setSelectedColor(this->settings->mainColor()); this->ui.backgroundColorButton->setSelectedColor(this->settings->backgroundColor()); + this->ui.lineThickness->setValue(static_cast(this->settings->lineThickness())); } void SettingsEditor::setCurrentLanguage(const QString& localeCode) diff -r 08dc62e03a6d -r c6114b3af3a6 src/settingseditor/settingseditor.ui --- a/src/settingseditor/settingseditor.ui Sun Feb 02 00:50:57 2020 +0200 +++ b/src/settingseditor/settingseditor.ui Sun Feb 02 00:51:06 2020 +0200 @@ -76,78 +76,58 @@ Rendering - - - - - Main colour: - - - - - - + + + + + + + Main colour: + + + + - - - - Qt::Horizontal + + + + Background colour: - - - 40 - 20 - - - + - - - - - - Background colour: - - - - - - + - - - - Qt::Horizontal + + + + Line thickness: - - - 40 - 20 - - - + + + + - - + + - Qt::Vertical + Qt::Horizontal - 20 - 40 + 316 + 20