merge commit

Mon, 24 Aug 2020 23:00:50 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Mon, 24 Aug 2020 23:00:50 +0300
changeset 92
c438a7db7c52
parent 89
7abaf1d64719 (current diff)
parent 91
9eb5e06f34c3 (diff)
child 93
6fe24fd945c0

merge commit

CMakeLists.txt file | annotate | diff | comparison | revisions
src/basics.h file | annotate | diff | comparison | revisions
src/gl/common.h file | annotate | diff | comparison | revisions
src/gl/partrenderer.cpp file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Mon May 11 12:18:59 2020 +0300
+++ b/CMakeLists.txt	Mon Aug 24 23:00:50 2020 +0300
@@ -11,15 +11,20 @@
 find_package(Qt5OpenGL REQUIRED)
 find_package(Qt5Network REQUIRED)
 find_package(Qt5LinguistTools REQUIRED)
-find_package(GLUT REQUIRED)
 find_package(GLM REQUIRED)
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_AUTOUIC ON)
 set(CMAKE_AUTORCC ON)
 find_package(OpenGL REQUIRED)
 include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
-include_directories(${GLUT_INCLUDE_DIR})
 include_directories(${GLM_INCLUDE_DIR})
+source_group("1 Foundation code" REGULAR_EXPRESSION "src/.+\\.(cpp|h)")
+source_group("4 OpenGL renderer" REGULAR_EXPRESSION "src/gl/.+\\.(cpp|h)")
+source_group("5 LDraw line types" REGULAR_EXPRESSION "src/linetypes/.+\\.(cpp|h)")
+source_group("3 UI and widgets" REGULAR_EXPRESSION "src/(ui|widgets)/.+\\.(cpp|h)")
+source_group("3.1 Settings editor" REGULAR_EXPRESSION "src/settingseditor/.+\\.(cpp|h)")
+source_group("3.2 Main UI" REGULAR_EXPRESSION "src/(mainwindow|document|documentmanager|uiutilities)\\.(cpp|h)")
+source_group("2 Model handling" REGULAR_EXPRESSION "src/(model|modeleditcontext|libraries|colors|parser)\\.(cpp|h)")
 
 set (LDFORGE_SOURCES
 	src/colors.cpp
@@ -181,7 +186,6 @@
 set_source_files_properties(${LDFORGE_OTHER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE)
 set_target_properties(ldforge PROPERTIES AUTOMOC 1)
 target_link_libraries(ldforge Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES})
-target_link_libraries(ldforge ${GLUT_LIBRARIES})
 add_dependencies(ldforge resources)
 cotire(ldforge)
 
--- a/src/basics.h	Mon May 11 12:18:59 2020 +0300
+++ b/src/basics.h	Mon Aug 24 23:00:50 2020 +0300
@@ -81,7 +81,7 @@
 }
 
 template<typename T, int N>
-constexpr int countof(T(&)[N])
+constexpr int countof(T const (&)[N])
 {
 	return N;
 }
--- a/src/gl/common.h	Mon May 11 12:18:59 2020 +0300
+++ b/src/gl/common.h	Mon Aug 24 23:00:50 2020 +0300
@@ -168,22 +168,37 @@
 		ConditionalLines
 	};
 
+	constexpr ArrayClass ARRAY_CLASSES[] = {ArrayClass::Lines, ArrayClass::Triangles, ArrayClass::Quads, ArrayClass::ConditionalLines};
+	constexpr int NUM_ARRAY_CLASSES = countof(ARRAY_CLASSES);
+
+	// Different ways to render the scene
 	enum class RenderStyle
 	{
+		// Normal rendering style
 		Normal,
+		// Render all polygons as lines
 		Wireframe,
+		// Use green colour for front faces and red colour for back faces
 		BfcRedGreen,
+		// Use a different colour for each object
 		RandomColors,
+		// Render so that the colour of an object has an one to one correspondence with its id
 		PickScene
 	};
-
+	
+	// Different ways to render fragments.
 	// These are also defined in shaders
 	enum class FragmentStyle
 	{
+		// Use normal colours
 		Normal = 0,
+		// Use a distinctive green colour for BFC red/green view
 		BfcGreen = 1,
+		// Use a distinctive red colour for BFC red/green view
 		BfcRed = 2,
+		// Use a colour based on the object to distinguish objects
 		RandomColors = 3,
+		// Use a colour that codes the object's id
 		Id = 4,
 	};
 
--- a/src/gl/gridprogram.cpp	Mon May 11 12:18:59 2020 +0300
+++ b/src/gl/gridprogram.cpp	Mon Aug 24 23:00:50 2020 +0300
@@ -107,7 +107,7 @@
 
 int GridProgram::vertexCount() const
 {
-	return countof(data);
+	return glm::countof(data);
 }
 
 void GridProgram::setupVertexArrays()
--- a/src/gl/partrenderer.cpp	Mon May 11 12:18:59 2020 +0300
+++ b/src/gl/partrenderer.cpp	Mon Aug 24 23:00:50 2020 +0300
@@ -16,7 +16,6 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <GL/glut.h>
 #include <glm/ext/matrix_transform.hpp>
 #include <glm/ext/matrix_clip_space.hpp>
 #include <QMouseEvent>
--- a/src/main.cpp	Mon May 11 12:18:59 2020 +0300
+++ b/src/main.cpp	Mon Aug 24 23:00:50 2020 +0300
@@ -17,7 +17,6 @@
  */
 
 #include <QApplication>
-#include <GL/glut.h>
 #include "mainwindow.h"
 #include "version.h"
 #include <iostream>
@@ -25,7 +24,6 @@
 
 int main(int argc, char *argv[])
 {
-	::glutInit(&argc, argv);
 	QCoreApplication::setApplicationName(::appName);
 	QCoreApplication::setOrganizationName("hecknology.net");
 	QCoreApplication::setOrganizationDomain("hecknology.net");

mercurial