diff --git a/.gitmodules b/.gitmodules index 5119320..71384a1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,12 +20,6 @@ [submodule "extlib/angle"] path = extlib/angle url = https://github.com/solvespace/angle -[submodule "extlib/flatbuffers"] - path = extlib/flatbuffers - url = https://github.com/google/flatbuffers -[submodule "extlib/q3d"] - path = extlib/q3d - url = https://github.com/q3k/q3d [submodule "extlib/mimalloc"] path = extlib/mimalloc url = https://github.com/microsoft/mimalloc diff --git a/.travis/install-ubuntu.sh b/.travis/install-ubuntu.sh index fb20fff..53f88b2 100755 --- a/.travis/install-ubuntu.sh +++ b/.travis/install-ubuntu.sh @@ -7,4 +7,4 @@ sudo apt-get install -q -y \ libfontconfig1-dev libgtkmm-3.0-dev libpangomm-1.4-dev libgl-dev \ libgl-dev libglu-dev libspnav-dev -git submodule update --init extlib/libdxfrw extlib/flatbuffers extlib/q3d extlib/mimalloc +git submodule update --init extlib/libdxfrw extlib/mimalloc diff --git a/CHANGELOG.md b/CHANGELOG.md index f3faa47..a7a4032 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,7 +53,8 @@ New export/import features: * Wavefront OBJ: a material file is exported alongside the model, containing mesh color information. * DXF/DWG: 3D DXF files are imported as construction entities, in 3d. - * Q3D: [Q3D](https://github.com/q3k/q3d/) triangle meshes can now be + * [ADDED 2019-02-25](https://github.com/solvespace/solvespace/pull/384) and [REMOVED 2020-11-13](https://github.com/solvespace/solvespace/issues/795): + Q3D: [Q3D](https://github.com/q3k/q3d/) triangle meshes can now be exported. This format allows to easily hack on triangle mesh data created in SolveSpace, supports colour information and is more space efficient than most other formats. diff --git a/CMakeLists.txt b/CMakeLists.txt index ad23d98..6cdca35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,17 +182,6 @@ endif() message(STATUS "Using in-tree libdxfrw") add_subdirectory(extlib/libdxfrw) -message(STATUS "Using in-tree flatbuffers") -set(FLATBUFFERS_BUILD_FLATLIB ON CACHE BOOL "") -set(FLATBUFFERS_BUILD_FLATC ON CACHE BOOL "") -set(FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "") -set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "") -add_subdirectory(extlib/flatbuffers EXCLUDE_FROM_ALL) - -message(STATUS "Using in-tree q3d") -add_subdirectory(extlib/q3d) -set(Q3D_INCLUDE_DIR ${CMAKE_BINARY_DIR}/extlib/q3d) - message(STATUS "Using in-tree mimalloc") set(MI_OVERRIDE OFF CACHE BOOL "") set(MI_BUILD_SHARED OFF CACHE BOOL "") diff --git a/README.md b/README.md index 394e33d..cbeb89f 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ Before building, check out the project and the necessary submodules: git clone https://github.com/solvespace/solvespace cd solvespace - git submodule update --init extlib/libdxfrw extlib/flatbuffers extlib/q3d extlib/mimalloc + git submodule update --init extlib/libdxfrw extlib/mimalloc After that, build SolveSpace as following: @@ -108,7 +108,7 @@ Ubuntu will require 20.04 or above. Cross-compiling with WSL is also confirmed t You will need the usual build tools, CMake, a Windows cross-compiler, and flatc. On a Debian derivative (e.g. Ubuntu) these can be installed with: - apt-get install git build-essential cmake mingw-w64 libflatbuffers-dev + apt-get install git build-essential cmake mingw-w64 Before building, check out the project and the necessary submodules: @@ -182,7 +182,7 @@ Before building, check out the project and the necessary submodules: git clone https://github.com/solvespace/solvespace cd solvespace - git submodule update --init extlib/libdxfrw extlib/flatbuffers extlib/q3d extlib/mimalloc + git submodule update --init extlib/libdxfrw extlib/mimalloc After that, build SolveSpace as following: diff --git a/extlib/flatbuffers b/extlib/flatbuffers deleted file mode 160000 index de1f034..0000000 --- a/extlib/flatbuffers +++ /dev/null @@ -1 +0,0 @@ -Subproject commit de1f0342c86fc00955f6047937fac05e56b9b54c diff --git a/extlib/q3d b/extlib/q3d deleted file mode 160000 index 880db1d..0000000 --- a/extlib/q3d +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 880db1d34706778f216a2308fd82a9a3adacb314 diff --git a/pkg/snap/snap/snapcraft.yaml b/pkg/snap/snap/snapcraft.yaml index 400ea19..5fe5f7b 100644 --- a/pkg/snap/snap/snapcraft.yaml +++ b/pkg/snap/snap/snapcraft.yaml @@ -45,7 +45,7 @@ parts: snapcraftctl set-version "$version" git describe --exact-match HEAD && grade="stable" || grade="devel" snapcraftctl set-grade "$grade" - git submodule update --init extlib/libdxfrw extlib/flatbuffers extlib/q3d extlib/mimalloc + git submodule update --init extlib/libdxfrw extlib/mimalloc configflags: - -DCMAKE_INSTALL_PREFIX=/usr - -DCMAKE_BUILD_TYPE=Release diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a46e24..d6b1352 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -80,7 +80,6 @@ include_directories( ${PNG_PNG_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS} - ${Q3D_INCLUDE_DIR} ${MIMALLOC_INCLUDE_DIR}) if(Backtrace_FOUND) @@ -214,7 +213,6 @@ add_library(solvespace-core STATIC ${solvespace_core_SOURCES}) add_dependencies(solvespace-core - q3d_header mimalloc-static) target_link_libraries(solvespace-core @@ -224,7 +222,6 @@ target_link_libraries(solvespace-core ${ZLIB_LIBRARY} ${PNG_LIBRARY} ${FREETYPE_LIBRARY} - flatbuffers mimalloc-static) if(Backtrace_FOUND) diff --git a/src/export.cpp b/src/export.cpp index e0c6182..f5649b6 100644 --- a/src/export.cpp +++ b/src/export.cpp @@ -843,8 +843,6 @@ void SolveSpaceUI::ExportMeshTo(const Platform::Path &filename) { ExportMeshAsObjTo(f, fMtl, m); fclose(fMtl); - } else if(filename.HasExtension("q3do")) { - ExportMeshAsQ3doTo(f, m); } else if(filename.HasExtension("js") || filename.HasExtension("html")) { SOutlineList *e = &(SK.GetGroup(SS.GW.activeGroup)->displayOutlines); @@ -898,54 +896,6 @@ void SolveSpaceUI::ExportMeshAsStlTo(FILE *f, SMesh *sm) { } } -//----------------------------------------------------------------------------- -// Export the mesh as a Q3DO (https://github.com/q3k/q3d) file. -//----------------------------------------------------------------------------- - -#include "q3d_object_generated.h" -void SolveSpaceUI::ExportMeshAsQ3doTo(FILE *f, SMesh *sm) { - flatbuffers::FlatBufferBuilder builder(1024); - double s = SS.exportScale; - - // Create a material for every colour used, keep note of triangles belonging to color/material. - std::map, RgbaColorCompare> materials; - std::map>, RgbaColorCompare> materialTriangles; - for (const STriangle &t : sm->l) { - auto color = t.meta.color; - if (materials.find(color) == materials.end()) { - auto name = builder.CreateString(ssprintf("Color #%02x%02x%02x%02x", color.red, color.green, color.blue, color.alpha)); - auto co = q3d::CreateColor(builder, color.red, color.green, color.blue, color.alpha); - auto mo = q3d::CreateMaterial(builder, name, co); - materials.emplace(color, mo); - } - - Vector faceNormal = t.Normal(); - auto a = q3d::Vector3((float)(t.a.x/s), (float)(t.a.y/s), (float)(t.a.z/s)); - auto b = q3d::Vector3((float)(t.b.x/s), (float)(t.b.y/s), (float)(t.b.z/s)); - auto c = q3d::Vector3((float)(t.c.x/s), (float)(t.c.y/s), (float)(t.c.z/s)); - auto fn = q3d::Vector3((float)faceNormal.x, (float)faceNormal.y, (float)faceNormal.x); - auto n1 = q3d::Vector3((float)t.normals[0].x, (float)t.normals[0].y, (float)t.normals[0].z); - auto n2 = q3d::Vector3((float)t.normals[1].x, (float)t.normals[1].y, (float)t.normals[1].z); - auto n3 = q3d::Vector3((float)t.normals[2].x, (float)t.normals[2].y, (float)t.normals[2].z); - auto tri = q3d::CreateTriangle(builder, &a, &b, &c, &fn, &n1, &n2, &n3); - materialTriangles[color].push_back(tri); - } - - // Build all meshes sorted by material. - std::vector> meshes; - for (auto &it : materials) { - auto &mato = it.second; - auto to = builder.CreateVector(materialTriangles[it.first]); - auto mo = q3d::CreateMesh(builder, to, mato); - meshes.push_back(mo); - } - - auto mo = builder.CreateVector(meshes); - auto o = q3d::CreateObject(builder, mo); - q3d::FinishObjectBuffer(builder, o); - fwrite(builder.GetBufferPointer(), builder.GetSize(), 1, f); -} - //----------------------------------------------------------------------------- // Export the mesh as Wavefront OBJ format. This requires us to reduce all the // identical vertices to the same identifier, so do that first. diff --git a/src/platform/gui.cpp b/src/platform/gui.cpp index ff9b2cf..28fded4 100644 --- a/src/platform/gui.cpp +++ b/src/platform/gui.cpp @@ -99,7 +99,6 @@ std::vector MeshFileFilters = { { CN_("file-type", "Wavefront OBJ mesh"), { "obj" } }, { CN_("file-type", "Three.js-compatible mesh, with viewer"), { "html" } }, { CN_("file-type", "Three.js-compatible mesh, mesh only"), { "js" } }, - { CN_("file-type", "Q3D Object file"), { "q3do" } }, { CN_("file-type", "VRML text file"), { "wrl" } }, }; diff --git a/src/solvespace.h b/src/solvespace.h index e8eeddc..e64a1ab 100644 --- a/src/solvespace.h +++ b/src/solvespace.h @@ -686,7 +686,6 @@ public: void ExportAsPngTo(const Platform::Path &filename); void ExportMeshTo(const Platform::Path &filename); void ExportMeshAsStlTo(FILE *f, SMesh *sm); - void ExportMeshAsQ3doTo(FILE *f, SMesh *sm); void ExportMeshAsObjTo(FILE *fObj, FILE *fMtl, SMesh *sm); void ExportMeshAsThreeJsTo(FILE *f, const Platform::Path &filename, SMesh *sm, SOutlineList *sol);