added configurable line anti-aliasing

Sun, 02 Feb 2020 00:58:59 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 02 Feb 2020 00:58:59 +0200
changeset 45
272c84c7c87e
parent 44
c6114b3af3a6
child 46
98645c8e7704

added configurable line anti-aliasing

locale/fi.ts file | annotate | diff | comparison | revisions
locale/sv.ts file | annotate | diff | comparison | revisions
src/configurationoptions.txt file | annotate | diff | comparison | revisions
src/gl/common.h file | annotate | diff | comparison | revisions
src/gl/partrenderer.cpp file | annotate | diff | comparison | revisions
src/mainwindow.cpp file | annotate | diff | comparison | revisions
src/settingseditor/settingseditor.cpp file | annotate | diff | comparison | revisions
src/settingseditor/settingseditor.ui file | annotate | diff | comparison | revisions
--- a/locale/fi.ts	Sun Feb 02 00:51:06 2020 +0200
+++ b/locale/fi.ts	Sun Feb 02 00:58:59 2020 +0200
@@ -209,7 +209,7 @@
 <context>
     <name>PartRenderer</name>
     <message>
-        <location filename="../src/gl/partrenderer.cpp" line="184"/>
+        <location filename="../src/gl/partrenderer.cpp" line="190"/>
         <source>Rendering error</source>
         <translation type="unfinished"></translation>
     </message>
@@ -238,7 +238,7 @@
     </message>
     <message>
         <location filename="../src/settingseditor/settingseditor.ui" line="46"/>
-        <location filename="../src/settingseditor/settingseditor.cpp" line="57"/>
+        <location filename="../src/settingseditor/settingseditor.cpp" line="59"/>
         <source>System language</source>
         <translation>Järjestelmän kieli</translation>
     </message>
@@ -253,22 +253,32 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settingseditor/settingseditor.ui" line="83"/>
+        <location filename="../src/settingseditor/settingseditor.ui" line="85"/>
         <source>Main colour:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settingseditor/settingseditor.ui" line="114"/>
+        <location filename="../src/settingseditor/settingseditor.ui" line="99"/>
         <source>Background colour:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settingseditor/settingseditor.ui" line="175"/>
+        <location filename="../src/settingseditor/settingseditor.ui" line="113"/>
+        <source>Line thickness:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/settingseditor/settingseditor.ui" line="123"/>
+        <source>Line anti-aliasing</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/settingseditor/settingseditor.ui" line="162"/>
         <source>LDraw parts libraries</source>
         <translation>LDraw-osakirjastot</translation>
     </message>
     <message>
-        <location filename="../src/settingseditor/settingseditor.ui" line="180"/>
+        <location filename="../src/settingseditor/settingseditor.ui" line="167"/>
         <source>Keyboard shortcuts</source>
         <translation>Näppäinyhdistelmät</translation>
     </message>
--- a/locale/sv.ts	Sun Feb 02 00:51:06 2020 +0200
+++ b/locale/sv.ts	Sun Feb 02 00:58:59 2020 +0200
@@ -282,6 +282,14 @@
         <source>Background colour:</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Line thickness:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Line anti-aliasing</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>gl::Compiler</name>
--- a/src/configurationoptions.txt	Sun Feb 02 00:51:06 2020 +0200
+++ b/src/configurationoptions.txt	Sun Feb 02 00:58:59 2020 +0200
@@ -12,9 +12,9 @@
 option BackgroundColor = QColor{48, 48, 48}
 option MainColor = QColor{255, 255, 64}
 option LineThickness = 2.0f
+option LineAntiAliasing = true
 option RenderStyle = 0
 option DrawWireframe = false
-option AntiAliasedLines = true
 option MainWindowGeometry = QByteArray{}
 option MainSplitterState = QByteArray{}
 option RecentFiles = QStringList{}
--- a/src/gl/common.h	Sun Feb 02 00:51:06 2020 +0200
+++ b/src/gl/common.h	Sun Feb 02 00:58:59 2020 +0200
@@ -157,5 +157,6 @@
 		QColor mainColor{255, 255, 64};
 		QColor backgroundColor{48, 48, 48};
 		GLfloat lineThickness = 2.0f;
+		bool lineAntiAliasing = true;
 	};
 }
--- a/src/gl/partrenderer.cpp	Sun Feb 02 00:51:06 2020 +0200
+++ b/src/gl/partrenderer.cpp	Sun Feb 02 00:58:59 2020 +0200
@@ -92,8 +92,14 @@
 	glEnable (GL_DEPTH_TEST);
 	glShadeModel (GL_SMOOTH);
 	glEnable (GL_MULTISAMPLE);
-	glEnable (GL_LINE_SMOOTH);
-	glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+	if (this->renderPreferences.lineAntiAliasing)
+	{
+		glEnable(GL_LINE_SMOOTH);
+		glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+	}
+	else {
+		glDisable(GL_LINE_SMOOTH);
+	}
 	this->renderScene();
 }
 
--- a/src/mainwindow.cpp	Sun Feb 02 00:51:06 2020 +0200
+++ b/src/mainwindow.cpp	Sun Feb 02 00:58:59 2020 +0200
@@ -318,6 +318,7 @@
 	this->renderPreferences.mainColor = this->settings.mainColor();
 	this->renderPreferences.backgroundColor = this->settings.backgroundColor();
 	this->renderPreferences.lineThickness = this->settings.lineThickness();
+	this->renderPreferences.lineAntiAliasing = this->settings.lineAntiAliasing();
 	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:51:06 2020 +0200
+++ b/src/settingseditor/settingseditor.cpp	Sun Feb 02 00:58:59 2020 +0200
@@ -41,6 +41,7 @@
 	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->settings->setLineAntiAliasing(this->ui.lineAntiAliasing->isChecked());
 	this->librariesEditor.saveSettings(this->settings);
 }
 
@@ -72,6 +73,7 @@
 	this->ui.mainColorButton->setSelectedColor(this->settings->mainColor());
 	this->ui.backgroundColorButton->setSelectedColor(this->settings->backgroundColor());
 	this->ui.lineThickness->setValue(static_cast<double>(this->settings->lineThickness()));
+	this->ui.lineAntiAliasing->setChecked(this->settings->lineAntiAliasing());
 }
 
 void SettingsEditor::setCurrentLanguage(const QString& localeCode)
--- a/src/settingseditor/settingseditor.ui	Sun Feb 02 00:51:06 2020 +0200
+++ b/src/settingseditor/settingseditor.ui	Sun Feb 02 00:58:59 2020 +0200
@@ -117,6 +117,13 @@
             <item row="2" column="1">
              <widget class="QDoubleSpinBox" name="lineThickness"/>
             </item>
+            <item row="3" column="0">
+             <widget class="QCheckBox" name="lineAntiAliasing">
+              <property name="text">
+               <string>Line anti-aliasing</string>
+              </property>
+             </widget>
+            </item>
            </layout>
           </item>
           <item>

mercurial