# HG changeset patch # User Teemu Piippo # Date 1598299250 -10800 # Node ID c438a7db7c52ad40207ced35a2d8489a021abeee # Parent 7abaf1d64719e30ef707e891d259481ce7b4386a# Parent 9eb5e06f34c3ae9df66563efd6fd50380e2c3507 merge commit diff -r 7abaf1d64719 -r c438a7db7c52 CMakeLists.txt --- 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) diff -r 7abaf1d64719 -r c438a7db7c52 src/basics.h --- 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 -constexpr int countof(T(&)[N]) +constexpr int countof(T const (&)[N]) { return N; } diff -r 7abaf1d64719 -r c438a7db7c52 src/gl/common.h --- 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, }; diff -r 7abaf1d64719 -r c438a7db7c52 src/gl/gridprogram.cpp --- 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() diff -r 7abaf1d64719 -r c438a7db7c52 src/gl/partrenderer.cpp --- 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 . */ -#include #include #include #include diff -r 7abaf1d64719 -r c438a7db7c52 src/main.cpp --- 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 -#include #include "mainwindow.h" #include "version.h" #include @@ -25,7 +24,6 @@ int main(int argc, char *argv[]) { - ::glutInit(&argc, argv); QCoreApplication::setApplicationName(::appName); QCoreApplication::setOrganizationName("hecknology.net"); QCoreApplication::setOrganizationDomain("hecknology.net");