Sun, 02 Feb 2020 00:51:06 +0200
added configurable line thickness
--- 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; }; }
--- 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); }
--- 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<gl::RenderStyle>(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());
--- 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<GLfloat>(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<double>(this->settings->lineThickness())); } void SettingsEditor::setCurrentLanguage(const QString& localeCode)
--- 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 @@ <property name="title"> <string>Rendering</string> </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Main colour:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Main colour:</string> + </property> + </widget> + </item> + <item row="0" column="1"> <widget class="ColorButton" name="mainColorButton"> <property name="text"> <string/> </property> </widget> </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Background colour:</string> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> + </widget> </item> - </layout> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Background colour:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> + <item row="1" column="1"> <widget class="ColorButton" name="backgroundColorButton"> <property name="text"> <string/> </property> </widget> </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <item row="2" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Line thickness:</string> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> + </widget> + </item> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="lineThickness"/> </item> </layout> </item> - <item row="2" column="0"> - <spacer name="verticalSpacer_2"> + <item> + <spacer name="horizontalSpacer_3"> <property name="orientation"> - <enum>Qt::Vertical</enum> + <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>20</width> - <height>40</height> + <width>316</width> + <height>20</height> </size> </property> </spacer>