Remove Q3DO export.
It was added in 3a3a2755b
as a potential way to export colorful meshes
to Horizon EDA but ended up being supported only by SolveSpace. Since no
software can consume the exported q3do files the feature is superfluous.
See https://github.com/solvespace/solvespace/issues/795 for details.
pull/814/head
parent
427a29abb2
commit
942bf3f354
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 "")
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit de1f0342c86fc00955f6047937fac05e56b9b54c
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 880db1d34706778f216a2308fd82a9a3adacb314
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<RgbaColor, flatbuffers::Offset<q3d::Material>, RgbaColorCompare> materials;
|
||||
std::map<RgbaColor, std::vector<flatbuffers::Offset<q3d::Triangle>>, 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<flatbuffers::Offset<q3d::Mesh>> 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.
|
||||
|
|
|
@ -99,7 +99,6 @@ std::vector<FileFilter> 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" } },
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue