Update to 2021.01

Also enable 3mf support, as this OpenSCAD version supports Fedora's lib3mf version.
This commit is contained in:
Miro Hrončok 2021-02-20 00:49:07 +01:00
parent 9e700b4494
commit f1d7001b38
6 changed files with 18 additions and 292 deletions

View File

@ -1,206 +0,0 @@
From 87c05067f5267c9e678435c462e7b5a5a32e1f1b Mon Sep 17 00:00:00 2001
From: Torsten Paul <Torsten.Paul@gmx.de>
Date: Sun, 16 Jun 2019 23:02:38 +0200
Subject: [PATCH 1/3] Have Reindexer return a const ref instead of a pointer
into value array.
---
src/GeometryUtils.cc | 2 +-
src/GeometryUtils.h | 2 +-
src/Reindexer.h | 12 +++++++-----
src/export_off.cc | 2 +-
src/polyset-utils.cc | 2 +-
5 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/GeometryUtils.cc b/src/GeometryUtils.cc
index d1a740d3ff..347164e08a 100644
--- a/src/GeometryUtils.cc
+++ b/src/GeometryUtils.cc
@@ -188,7 +188,7 @@ class EdgeDict {
Returns true on error, false on success.
*/
-bool GeometryUtils::tessellatePolygonWithHoles(const Vector3f *vertices,
+bool GeometryUtils::tessellatePolygonWithHoles(const std::vector<Vector3f>& vertices,
const std::vector<IndexedFace> &faces,
std::vector<IndexedTriangle> &triangles,
const Vector3f *normal)
diff --git a/src/GeometryUtils.h b/src/GeometryUtils.h
index 5260b0aa61..073c41335a 100644
--- a/src/GeometryUtils.h
+++ b/src/GeometryUtils.h
@@ -29,7 +29,7 @@ namespace GeometryUtils {
bool tessellatePolygon(const Polygon &polygon,
Polygons &triangles,
const Vector3f *normal = nullptr);
- bool tessellatePolygonWithHoles(const Vector3f *vertices,
+ bool tessellatePolygonWithHoles(const std::vector<Vector3f>& vertices,
const std::vector<IndexedFace> &faces,
std::vector<IndexedTriangle> &triangles,
const Vector3f *normal = nullptr);
diff --git a/src/Reindexer.h b/src/Reindexer.h
index f9ad6bc69d..8abbd21461 100644
--- a/src/Reindexer.h
+++ b/src/Reindexer.h
@@ -4,6 +4,8 @@
#include <functional>
#include <vector>
#include <algorithm>
+#include <boost/range/adaptor/map.hpp>
+#include <boost/range/algorithm/copy.hpp>
#include "hash.h"
/*!
@@ -39,14 +41,14 @@ class Reindexer
/*!
Return the new element array.
*/
- const T *getArray() {
- this->vec.resize(this->map.size());
- typename std::unordered_map<T, int>::const_iterator iter = this->map.begin();
+ const std::vector<T>& getArray() {
+ this->vec.resize(this->map.size());
+ typename std::unordered_map<T, int>::const_iterator iter = this->map.begin();
while (iter != this->map.end()) {
this->vec[iter->second] = iter->first;
iter++;
- }
- return &this->vec[0];
+ }
+ return this->vec;
}
/*!
diff --git a/src/export_off.cc b/src/export_off.cc
index 8a74d60cd4..f18134aac8 100644
--- a/src/export_off.cc
+++ b/src/export_off.cc
@@ -83,7 +83,7 @@ void export_off(const shared_ptr<const Geometry> &geom, std::ostream &output)
append_geometry(geom, mesh);
output << "OFF " << mesh.vertices.size() << " " << mesh.numfaces << " 0\n";
- const Vector3d *v = mesh.vertices.getArray();
+ const auto v = mesh.vertices.getArray();
size_t numverts = mesh.vertices.size();
for (size_t i=0;i<numverts;i++) {
output << v[i][0] << " " << v[i][1] << " " << v[i][2] << " " << "\n";
diff --git a/src/polyset-utils.cc b/src/polyset-utils.cc
index 84951caba3..6f964d8186 100644
--- a/src/polyset-utils.cc
+++ b/src/polyset-utils.cc
@@ -78,7 +78,7 @@ namespace PolysetUtils {
}
// Tessellate indexed mesh
- const auto *verts = allVertices.getArray();
+ const auto verts = allVertices.getArray();
std::vector<IndexedTriangle> allTriangles;
for (const auto &faces : polygons) {
std::vector<IndexedTriangle> triangles;
From 0cc0c9869079fbbd43d3c8658947b74084e83ca5 Mon Sep 17 00:00:00 2001
From: Torsten Paul <Torsten.Paul@gmx.de>
Date: Sun, 23 Jun 2019 17:50:53 +0200
Subject: [PATCH 2/3] Enforce reference type to prevent copying.
---
src/GeometryUtils.cc | 2 +-
src/cgalutils.cc | 2 +-
src/export_off.cc | 2 +-
src/polyset-utils.cc | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/GeometryUtils.cc b/src/GeometryUtils.cc
index 347164e08a..c5919ca681 100644
--- a/src/GeometryUtils.cc
+++ b/src/GeometryUtils.cc
@@ -430,7 +430,7 @@ bool GeometryUtils::tessellatePolygon(const Polygon &polygon, Polygons &triangle
}
if (currface.front() == currface.back()) currface.pop_back();
if (currface.size() >= 3) { // Cull empty triangles
- const auto verts = uniqueVertices.getArray();
+ const auto& verts = uniqueVertices.getArray();
std::vector<IndexedTriangle> indexedtriangles;
err = tessellatePolygonWithHoles(verts, indexedfaces, indexedtriangles, normal);
for (const auto &t : indexedtriangles) {
diff --git a/src/cgalutils.cc b/src/cgalutils.cc
index 2f17973ee9..3885830470 100644
--- a/src/cgalutils.cc
+++ b/src/cgalutils.cc
@@ -316,7 +316,7 @@ namespace CGALUtils {
PRINTB("Error: Non-manifold mesh encountered: %d unconnected edges", unconnected);
}
// 3. Triangulate each face
- const auto verts = allVertices.getArray();
+ const auto& verts = allVertices.getArray();
std::vector<IndexedTriangle> allTriangles;
for (const auto &faces : polygons) {
#if 0 // For debugging
diff --git a/src/export_off.cc b/src/export_off.cc
index f18134aac8..b81583ac06 100644
--- a/src/export_off.cc
+++ b/src/export_off.cc
@@ -83,7 +83,7 @@ void export_off(const shared_ptr<const Geometry> &geom, std::ostream &output)
append_geometry(geom, mesh);
output << "OFF " << mesh.vertices.size() << " " << mesh.numfaces << " 0\n";
- const auto v = mesh.vertices.getArray();
+ const auto& v = mesh.vertices.getArray();
size_t numverts = mesh.vertices.size();
for (size_t i=0;i<numverts;i++) {
output << v[i][0] << " " << v[i][1] << " " << v[i][2] << " " << "\n";
diff --git a/src/polyset-utils.cc b/src/polyset-utils.cc
index 6f964d8186..4979d5f673 100644
--- a/src/polyset-utils.cc
+++ b/src/polyset-utils.cc
@@ -78,7 +78,7 @@ namespace PolysetUtils {
}
// Tessellate indexed mesh
- const auto verts = allVertices.getArray();
+ const auto& verts = allVertices.getArray();
std::vector<IndexedTriangle> allTriangles;
for (const auto &faces : polygons) {
std::vector<IndexedTriangle> triangles;
From 95c73000b834d9b03345ec20b0e4001c36c97614 Mon Sep 17 00:00:00 2001
From: Torsten Paul <Torsten.Paul@gmx.de>
Date: Sun, 23 Jun 2019 21:10:52 +0200
Subject: [PATCH 3/3] Use range based loop.
---
src/Reindexer.h | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/Reindexer.h b/src/Reindexer.h
index 8abbd21461..2688ea16bc 100644
--- a/src/Reindexer.h
+++ b/src/Reindexer.h
@@ -4,8 +4,6 @@
#include <functional>
#include <vector>
#include <algorithm>
-#include <boost/range/adaptor/map.hpp>
-#include <boost/range/algorithm/copy.hpp>
#include "hash.h"
/*!
@@ -42,13 +40,11 @@ class Reindexer
Return the new element array.
*/
const std::vector<T>& getArray() {
- this->vec.resize(this->map.size());
- typename std::unordered_map<T, int>::const_iterator iter = this->map.begin();
- while (iter != this->map.end()) {
- this->vec[iter->second] = iter->first;
- iter++;
- }
- return this->vec;
+ this->vec.resize(this->map.size());
+ for (const auto& entry : map) {
+ this->vec[entry.second] = entry.first;
+ }
+ return this->vec;
}
/*!

View File

@ -1,28 +0,0 @@
From 47275a3d92969709e7605f23a408c5ed5aa483c9 Mon Sep 17 00:00:00 2001
From: Bernd Waibel <waebbl@gmail.com>
Date: Fri, 15 May 2020 19:09:10 +0200
Subject: [PATCH] Fix build with boost-1.73
Thanks to William T Wilson for reporting and providing the patch.
Signed-off-by: Bernd Waibel <waebbl@gmail.com>
---
src/import.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/import.cc b/src/import.cc
index eef1323..08e46ff 100644
--- a/src/import.cc
+++ b/src/import.cc
@@ -50,7 +50,7 @@ namespace fs = boost::filesystem;
#include <boost/assign/std/vector.hpp>
using namespace boost::assign; // bring 'operator+=()' into scope
-#include <boost/detail/endian.hpp>
+#include <boost/endian/arithmetic.hpp>
#include <cstdint>
extern PolySet * import_amf(std::string, const Location &loc);
--
2.26.2

View File

@ -1,20 +0,0 @@
diff -up openscad-2019.05/features/cgal.prf.bak openscad-2019.05/features/cgal.prf
--- openscad-2019.05/features/cgal.prf.bak 2019-10-02 15:35:12.951314278 +0200
+++ openscad-2019.05/features/cgal.prf 2019-10-02 15:44:04.034063578 +0200
@@ -1,4 +1,6 @@
-DEFINES += ENABLE_CGAL
+DEFINES += ENABLE_CGAL CGAL_HEADER_ONLY
+
+QMAKE_CXXFLAGS += -std=c++14
# Optionally specify location of CGAL using the
# CGALDIR env. variable
@@ -9,7 +11,7 @@ CGAL_DIR = $$(CGALDIR)
message("CGAL location: $$CGAL_DIR")
}
-LIBS += -lCGAL -lmpfr -lgmp
+LIBS += -lmpfr -lgmp
*g++* {
QMAKE_CXXFLAGS += -frounding-math

View File

@ -1,10 +0,0 @@
--- openscad-2019.05/src/parser.y~ 2020-06-03 12:11:31.277838529 +0100
+++ openscad-2019.05/src/parser.y 2020-06-03 12:11:36.059839242 +0100
@@ -46,6 +46,7 @@
#include "printutils.h"
#include "memory.h"
#include <sstream>
+#include <stack>
#include <boost/filesystem.hpp>
#include "boost-utils.h"

View File

@ -1,7 +1,7 @@
Name: openscad
Version: 2019.05
Version: 2021.01
%global upversion %{version}
Release: 14%{?dist}
Release: 1%{?dist}
Summary: The Programmers Solid 3D CAD Modeller
# COPYING contains a linking exception for CGAL
# Appdata file is CC0
@ -14,25 +14,8 @@ Patch0: %{name}-polyclipping.patch
# Upstream backports:
%global github https://github.com/openscad/openscad
# Crash with empty STL/PNG import
# https://bugzilla.redhat.com/show_bug.cgi?id=1717625
# https://github.com/openscad/openscad/issues/2965
Patch1: %{github}/pull/2973.patch
# ... no backports now ...
# Compatibility with CGAL-5.0
# https://github.com/openscad/openscad/pull/3083
Patch2: openscad-2019.05-CGAL-5.0.patch
# Compatibility with Boost 1.73.0
# https://github.com/openscad/openscad/issues/3314
# Patch from https://github.com/gentoo/gentoo/pull/15809/files
Patch3: boost-1.73.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1841257
# https://github.com/openscad/openscad/commit/b6c170cc5dd1bc677176ee732cdb0ddae57e5cf0
Patch4: openscad-missing-include.patch
BuildRequires: make
BuildRequires: CGAL-devel >= 3.6
BuildRequires: ImageMagick
BuildRequires: Xvfb
@ -52,6 +35,7 @@ BuildRequires: glib2-devel
BuildRequires: gmp-devel >= 5.0.0
BuildRequires: harfbuzz-devel >= 0.9.19
BuildRequires: libxml2-devel
BuildRequires: make
BuildRequires: mesa-dri-drivers
BuildRequires: mpfr-devel >= 3.0.0
BuildRequires: opencsg-devel >= 1.3.2
@ -66,10 +50,10 @@ BuildRequires: pkgconfig(libzip)
Requires: font(liberationmono)
Requires: font(liberationsans)
Requires: font(liberationserif)
Requires: hicolor-icon-theme
Recommends: %{name}-MCAD = %{version}-%{release}
# Not ready: https://github.com/openscad/openscad/issues/3300
%bcond_with 3mf
%bcond_without 3mf
%if %{with 3mf}
BuildRequires: lib3mf-devel
%endif
@ -185,7 +169,7 @@ sed -i 's@MCAD/__init__.py@MCAD/gears.scad@' tests/CMakeLists.txt
# tests
cd tests
cmake -DPYTHON_EXECUTABLE:STRING=%{__python3} .
cmake -DPYTHON_EXECUTABLE:STRING=%{python3} .
%make_build
cd -
@ -194,7 +178,7 @@ make install INSTALL_ROOT=%{buildroot}
rm -rf %{buildroot}%{_datadir}/%{name}/fonts
%find_lang %{name}
for FILE in lgpl-2.1.txt README.markdown TODO bitmap-README; do
for FILE in .gitignore lgpl-2.1.txt README.markdown TODO bitmap-README; do
rm %{buildroot}%{_datadir}/%{name}/libraries/MCAD/$FILE
done
@ -212,13 +196,14 @@ cd -
%attr(755,root,root) %{_bindir}/%{name}
%{_datadir}/metainfo/*.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/mime/packages/%{name}.xml
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/examples
%{_datadir}/%{name}/color-schemes
%{_datadir}/%{name}/examples/
%{_datadir}/%{name}/color-schemes/
%dir %{_datadir}/%{name}/locale
%dir %{_datadir}/%{name}/libraries
%{_datadir}/%{name}/templates/
%{_mandir}/man1/*
%files MCAD
@ -232,6 +217,11 @@ cd -
%{_datadir}/%{name}/libraries/MCAD/bitmap/*.scad
%changelog
* Fri Feb 19 2021 Miro Hrončok <mhroncok@redhat.com> - 2021.01-1
- Update to 2021.01
- Enable 3mf support
- Fixes: rhbz#1904759
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2019.05-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (openscad-2019.05.src.tar.gz) = 073053f625ffa4fea6ed836396b7ff4b87b26cf7500b06c804983afc0f1dfd3d78bfb81b3fd217c3939b0ec915d85b0c7990773eaf968512a150deaa0399df13
SHA512 (openscad-2021.01.src.tar.gz) = 8deaa26bf4c295c12da38f323d2b2e6f827851337f5bc1cc9c79afc083c9f913c19a263086e6e853bf2c8434c1ccc705ea22ddb02dc99d39bb1e5e03fc58d128