Compare commits
466 commits
2015.03
...
echo-and-a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02ebe2bd4b | ||
|
|
a66a8cbb00 | ||
|
|
a2fc2044a9 | ||
|
|
f4937f2636 | ||
|
|
f00a036131 | ||
|
|
de6c9f6564 | ||
|
|
08154b1921 | ||
|
|
bbcee74e3e | ||
|
|
22cf081d00 | ||
|
|
5f0e716d6e | ||
|
|
9950e6aa50 | ||
|
|
e78f26c5f1 | ||
|
|
be4fd23dc6 | ||
|
|
96051b895d | ||
|
|
2960e7e8e9 | ||
|
|
176a1e8736 | ||
|
|
c40cb9ad13 | ||
|
|
87ae5b2c15 | ||
|
|
8c946e46db | ||
|
|
fe20aae964 | ||
|
|
d2f6820471 | ||
|
|
d621361a3c | ||
|
|
576fa0f964 | ||
|
|
a9288da6ec | ||
|
|
0ecd392e0b | ||
|
|
930896ed99 | ||
|
|
44a50d202a | ||
|
|
ee67a842b7 | ||
|
|
3d1602c517 | ||
|
|
7b2cd87d73 | ||
|
|
7c104f0630 | ||
|
|
a20e327f54 | ||
|
|
9122dc4de5 | ||
|
|
bcb8723527 | ||
|
|
e47cb3df38 | ||
|
|
1799fe5ebf | ||
|
|
1c01100db7 | ||
|
|
fd5833b8fe | ||
|
|
aee6119f00 | ||
|
|
80e0149b29 | ||
|
|
f2b5382247 | ||
|
|
a7a629cec9 | ||
|
|
d37c20f568 | ||
|
|
085167bfae | ||
|
|
9f2fc6e74c | ||
|
|
84c9f7699d | ||
|
|
888c5bb600 | ||
|
|
2b7c325ddd | ||
|
|
0c1e91e6e3 | ||
|
|
5ec7b39999 | ||
|
|
5ca85f0965 | ||
|
|
6cef99e752 | ||
|
|
057ff54445 | ||
|
|
b7df36c831 | ||
|
|
6646b2a07b | ||
|
|
ac646cd8e2 | ||
|
|
a0bcae241c | ||
|
|
591c7006eb | ||
|
|
a2ba33de7f | ||
|
|
90b9359bb2 | ||
|
|
2e27480ef5 | ||
|
|
f44b97bdee | ||
|
|
686071cdcc | ||
|
|
6f43d97ba3 | ||
|
|
a9d2cb2838 | ||
|
|
34e7761a79 | ||
|
|
f460ca231a | ||
|
|
d8f7102cea | ||
|
|
10a0285f81 | ||
|
|
4c77052002 | ||
|
|
143db7bfa8 | ||
|
|
50a77b6321 | ||
|
|
75c9d7de68 | ||
|
|
2dc6335bf5 | ||
|
|
d4bfcdf373 | ||
|
|
d82a4d10aa | ||
|
|
6e30eae31f | ||
|
|
a65a55db4f | ||
|
|
9bf22c6dea | ||
|
|
39aac370e7 | ||
|
|
3d8844c566 | ||
|
|
6bac7c3912 | ||
|
|
b081a627c0 | ||
|
|
27c05e1132 | ||
|
|
d928082e53 | ||
|
|
ec73c8ba49 | ||
|
|
75b09ab2d7 | ||
|
|
eed5d9298a | ||
|
|
9e9263b39b | ||
|
|
3a090f3401 | ||
|
|
ec3ccbd281 | ||
|
|
caab2595e9 | ||
|
|
23d66355f2 | ||
|
|
8f1e48a7c4 | ||
|
|
bef26b4580 | ||
|
|
d6e2fb319c | ||
|
|
63d7329e2c | ||
|
|
39da6e9e2e | ||
|
|
3df1947d70 | ||
|
|
76e744fa60 | ||
|
|
bf19e009ff | ||
|
|
e9685b7001 | ||
|
|
1331357d55 | ||
|
|
4311c24965 | ||
|
|
e72b6c4127 | ||
|
|
dff10cc9af | ||
|
|
0815b30fff | ||
|
|
d3c6c5cf15 | ||
|
|
9d5ec27db9 | ||
|
|
ab338a2c20 | ||
|
|
5ac04ae1cc | ||
|
|
577a5908fd | ||
|
|
d065aff2d3 | ||
|
|
33b773a1c8 | ||
|
|
77ae07db7a | ||
|
|
c468f9a531 | ||
|
|
06147d81ea | ||
|
|
d6d7e1b183 | ||
|
|
800cba545c | ||
|
|
8098e570b5 | ||
|
|
3f7b6b3aeb | ||
|
|
f3590c648e | ||
|
|
f0a935d8c6 | ||
|
|
cb699c732a | ||
|
|
a9ac29f2e4 | ||
|
|
0f9ea908b0 | ||
|
|
81994d2c3d | ||
|
|
fd3ba84544 | ||
|
|
a6fe98d0b4 | ||
|
|
4e1f4bad50 | ||
|
|
b6eed4b153 | ||
|
|
0190d52d8e | ||
|
|
74eaeba2eb | ||
|
|
97073e54a7 | ||
|
|
97cab4589b | ||
|
|
754cb0f750 | ||
|
|
bfb68fc2fc | ||
|
|
44a0632751 | ||
|
|
cd7d811720 | ||
|
|
5098a1792a | ||
|
|
eba4a4f817 | ||
|
|
7205eae5d9 | ||
|
|
19360666fe | ||
|
|
c1a7d14e1b | ||
|
|
4057d32944 | ||
|
|
97e97422cb | ||
|
|
01f8bbb827 | ||
|
|
1d5bdcc4d5 | ||
|
|
ab6e3ae096 | ||
|
|
7ada64aebb | ||
|
|
e7a4587a7b | ||
|
|
f80e23bdc5 | ||
|
|
4af8cc7525 | ||
|
|
510daf3636 | ||
|
|
452f17cd7f | ||
|
|
9d22fb6b25 | ||
|
|
1378e8ccb6 | ||
|
|
2592f107a5 | ||
|
|
a7202f5468 | ||
|
|
9716dffdf1 | ||
|
|
701faecf49 | ||
|
|
9f0ca6d5a5 | ||
|
|
9bf581fcf3 | ||
|
|
9025199225 | ||
|
|
0f42ba52ce | ||
|
|
4deb5f9ca7 | ||
|
|
497e26afb2 | ||
|
|
ebac29bf84 | ||
|
|
43863c1d30 | ||
|
|
62f69f6948 | ||
|
|
a7298a1c1b | ||
|
|
94cfd4fce4 | ||
|
|
f7db2eeff0 | ||
|
|
779e9c504c | ||
|
|
b99ac24898 | ||
|
|
6f57125efa | ||
|
|
d5f99aa0e1 | ||
|
|
3caaa1b8ed | ||
|
|
ea50b90c69 | ||
|
|
e3a7fe220a | ||
|
|
da79f97043 | ||
|
|
16e8ca9835 | ||
|
|
4050381f03 | ||
|
|
a5ed1ac0ee | ||
|
|
400ff8f53f | ||
|
|
280fc5acf0 | ||
|
|
746006c948 | ||
|
|
777f29dc39 | ||
|
|
74756551b2 | ||
|
|
dafe06faf7 | ||
|
|
0dfe7f74bb | ||
|
|
8aaa5982b0 | ||
|
|
28d27c3bf4 | ||
|
|
bcb3b4abaf | ||
|
|
5460351510 | ||
|
|
2d9f8d1e58 | ||
|
|
331c4fb63d | ||
|
|
7060b25827 | ||
|
|
9a9c7ec31d | ||
|
|
7cfaa7856a | ||
|
|
c6bec5eff5 | ||
|
|
284034e5b6 | ||
|
|
45a9f4124a | ||
|
|
5edc845ae6 | ||
|
|
28d96969e1 | ||
|
|
d4c4a95be4 | ||
|
|
ab8e176abc | ||
|
|
8ffd03b58f | ||
|
|
2f8297891e | ||
|
|
0442bfb646 | ||
|
|
f0c56a4d05 | ||
|
|
8819d6bde6 | ||
|
|
9e43ca1299 | ||
|
|
1b030d7b71 | ||
|
|
c12ab83d22 | ||
|
|
46e79118b1 | ||
|
|
c270bfc40d | ||
|
|
5f4ec8d206 | ||
|
|
16026cfed7 | ||
|
|
e15c36f53f | ||
|
|
fbb5e895ab | ||
|
|
5639962224 | ||
|
|
2794123deb | ||
|
|
84d442a939 | ||
|
|
b9ff5fc5a7 | ||
|
|
ab73c8c8a2 | ||
|
|
a2814e11a7 | ||
|
|
3b64b3c370 | ||
|
|
f65cc7816c | ||
|
|
56c5125fa8 | ||
|
|
07e948f522 | ||
|
|
53c255d4fd | ||
|
|
6736b1e3a3 | ||
|
|
e3c1a90a97 | ||
|
|
5bdc9383f5 | ||
|
|
a6a1c4bc15 | ||
|
|
24124f62bf | ||
|
|
65cc670385 | ||
|
|
da426df8c7 | ||
|
|
a667eba60c | ||
|
|
0dded01c37 | ||
|
|
fa34694af4 | ||
|
|
cb69ab404f | ||
|
|
001712e6cf | ||
|
|
aeabf0a5d3 | ||
|
|
5a3d81d553 | ||
|
|
280ae53f8e | ||
|
|
9a83b0bacf | ||
|
|
7310cd7aab | ||
|
|
5b92c90f9b | ||
|
|
24408ef220 | ||
|
|
6c8bff81d3 | ||
|
|
2b5c3ef70d | ||
|
|
ab8278416a | ||
|
|
2ff35fed0c | ||
|
|
b40e492d87 | ||
|
|
f1e8f2c1a5 | ||
|
|
e6e933d844 | ||
|
|
e225f2d341 | ||
|
|
29d472b691 | ||
|
|
8baea085c6 | ||
|
|
42dba75497 | ||
|
|
c1e12e4782 | ||
|
|
3bab13d2ee | ||
|
|
19b9f99ee8 | ||
|
|
d2d273895e | ||
|
|
3327231847 | ||
|
|
b8ec2c2bc8 | ||
|
|
ff4debec77 | ||
|
|
a675ef6e4e | ||
|
|
600a96f3f4 | ||
|
|
25c31d124e | ||
|
|
6144d45457 | ||
|
|
7f9e7f9c83 | ||
|
|
ed637eb6d5 | ||
|
|
c8097fd604 | ||
|
|
5e1df90c55 | ||
|
|
3fa0046638 | ||
|
|
78234a10ac | ||
|
|
847cc76f20 | ||
|
|
e98a6de11f | ||
|
|
23b6faa17c | ||
|
|
32a2f3aeaf | ||
|
|
b6e55ad66c | ||
|
|
b152acb9e4 | ||
|
|
6441ac4da2 | ||
|
|
4cd1bf9541 | ||
|
|
a2a1f23d6d | ||
|
|
dcbab229c6 | ||
|
|
f7a5313917 | ||
|
|
2f4091b1b7 | ||
|
|
90a660d718 | ||
|
|
d60691b995 | ||
|
|
a17b894316 | ||
|
|
2aaafa44bc | ||
|
|
e4c25bc2f6 | ||
|
|
211b795326 | ||
|
|
1c5ac3b6fd | ||
|
|
a06c44a333 | ||
|
|
1f5367bd46 | ||
|
|
1ef90ace3d | ||
|
|
68e41af144 | ||
|
|
68a296b408 | ||
|
|
1beeb4880e | ||
|
|
012ef6624c | ||
|
|
1522dae4cf | ||
|
|
6bd23abdab | ||
|
|
f9e7c945ba | ||
|
|
9a113b9407 | ||
|
|
310b8fa693 | ||
|
|
ae9ab8fd5e | ||
|
|
058330b0ad | ||
|
|
38dbd49613 | ||
|
|
02c1cf322f | ||
|
|
1514514a76 | ||
|
|
31de8e0f8e | ||
|
|
b1caaaa344 | ||
|
|
3ca9b32849 | ||
|
|
d1d7bb21c4 | ||
|
|
d2e05710e2 | ||
|
|
3b9d1ca4d8 | ||
|
|
f85ace9dd0 | ||
|
|
1b30f641ad | ||
|
|
2227b5cbb8 | ||
|
|
87e32efc18 | ||
|
|
2745b8534c | ||
|
|
662a57a7bd | ||
|
|
7b39f455b5 | ||
|
|
cbccc87677 | ||
|
|
dad1566ffa | ||
|
|
db206e78de | ||
|
|
357e7db66b | ||
|
|
51c4622ca0 | ||
|
|
1bf93e1c77 | ||
|
|
892510b47b | ||
|
|
47f93e3f44 | ||
|
|
574f6e7d33 | ||
|
|
d3494d66b1 | ||
|
|
f993361f8b | ||
|
|
75f10648c9 | ||
|
|
5b917adff9 | ||
|
|
4db4aa5563 | ||
|
|
0a2556304f | ||
|
|
e1e3dae220 | ||
|
|
515c77b949 | ||
|
|
7279c1c019 | ||
|
|
42d6629156 | ||
|
|
ff2427cc1e | ||
|
|
5451fabcc1 | ||
|
|
9641e9bd7f | ||
|
|
365c562a17 | ||
|
|
a1a238a9cd | ||
|
|
7223f2ac05 | ||
|
|
1752fcee8c | ||
|
|
4f1132e5a6 | ||
|
|
306cece150 | ||
|
|
289d84aac0 | ||
|
|
38b93fe7a7 | ||
|
|
031e016df7 | ||
|
|
52f5fe2e92 | ||
|
|
f71e0acbbb | ||
|
|
59f63b5e17 | ||
|
|
cd4ced5456 | ||
|
|
2c6d783eb7 | ||
|
|
1ab390d115 | ||
|
|
c31a96454c | ||
|
|
5239121706 | ||
|
|
061537e773 | ||
|
|
02db2e15a4 | ||
|
|
4f4ddb938a | ||
|
|
17f9941a08 | ||
|
|
591c98e979 | ||
|
|
ca9f9d9d9c | ||
|
|
0c2af2defa | ||
|
|
8e53c29612 | ||
|
|
e6cd3fdda1 | ||
|
|
f9b074c473 | ||
|
|
3511e7079f | ||
|
|
7fb626fb08 | ||
|
|
55affd0273 | ||
|
|
c2f2ba5293 | ||
|
|
69e6707c62 | ||
|
|
9fb5893540 | ||
|
|
cdbd08a4d3 | ||
|
|
98b6cf3d19 | ||
|
|
5e3cd59eeb | ||
|
|
9f372cff41 | ||
|
|
89371f60cf | ||
|
|
c94e62878a | ||
|
|
2dbf9755c3 | ||
|
|
0e1b0daf36 | ||
|
|
e21b321323 | ||
|
|
cc4b633e43 | ||
|
|
c45f2b5f36 | ||
|
|
2b3392266f | ||
|
|
12a43fd942 | ||
|
|
b3ae7fa1ff | ||
|
|
a1bece5c51 | ||
|
|
4d3800cc89 | ||
|
|
c32e271a0c | ||
|
|
6e5315b430 | ||
|
|
9897174a03 | ||
|
|
e87dab0bc6 | ||
|
|
e5e9f20f95 | ||
|
|
b9c8985377 | ||
|
|
e8c8bda674 | ||
|
|
dee5885d9f | ||
|
|
bb183558ae | ||
|
|
ed2f4c2e22 | ||
|
|
7e5394c6fa | ||
|
|
330b41656b | ||
|
|
3adfdad66d | ||
|
|
82f85cd328 | ||
|
|
f53b3a3ac1 | ||
|
|
90094fff25 | ||
|
|
38ef9fddde | ||
|
|
6c3c2de264 | ||
|
|
7632b065c6 | ||
|
|
b43734c3e5 | ||
|
|
a5ec4587b6 | ||
|
|
1b840be127 | ||
|
|
85290e4d51 | ||
|
|
3ac213d649 | ||
|
|
2001f1302e | ||
|
|
c71e70c0f9 | ||
|
|
d37f4fbbab | ||
|
|
c5e1e2b9af | ||
|
|
c037625b65 | ||
|
|
9660ba84a0 | ||
|
|
067eec8743 | ||
|
|
e78206d2aa | ||
|
|
394cc15fba | ||
|
|
54239a2534 | ||
|
|
6ac8d017b7 | ||
|
|
8216e98afd | ||
|
|
b567f844ad | ||
|
|
137928fced | ||
|
|
7c2db84fe6 | ||
|
|
65935b4466 | ||
|
|
6576ee7d05 | ||
|
|
a41c8716ec | ||
|
|
e1da26bd8b | ||
|
|
437aa69292 | ||
|
|
2bdf02d352 | ||
|
|
637244d59e | ||
|
|
3a3ffc0118 | ||
|
|
67c68634b6 | ||
|
|
b394da33c7 | ||
|
|
a0875c845c | ||
|
|
c4f369fbf8 | ||
|
|
da56dff89d | ||
|
|
1d6b7923bd | ||
|
|
7b4411bbcc | ||
|
|
2de378bef5 | ||
|
|
35222064c1 | ||
|
|
7f782832d7 | ||
|
|
c5bc92d97c | ||
|
|
19cea6f3a8 | ||
|
|
2eb96a2a88 | ||
|
|
2cf6dcacf2 | ||
|
|
b2b3306205 | ||
|
|
d6340b18db | ||
|
|
fd1ae57c16 | ||
|
|
086f231d5a | ||
|
|
c259e5275c | ||
|
|
ec3743dc9a |
507 changed files with 20723 additions and 15603 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
|
/*.scad
|
||||||
|
**/out*.*
|
||||||
*.dmg
|
*.dmg
|
||||||
*~
|
*~
|
||||||
*.tar*
|
*.tar*
|
||||||
|
|
@ -9,13 +11,12 @@ objects
|
||||||
.qmake.stash
|
.qmake.stash
|
||||||
parser_yacc.h
|
parser_yacc.h
|
||||||
**/#*#
|
**/#*#
|
||||||
testdata/scad/features/import_dxf-tests.scad
|
testdata/scad/2D/features/import_dxf-tests.scad
|
||||||
testdata/scad/features/import_stl-tests.scad
|
testdata/scad/3D/features/import_stl-tests.scad
|
||||||
testdata/scad/misc/include-tests.scad
|
testdata/scad/misc/include-tests.scad
|
||||||
testdata/scad/misc/use-tests.scad
|
testdata/scad/misc/use-tests.scad
|
||||||
**/project.xcworkspace
|
**/project.xcworkspace
|
||||||
**/xcuserdata
|
**/xcuserdata
|
||||||
/*.scad
|
|
||||||
/*.stl
|
/*.stl
|
||||||
/*.dxf
|
/*.dxf
|
||||||
/*.off
|
/*.off
|
||||||
|
|
@ -37,6 +38,7 @@ testdata/scad/misc/use-tests.scad
|
||||||
/lexer_lex.cpp
|
/lexer_lex.cpp
|
||||||
/parser_yacc.cpp
|
/parser_yacc.cpp
|
||||||
/OpenSCAD.app
|
/OpenSCAD.app
|
||||||
|
/openscad.appdata.xml
|
||||||
/openscad.pro.user
|
/openscad.pro.user
|
||||||
/openscad
|
/openscad
|
||||||
/locale/*/*/*.mo
|
/locale/*/*/*.mo
|
||||||
|
|
|
||||||
21
README.md
21
README.md
|
|
@ -2,6 +2,8 @@
|
||||||
[](https://scan.coverity.com/projects/2510)
|
[](https://scan.coverity.com/projects/2510)
|
||||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||||
|
|
||||||
|
[](https://kiwiirc.com/client/irc.freenode.net/#openscad)
|
||||||
|
|
||||||
# What is OpenSCAD?
|
# What is OpenSCAD?
|
||||||
[](https://flattr.com/submit/auto?user_id=openscad&url=http://openscad.org&title=OpenSCAD&language=&tags=github&category=software)
|
[](https://flattr.com/submit/auto?user_id=openscad&url=http://openscad.org&title=OpenSCAD&language=&tags=github&category=software)
|
||||||
|
|
||||||
|
|
@ -88,13 +90,14 @@ libraries from aptitude. If you're using Mac, or an older Linux/BSD, there
|
||||||
are build scripts that download and compile the libraries from source.
|
are build scripts that download and compile the libraries from source.
|
||||||
Follow the instructions for the platform you're compiling on below.
|
Follow the instructions for the platform you're compiling on below.
|
||||||
|
|
||||||
* [Qt4 (4.4 - 5.4)](http://www.qt.nokia.com/)
|
* A C++ compiler supporting C++11
|
||||||
* [QScintilla2 (2.7 - 2.8)](http://www.riverbankcomputing.co.uk/software/qscintilla/)
|
* [Qt4 (4.4 ->)](http://www.qt.nokia.com/)
|
||||||
* [CGAL (3.6 - 4.5)](http://www.cgal.org/)
|
* [QScintilla2 (2.7 ->)](http://www.riverbankcomputing.co.uk/software/qscintilla/)
|
||||||
|
* [CGAL (3.6 ->)](http://www.cgal.org/)
|
||||||
* [GMP (5.x)](http://www.gmplib.org/)
|
* [GMP (5.x)](http://www.gmplib.org/)
|
||||||
* [MPFR (3.x)](http://www.mpfr.org/)
|
* [MPFR (3.x)](http://www.mpfr.org/)
|
||||||
* [cmake (2.8 - 3.0, required by CGAL and the test framework)](http://www.cmake.org/)
|
* [cmake (2.8 ->, required by CGAL and the test framework)](http://www.cmake.org/)
|
||||||
* [boost (1.35 - 1.57)](http://www.boost.org/)
|
* [boost (1.35 ->)](http://www.boost.org/)
|
||||||
* [OpenCSG (1.3.2 ->)](http://www.opencsg.org/)
|
* [OpenCSG (1.3.2 ->)](http://www.opencsg.org/)
|
||||||
* [GLEW (1.5.4 ->)](http://glew.sourceforge.net/)
|
* [GLEW (1.5.4 ->)](http://glew.sourceforge.net/)
|
||||||
* [Eigen (3.x)](http://eigen.tuxfamily.org/)
|
* [Eigen (3.x)](http://eigen.tuxfamily.org/)
|
||||||
|
|
@ -128,7 +131,7 @@ Prerequisites:
|
||||||
Install Dependencies:
|
Install Dependencies:
|
||||||
|
|
||||||
Run the script that sets up the environment variables:
|
Run the script that sets up the environment variables:
|
||||||
```source setenv_mac-qt5.sh```
|
```source setenv_mac.sh```
|
||||||
|
|
||||||
Then run the script to compile all the dependencies:
|
Then run the script to compile all the dependencies:
|
||||||
```./scripts/macosx-build-dependencies.sh```
|
```./scripts/macosx-build-dependencies.sh```
|
||||||
|
|
@ -147,7 +150,7 @@ For the adventurous, it might be possible to build OpenSCAD using _MacPorts_ or
|
||||||
|
|
||||||
```sudo port install opencsg qscintilla boost cgal pkgconfig eigen3 harfbuzz fontconfig```
|
```sudo port install opencsg qscintilla boost cgal pkgconfig eigen3 harfbuzz fontconfig```
|
||||||
|
|
||||||
1. **Homebrew** (assumes [Homebrew](http://brew.sh)) is already installed)
|
1. **Homebrew** (assumes [Homebrew](http://brew.sh) is already installed)
|
||||||
|
|
||||||
NB! Homebrew's ```qscintilla2``` component doesn't support Qt5, so using Qt4 is currently necessary.
|
NB! Homebrew's ```qscintilla2``` component doesn't support Qt5, so using Qt4 is currently necessary.
|
||||||
However, Homebrew's Qt4 has a broken ```moc``` command, causing OpenSCAD compilation to
|
However, Homebrew's Qt4 has a broken ```moc``` command, causing OpenSCAD compilation to
|
||||||
|
|
@ -231,9 +234,9 @@ For a 64-bit Windows cross-build, replace 32 with 64 in the above instructions.
|
||||||
|
|
||||||
### Compilation
|
### Compilation
|
||||||
|
|
||||||
First, run 'qmake openscad.pro' from Qt4 to generate a Makefile.
|
First, run 'qmake openscad.pro' from Qt to generate a Makefile.
|
||||||
|
|
||||||
On some systems, depending on which version(s) of Qt you have installed, you may need to specify which version you want to use, e.g. by running 'qmake4', 'qmake-qt4' or something alike.
|
On some systems, depending on which version(s) of Qt you have installed, you may need to specify which version you want to use, e.g. by running 'qmake4', 'qmake-qt4', 'qmake -qt=qt5', or something alike.
|
||||||
|
|
||||||
Then run make. Finally you might run 'make install' as root or simply copy the
|
Then run make. Finally you might run 'make install' as root or simply copy the
|
||||||
'openscad' binary (OpenSCAD.app on Mac OS X) to the bin directory of your choice.
|
'openscad' binary (OpenSCAD.app on Mac OS X) to the bin directory of your choice.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,42 @@
|
||||||
|
|
||||||
# OpenSCAD 2015.03
|
# OpenSCAD 2015.03
|
||||||
|
|
||||||
|
## 2015.03-2
|
||||||
|
|
||||||
|
**Bugfixes**
|
||||||
|
* \#1483 - Fix Z-fighting in Ortho view
|
||||||
|
* \#1479 - No check for infinite $fn
|
||||||
|
* \#1472 - "nan" in list comprehension causes crash
|
||||||
|
* \#452 - rands() fails when the seed is a floating point number
|
||||||
|
* \#1407 - Recursive module crash
|
||||||
|
* \#1425 - Animate Filename Generation - Duplicate/Missing Filenames
|
||||||
|
* \#1420 - expression-evaluation-tests fails on arm64
|
||||||
|
* \#1410 - Crash when a polygon contains NaN
|
||||||
|
* \#1378 - Linear extrude plus infinite twist causes crash instead of just an error
|
||||||
|
* \#1358 - Add more detailed installer information including version number
|
||||||
|
* \#1356 - Crash when multiplying matrices with undefined elements
|
||||||
|
* \#1350 - Saving file when HD is full ends up in data loss
|
||||||
|
* \#1342 - Syntax Highlighting Does Not Work on Linux Mint 17.1
|
||||||
|
* \#1337 - Simple detection of script and direction based on given text
|
||||||
|
* \#1325 - Crash when polygons with > 3 indices turn out to be degenerate
|
||||||
|
* \#1329 - version() returned ```[0,0,0]```
|
||||||
|
|
||||||
|
## 2015.03-1
|
||||||
|
|
||||||
|
**Bugfixes**
|
||||||
|
* \#1203 - Linux: Missing icons on Xfce
|
||||||
|
* \#1258 - Occasional crash when exporting STL
|
||||||
|
* \#1260 - Minimal window width too large
|
||||||
|
* \#1264 - Replace All sometimes caused a hang
|
||||||
|
* \#1274 - Fixed some preview bugs on Intel GPUs (OpenCSG 1.4.0)
|
||||||
|
* \#1276 - Module recursion sometimes caused a crash
|
||||||
|
* \#1277 - Automatic reload sometimes messed up camera position
|
||||||
|
* \#1284 - Animation flicker eliminated
|
||||||
|
* \#1294 - Support reproducible builds
|
||||||
|
* \#1317 - Normals vectors in STL were sometimes 0 0 0
|
||||||
|
|
||||||
|
## 2015.03
|
||||||
|
|
||||||
**Language Features:**
|
**Language Features:**
|
||||||
* Added text() module for 2D text
|
* Added text() module for 2D text
|
||||||
* Added offset() module for 2D offsets
|
* Added offset() module for 2D offsets
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,12 @@ boost {
|
||||||
macx: DEFINES += __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0
|
macx: DEFINES += __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0
|
||||||
|
|
||||||
# MXE cross build
|
# MXE cross build
|
||||||
CONFIG(mingw-cross-env) {
|
CONFIG(mingw-cross-env)|CONFIG(mingw-cross-env-shared) {
|
||||||
DEFINES += BOOST_STATIC
|
|
||||||
DEFINES += BOOST_THREAD_USE_LIB
|
DEFINES += BOOST_THREAD_USE_LIB
|
||||||
|
!CONFIG(mingw-cross-env-shared) {
|
||||||
|
DEFINES += BOOST_STATIC
|
||||||
DEFINES += Boost_USE_STATIC_LIBS
|
DEFINES += Boost_USE_STATIC_LIBS
|
||||||
|
}
|
||||||
BOOST_LINK_FLAGS = -lboost_thread_win32-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -lboost_chrono-mt
|
BOOST_LINK_FLAGS = -lboost_thread_win32-mt -lboost_program_options-mt -lboost_filesystem-mt -lboost_system-mt -lboost_regex-mt -lboost_chrono-mt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
52
c++11.pri
Normal file
52
c++11.pri
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
macx {
|
||||||
|
# Mac needs special care to link against the correct C++ library
|
||||||
|
# We attempt to auto-detect it by inspecting Boost
|
||||||
|
dirs = $${BOOSTDIR} $${QMAKE_LIBDIR}
|
||||||
|
for(dir, dirs) {
|
||||||
|
system(grep -q __112basic_string $${dir}/libboost_thread* >& /dev/null) {
|
||||||
|
message("Using libc++11")
|
||||||
|
CONFIG += libc++
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message("Using libstdc++")
|
||||||
|
CONFIG += libstdc++
|
||||||
|
c++11 {
|
||||||
|
# libc++ is a requirement for using C++11
|
||||||
|
warning("Disabling C++11 since libstdc++ dependencies were found")
|
||||||
|
CONFIG -= c++11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
libc++ {
|
||||||
|
QMAKE_CXXFLAGS += -stdlib=libc++
|
||||||
|
QMAKE_LFLAGS += -stdlib=libc++
|
||||||
|
QMAKE_OBJECTIVE_CFLAGS += -stdlib=libc++
|
||||||
|
# libc++ on requires Mac OS X 10.7+
|
||||||
|
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c++11 {
|
||||||
|
# -std=c++11 is only available in gcc>=4.7
|
||||||
|
*g++*: QMAKE_CXXFLAGS += -std=c++0x
|
||||||
|
else: QMAKE_CXXFLAGS += -std=c++11
|
||||||
|
message("Using C++11")
|
||||||
|
|
||||||
|
*clang*: {
|
||||||
|
# 3rd party libraries will probably violate this for a long time
|
||||||
|
CXX11_SUPPRESS_WARNINGS += -Wno-inconsistent-missing-override
|
||||||
|
# boost/algorithm/string.hpp does this
|
||||||
|
CXX11_SUPPRESS_WARNINGS += -Wno-unused-local-typedef
|
||||||
|
# CGAL
|
||||||
|
CXX11_SUPPRESS_WARNINGS += -Wno-deprecated-register
|
||||||
|
|
||||||
|
QMAKE_CXXFLAGS_WARN_ON += $$CXX11_SUPPRESS_WARNINGS
|
||||||
|
QMAKE_OBJECTIVE_CFLAGS_WARN_ON += $$CXX11_SUPPRESS_WARNINGS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*clang* {
|
||||||
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-c++11-extensions
|
||||||
|
}
|
||||||
|
}
|
||||||
2
cgal.pri
2
cgal.pri
|
|
@ -10,7 +10,7 @@ cgal {
|
||||||
message("CGAL location: $$CGAL_DIR")
|
message("CGAL location: $$CGAL_DIR")
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG(mingw-cross-env) {
|
CONFIG(mingw-cross-env)|CONFIG(mingw-cross-env-shared) {
|
||||||
LIBS += -lgmp -lmpfr -lCGAL
|
LIBS += -lgmp -lmpfr -lCGAL
|
||||||
QMAKE_CXXFLAGS += -frounding-math
|
QMAKE_CXXFLAGS += -frounding-math
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
203
cgal/data/issue1455.nef3
Normal file
203
cgal/data/issue1455.nef3
Normal file
|
|
@ -0,0 +1,203 @@
|
||||||
|
Selective Nef Complex
|
||||||
|
standard
|
||||||
|
vertices 15
|
||||||
|
halfedges 42
|
||||||
|
facets 18
|
||||||
|
volumes 2
|
||||||
|
shalfedges 84
|
||||||
|
shalfloops 2
|
||||||
|
sfaces 30
|
||||||
|
0 { 0 2, 0 5, 0 1, -2 | 0 0 5 1 } 1
|
||||||
|
1 { 3 5, 6 11, 2 3, -2 | 5 0 5 1 } 1
|
||||||
|
2 { 6 8, 12 17, 4 5, -2 | 5 5 5 1 } 1
|
||||||
|
3 { 9 11, 18 23, 6 7, -2 | 0 5 0 1 } 1
|
||||||
|
4 { 12 14, 24 29, 8 9, -2 | 5 0 0 1 } 1
|
||||||
|
5 { 15 17, 30 35, 10 11, -2 | 5 5 0 1 } 1
|
||||||
|
6 { 18 20, 36 41, 12 13, -2 | 0 5 5 1 } 1
|
||||||
|
7 { 21 23, 42 47, 14 15, -2 | 0 0 3 1 } 0
|
||||||
|
8 { 24 26, 48 53, 16 17, -2 | 3 0 3 1 } 0
|
||||||
|
9 { 27 29, 54 59, 18 19, -2 | 3 3 3 1 } 0
|
||||||
|
10 { 30 32, 60 65, 20 21, -2 | 0 3 0 1 } 0
|
||||||
|
11 { 33 35, 66 71, 22 23, -2 | 3 0 0 1 } 0
|
||||||
|
12 { 36 38, 72 77, 24 25, -2 | 3 3 0 1 } 0
|
||||||
|
13 { 39 41, 78 83, 26 27, -2 | 0 3 3 1 } 0
|
||||||
|
14 { -2 -2, -2 -2, 28 29, 0 | 2 2 3 1 } 1
|
||||||
|
0 { 3, 0, 0 0 | 1 0 0 1 } 1
|
||||||
|
1 { 18, 0, 0 5 | 0 1 0 1 } 1
|
||||||
|
2 { 21, 0, 0 4 | 0 0 -1 1 } 1
|
||||||
|
3 { 0, 1, 0 6 | -1 0 0 1 } 1
|
||||||
|
4 { 6, 1, 0 7 | 0 1 0 1 } 1
|
||||||
|
5 { 13, 1, 0 10 | 0 0 -1 1 } 1
|
||||||
|
6 { 4, 2, 0 14 | 0 -1 0 1 } 1
|
||||||
|
7 { 19, 2, 0 13 | -1 0 0 1 } 1
|
||||||
|
8 { 17, 2, 0 16 | 0 0 -1 1 } 1
|
||||||
|
9 { 32, 3, 0 20 | 0 -1 0 1 } 1
|
||||||
|
10 { 20, 3, 0 22 | 0 0 1 1 } 1
|
||||||
|
11 { 16, 3, 0 21 | 1 0 0 1 } 1
|
||||||
|
12 { 34, 4, 0 26 | -1 0 0 1 } 1
|
||||||
|
13 { 5, 4, 0 28 | 0 0 1 1 } 1
|
||||||
|
14 { 15, 4, 0 25 | 0 1 0 1 } 1
|
||||||
|
15 { 14, 5, 0 30 | 0 -1 0 1 } 1
|
||||||
|
16 { 11, 5, 0 34 | -1 0 0 1 } 1
|
||||||
|
17 { 8, 5, 0 35 | 0 0 1 1 } 1
|
||||||
|
18 { 1, 6, 0 36 | 0 -1 0 1 } 1
|
||||||
|
19 { 7, 6, 0 40 | 1 0 0 1 } 1
|
||||||
|
20 { 10, 6, 0 41 | 0 0 -1 1 } 1
|
||||||
|
21 { 2, 7, 0 44 | 0 0 1 1 } 1
|
||||||
|
22 { 24, 7, 0 46 | 1 0 0 1 } 0
|
||||||
|
23 { 39, 7, 0 47 | 0 1 0 1 } 0
|
||||||
|
24 { 22, 8, 0 50 | -1 0 0 1 } 0
|
||||||
|
25 { 27, 8, 0 49 | 0 1 0 1 } 0
|
||||||
|
26 { 33, 8, 0 52 | 0 0 -1 1 } 0
|
||||||
|
27 { 25, 9, 0 56 | 0 -1 0 1 } 0
|
||||||
|
28 { 40, 9, 0 55 | -1 0 0 1 } 0
|
||||||
|
29 { 38, 9, 0 58 | 0 0 -1 1 } 0
|
||||||
|
30 { 41, 10, 0 62 | 0 0 1 1 } 0
|
||||||
|
31 { 37, 10, 0 64 | 1 0 0 1 } 0
|
||||||
|
32 { 9, 10, 0 65 | 0 1 0 1 } 1
|
||||||
|
33 { 26, 11, 0 68 | 0 0 1 1 } 0
|
||||||
|
34 { 12, 11, 0 70 | 1 0 0 1 } 1
|
||||||
|
35 { 36, 11, 0 71 | 0 1 0 1 } 0
|
||||||
|
36 { 35, 12, 0 74 | 0 -1 0 1 } 0
|
||||||
|
37 { 31, 12, 0 76 | -1 0 0 1 } 0
|
||||||
|
38 { 29, 12, 0 77 | 0 0 1 1 } 0
|
||||||
|
39 { 23, 13, 0 80 | 0 -1 0 1 } 0
|
||||||
|
40 { 28, 13, 0 82 | 1 0 0 1 } 0
|
||||||
|
41 { 30, 13, 0 79 | 0 0 -1 1 } 0
|
||||||
|
0 { 1, 79 , , 0 | -1 0 0 0 } 1
|
||||||
|
1 { 0, 78 , , 1 | 1 0 0 0 } 1
|
||||||
|
2 { 3, 37 , , 0 | 0 0 1 -5 } 1
|
||||||
|
3 { 2, 36 , , 1 | 0 0 -1 5 } 1
|
||||||
|
4 { 5, 9 , , 0 | 1 0 0 -5 } 1
|
||||||
|
5 { 4, 8 , , 1 | -1 0 0 5 } 1
|
||||||
|
6 { 7, 35 , , 0 | 0 1 0 -5 } 1
|
||||||
|
7 { 6, 34 , , 1 | 0 -1 0 5 } 1
|
||||||
|
8 { 9, 74 , , 0 | 0 0 -1 0 } 1
|
||||||
|
9 { 8, 75 , , 1 | 0 0 1 0 } 1
|
||||||
|
10 { 11, 2 , , 0 | 0 -1 0 0 } 1
|
||||||
|
11 { 10, 3 , , 1 | 0 1 0 0 } 1
|
||||||
|
12 { 13, 81 , 1 , 1 | 0 0 1 -3 } 0
|
||||||
|
13 { 12, 80 , 0 , 0 | 0 0 -1 3 } 0
|
||||||
|
14 { 15, 53 , , 1 | 1 0 0 -3 } 0
|
||||||
|
15 { 14, 52 , , 0 | -1 0 0 3 } 0
|
||||||
|
16 { 17, 77 , , 1 | 0 1 0 -3 } 0
|
||||||
|
17 { 16, 76 , , 0 | 0 -1 0 3 } 0
|
||||||
|
0 { 0 } 0
|
||||||
|
1 { 15 } 1
|
||||||
|
0 { 1, 3, 5, 0, 0, 7, 36, 3 | 0 0 1 0 } 1
|
||||||
|
1 { 0, 4, 2, 1, 1, 37, 6, 2 | 0 0 -1 0 } 1
|
||||||
|
2 { 3, 1, 4, 0, 1, 10, 44, 10 | 0 1 0 0 } 1
|
||||||
|
3 { 2, 5, 0, 2, 0, 45, 11, 11 | 0 -1 0 0 } 1
|
||||||
|
4 { 5, 2, 1, 2, 1, 43, 38, 0 | 1 0 0 0 } 1
|
||||||
|
5 { 4, 0, 3, 1, 0, 39, 42, 1 | -1 0 0 0 } 1
|
||||||
|
6 { 7, 10, 9, 3, 3, 1, 12, 2 | 0 0 -1 0 } 1
|
||||||
|
7 { 6, 8, 11, 4, 2, 13, 0, 3 | 0 0 1 0 } 1
|
||||||
|
8 { 9, 11, 7, 5, 2, 29, 14, 5 | 1 0 0 0 } 1
|
||||||
|
9 { 8, 6, 10, 4, 3, 15, 28, 4 | -1 0 0 0 } 1
|
||||||
|
10 { 11, 9, 6, 5, 3, 26, 2, 10 | 0 1 0 0 } 1
|
||||||
|
11 { 10, 7, 8, 3, 2, 3, 27, 11 | 0 -1 0 0 } 1
|
||||||
|
12 { 13, 15, 17, 6, 5, 6, 37, 2 | 0 0 -1 0 } 1
|
||||||
|
13 { 12, 16, 14, 7, 4, 36, 7, 3 | 0 0 1 0 } 1
|
||||||
|
14 { 15, 13, 16, 6, 4, 8, 33, 5 | 1 0 0 0 } 1
|
||||||
|
15 { 14, 17, 12, 8, 5, 32, 9, 4 | -1 0 0 0 } 1
|
||||||
|
16 { 17, 14, 13, 8, 4, 34, 40, 7 | 0 1 0 0 } 1
|
||||||
|
17 { 16, 12, 15, 7, 5, 41, 35, 6 | 0 -1 0 0 } 1
|
||||||
|
18 { 19, 21, 22, 9, 6, 60, 39, 1 | -1 0 0 0 } 1
|
||||||
|
19 { 18, 23, 20, 10, 7, 38, 61, 0 | 1 0 0 0 } 1
|
||||||
|
20 { 21, 19, 23, 9, 7, 64, 31, 8 | 0 0 1 0 } 1
|
||||||
|
21 { 20, 22, 18, 11, 6, 30, 65, 9 | 0 0 -1 0 } 1
|
||||||
|
22 { 23, 18, 21, 10, 6, 40, 34, 7 | 0 1 0 0 } 1
|
||||||
|
23 { 22, 20, 19, 11, 7, 35, 41, 6 | 0 -1 0 0 } 1
|
||||||
|
24 { 25, 27, 29, 12, 8, 71, 30, 9 | 0 0 -1 0 } 1
|
||||||
|
25 { 24, 28, 26, 14, 9, 31, 70, 8 | 0 0 1 0 } 1
|
||||||
|
26 { 27, 25, 28, 12, 9, 68, 10, 10 | 0 1 0 0 } 1
|
||||||
|
27 { 26, 29, 24, 13, 8, 11, 69, 11 | 0 -1 0 0 } 1
|
||||||
|
28 { 29, 26, 25, 13, 9, 9, 32, 4 | -1 0 0 0 } 1
|
||||||
|
29 { 28, 24, 27, 14, 8, 33, 8, 5 | 1 0 0 0 } 1
|
||||||
|
30 { 31, 33, 34, 15, 11, 24, 21, 9 | 0 0 -1 0 } 1
|
||||||
|
31 { 30, 35, 32, 16, 10, 20, 25, 8 | 0 0 1 0 } 1
|
||||||
|
32 { 33, 31, 35, 15, 10, 28, 15, 4 | -1 0 0 0 } 1
|
||||||
|
33 { 32, 34, 30, 17, 11, 14, 29, 5 | 1 0 0 0 } 1
|
||||||
|
34 { 35, 30, 33, 16, 11, 22, 16, 7 | 0 1 0 0 } 1
|
||||||
|
35 { 34, 32, 31, 17, 10, 17, 23, 6 | 0 -1 0 0 } 1
|
||||||
|
36 { 37, 39, 40, 18, 12, 0, 13, 3 | 0 0 1 0 } 1
|
||||||
|
37 { 36, 41, 38, 19, 13, 12, 1, 2 | 0 0 -1 0 } 1
|
||||||
|
38 { 39, 37, 41, 18, 13, 4, 19, 0 | 1 0 0 0 } 1
|
||||||
|
39 { 38, 40, 36, 20, 12, 18, 5, 1 | -1 0 0 0 } 1
|
||||||
|
40 { 41, 36, 39, 19, 12, 16, 22, 7 | 0 1 0 0 } 1
|
||||||
|
41 { 40, 38, 37, 20, 13, 23, 17, 6 | 0 -1 0 0 } 1
|
||||||
|
42 { 43, 45, 47, 21, 14, 5, 78, 1 | -1 0 0 0 } 1
|
||||||
|
43 { 42, 46, 44, 23, 15, 79, 4, 0 | 1 0 0 0 } 1
|
||||||
|
44 { 45, 43, 46, 21, 15, 2, 50, 10 | 0 1 0 0 } 1
|
||||||
|
45 { 44, 47, 42, 22, 14, 51, 3, 11 | 0 -1 0 0 } 1
|
||||||
|
46 { 47, 44, 43, 22, 15, 49, 80, 13 | 0 0 1 0 } 0
|
||||||
|
47 { 46, 42, 45, 23, 14, 81, 48, 12 | 0 0 -1 0 } 0
|
||||||
|
48 { 49, 51, 53, 24, 16, 47, 54, 12 | 0 0 -1 0 } 0
|
||||||
|
49 { 48, 52, 50, 25, 17, 55, 46, 13 | 0 0 1 0 } 0
|
||||||
|
50 { 51, 49, 52, 24, 17, 44, 68, 10 | 0 1 0 0 } 1
|
||||||
|
51 { 50, 53, 48, 26, 16, 69, 45, 11 | 0 -1 0 0 } 1
|
||||||
|
52 { 53, 50, 49, 26, 17, 67, 56, 15 | 1 0 0 0 } 0
|
||||||
|
53 { 52, 48, 51, 25, 16, 57, 66, 14 | -1 0 0 0 } 0
|
||||||
|
54 { 55, 57, 59, 27, 19, 48, 81, 12 | 0 0 -1 0 } 0
|
||||||
|
55 { 54, 58, 56, 28, 18, 80, 49, 13 | 0 0 1 0 } 0
|
||||||
|
56 { 57, 55, 58, 27, 18, 52, 73, 15 | 1 0 0 0 } 0
|
||||||
|
57 { 56, 59, 54, 29, 19, 72, 53, 14 | -1 0 0 0 } 0
|
||||||
|
58 { 59, 56, 55, 29, 18, 76, 82, 17 | 0 1 0 0 } 0
|
||||||
|
59 { 58, 54, 57, 28, 19, 83, 77, 16 | 0 -1 0 0 } 0
|
||||||
|
60 { 61, 63, 65, 30, 20, 78, 18, 1 | -1 0 0 0 } 1
|
||||||
|
61 { 60, 64, 62, 32, 21, 19, 79, 0 | 1 0 0 0 } 1
|
||||||
|
62 { 63, 61, 64, 30, 21, 82, 76, 17 | 0 1 0 0 } 0
|
||||||
|
63 { 62, 65, 60, 31, 20, 77, 83, 16 | 0 -1 0 0 } 0
|
||||||
|
64 { 65, 62, 61, 31, 21, 74, 20, 8 | 0 0 1 0 } 1
|
||||||
|
65 { 64, 60, 63, 32, 20, 21, 75, 9 | 0 0 -1 0 } 1
|
||||||
|
66 { 67, 69, 71, 33, 22, 53, 72, 14 | -1 0 0 0 } 0
|
||||||
|
67 { 66, 70, 68, 35, 23, 73, 52, 15 | 1 0 0 0 } 0
|
||||||
|
68 { 69, 67, 70, 33, 23, 50, 26, 10 | 0 1 0 0 } 1
|
||||||
|
69 { 68, 71, 66, 34, 22, 27, 51, 11 | 0 -1 0 0 } 1
|
||||||
|
70 { 71, 68, 67, 34, 23, 25, 74, 8 | 0 0 1 0 } 1
|
||||||
|
71 { 70, 66, 69, 35, 22, 75, 24, 9 | 0 0 -1 0 } 1
|
||||||
|
72 { 73, 75, 77, 36, 24, 66, 57, 14 | -1 0 0 0 } 0
|
||||||
|
73 { 72, 76, 74, 38, 25, 56, 67, 15 | 1 0 0 0 } 0
|
||||||
|
74 { 75, 73, 76, 36, 25, 70, 64, 8 | 0 0 1 0 } 1
|
||||||
|
75 { 74, 77, 72, 37, 24, 65, 71, 9 | 0 0 -1 0 } 1
|
||||||
|
76 { 77, 74, 73, 37, 25, 62, 58, 17 | 0 1 0 0 } 0
|
||||||
|
77 { 76, 72, 75, 38, 24, 59, 63, 16 | 0 -1 0 0 } 0
|
||||||
|
78 { 79, 81, 83, 39, 26, 42, 60, 1 | -1 0 0 0 } 1
|
||||||
|
79 { 78, 82, 80, 41, 27, 61, 43, 0 | 1 0 0 0 } 1
|
||||||
|
80 { 81, 79, 82, 39, 27, 46, 55, 13 | 0 0 1 0 } 0
|
||||||
|
81 { 80, 83, 78, 40, 26, 54, 47, 12 | 0 0 -1 0 } 0
|
||||||
|
82 { 83, 80, 79, 40, 27, 58, 62, 17 | 0 1 0 0 } 0
|
||||||
|
83 { 82, 78, 81, 41, 26, 63, 59, 16 | 0 -1 0 0 } 0
|
||||||
|
0 { 1, 28, 13 | 0 0 1 0 } 0
|
||||||
|
1 { 0, 29, 12 | 0 0 -1 0 } 0
|
||||||
|
0 { 0, 0 , , , 0 } 0
|
||||||
|
1 { 0, 1 , , , 1 } 1
|
||||||
|
2 { 1, 7 , , , 0 } 0
|
||||||
|
3 { 1, 6 , , , 1 } 1
|
||||||
|
4 { 2, 13 , , , 0 } 0
|
||||||
|
5 { 2, 12 , , , 1 } 1
|
||||||
|
6 { 3, 18 , , , 0 } 0
|
||||||
|
7 { 3, 19 , , , 1 } 1
|
||||||
|
8 { 4, 24 , , , 0 } 0
|
||||||
|
9 { 4, 25 , , , 1 } 1
|
||||||
|
10 { 5, 31 , , , 1 } 1
|
||||||
|
11 { 5, 30 , , , 0 } 0
|
||||||
|
12 { 6, 36 , , , 0 } 0
|
||||||
|
13 { 6, 37 , , , 1 } 1
|
||||||
|
14 { 7, 42 , , , 0 } 0
|
||||||
|
15 { 7, 43 , , , 1 } 1
|
||||||
|
16 { 8, 48 , , , 0 } 0
|
||||||
|
17 { 8, 49 , , , 1 } 1
|
||||||
|
18 { 9, 55 , , , 1 } 1
|
||||||
|
19 { 9, 54 , , , 0 } 0
|
||||||
|
20 { 10, 60 , , , 0 } 0
|
||||||
|
21 { 10, 61 , , , 1 } 1
|
||||||
|
22 { 11, 66 , , , 0 } 0
|
||||||
|
23 { 11, 67 , , , 1 } 1
|
||||||
|
24 { 12, 72 , , , 0 } 0
|
||||||
|
25 { 12, 73 , , , 1 } 1
|
||||||
|
26 { 13, 78 , , , 0 } 0
|
||||||
|
27 { 13, 79 , , , 1 } 1
|
||||||
|
28 { 14, , , 0, 1 } 1
|
||||||
|
29 { 14, , , 1, 0 } 0
|
||||||
|
/* end Selective Nef complex */
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
#include "polyset.h"
|
#include "polyset.h"
|
||||||
#include "CGAL_Nef_polyhedron.h"
|
#include "CGAL_Nef_polyhedron.h"
|
||||||
|
#include "boosty.h"
|
||||||
|
|
||||||
|
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
|
||||||
|
|
||||||
using namespace CGALUtils;
|
using namespace CGALUtils;
|
||||||
|
|
||||||
|
|
@ -16,6 +19,7 @@ using namespace CGALUtils;
|
||||||
typedef CGAL::Epick K;
|
typedef CGAL::Epick K;
|
||||||
typedef CGAL::Polyhedron_3<K> PolyhedronK;
|
typedef CGAL::Polyhedron_3<K> PolyhedronK;
|
||||||
|
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/assign/std/vector.hpp>
|
#include <boost/assign/std/vector.hpp>
|
||||||
#include <boost/assign/list_of.hpp>
|
#include <boost/assign/list_of.hpp>
|
||||||
using namespace boost::assign; // bring 'operator+=()' into scope
|
using namespace boost::assign; // bring 'operator+=()' into scope
|
||||||
|
|
@ -629,21 +633,30 @@ int main(int argc, char *argv[])
|
||||||
OpenSCAD::debug = "decompose";
|
OpenSCAD::debug = "decompose";
|
||||||
|
|
||||||
PolySet *ps = NULL;
|
PolySet *ps = NULL;
|
||||||
|
CGAL_Nef_polyhedron *N = NULL;
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
if (!(ps = import_stl(argv[1]))) {
|
std::string filename(argv[1]);
|
||||||
std::cerr << "Error importing STL " << argv[1] << std::endl;
|
std::string suffix = boosty::extension_str(filename);
|
||||||
|
if (suffix == ".stl") {
|
||||||
|
if (!(ps = import_stl(filename))) {
|
||||||
|
std::cerr << "Error importing STL " << filename << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
std::cerr << "Imported " << ps->numPolygons() << " polygons" << std::endl;
|
std::cerr << "Imported " << ps->numPolygons() << " polygons" << std::endl;
|
||||||
}
|
}
|
||||||
|
else if (suffix == ".nef3") {
|
||||||
|
N = new CGAL_Nef_polyhedron(new CGAL_Nef_polyhedron3);
|
||||||
|
std::ifstream stream(filename.c_str());
|
||||||
|
stream >> *N->p3;
|
||||||
|
std::cerr << "Imported Nef polyhedron" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
std::cerr << "Usage: " << argv[0] << " <file.stl> <file.stl>" << std::endl;
|
std::cerr << "Usage: " << argv[0] << " <file.stl> <file.stl>" << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry::ChildList children;
|
if (ps && !N) N = createNefPolyhedronFromGeometry(*ps);
|
||||||
|
|
||||||
CGAL_Nef_polyhedron *N = createNefPolyhedronFromGeometry(*ps);
|
|
||||||
|
|
||||||
std::vector<PolyhedronK> result;
|
std::vector<PolyhedronK> result;
|
||||||
decompose(N->p3.get(), std::back_inserter(result));
|
decompose(N->p3.get(), std::back_inserter(result));
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ debug: DEFINES += DEBUG
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
INCLUDEPATH += ../src
|
INCLUDEPATH += ../src ../src/libtess2/Include
|
||||||
DEPENDPATH += ../src
|
DEPENDPATH += ../src
|
||||||
|
|
||||||
# Handle custom library location.
|
# Handle custom library location.
|
||||||
|
|
@ -54,10 +54,12 @@ macx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# See Dec 2011 OpenSCAD mailing list, re: CGAL/GCC bugs.
|
|
||||||
*g++* {
|
*g++* {
|
||||||
|
# See Dec 2011 OpenSCAD mailing list, re: CGAL/GCC bugs.
|
||||||
QMAKE_CXXFLAGS *= -fno-strict-aliasing
|
QMAKE_CXXFLAGS *= -fno-strict-aliasing
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedefs # ignored before 4.8
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedefs # ignored before 4.8
|
||||||
|
# use of 'auto'
|
||||||
|
QMAKE_CXXFLAGS += -std=c++11
|
||||||
}
|
}
|
||||||
|
|
||||||
*clang* {
|
*clang* {
|
||||||
|
|
@ -80,29 +82,52 @@ CONFIG += gettext
|
||||||
|
|
||||||
mac: {
|
mac: {
|
||||||
LIBS += -framework OpenGL
|
LIBS += -framework OpenGL
|
||||||
|
} else {
|
||||||
|
LIBS += -lGL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
include(../common.pri)
|
include(../common.pri)
|
||||||
|
|
||||||
HEADERS += ../src/cgal.h \
|
HEADERS += ../src/cgal.h \
|
||||||
../src/cgalutils.h \
|
../src/cgalutils.h \
|
||||||
../src/linalg.h \
|
../src/linalg.h \
|
||||||
|
../src/grid.h \
|
||||||
../src/polyset.h \
|
../src/polyset.h \
|
||||||
../src/polyset-utils.h \
|
../src/polyset-utils.h \
|
||||||
../src/printutils.h
|
../src/printutils.h \
|
||||||
|
../src/GeometryUtils.h \
|
||||||
|
../src/libtess2/Include/tesselator.h \
|
||||||
|
../src/libtess2/Source/bucketalloc.h \
|
||||||
|
../src/libtess2/Source/dict.h \
|
||||||
|
../src/libtess2/Source/geom.h \
|
||||||
|
../src/libtess2/Source/mesh.h \
|
||||||
|
../src/libtess2/Source/priorityq.h \
|
||||||
|
../src/libtess2/Source/sweep.h \
|
||||||
|
../src/libtess2/Source/tess.h
|
||||||
|
|
||||||
SOURCES += decompose.cpp \
|
SOURCES += decompose.cpp \
|
||||||
../src/polygon2d.cc \
|
../src/polygon2d.cc \
|
||||||
../src/polygon2d-CGAL.cc \
|
../src/polygon2d-CGAL.cc \
|
||||||
../src/CGAL_Nef_polyhedron.cc \
|
../src/CGAL_Nef_polyhedron.cc \
|
||||||
../src/CGAL_Nef_polyhedron_DxfData.cc \
|
|
||||||
../src/cgalutils.cc \
|
../src/cgalutils.cc \
|
||||||
|
../src/cgalutils-applyops.cc \
|
||||||
../src/cgalutils-tess.cc \
|
../src/cgalutils-tess.cc \
|
||||||
../src/cgalutils-polyhedron.cc \
|
../src/cgalutils-polyhedron.cc \
|
||||||
../src/polyset.cc \
|
../src/polyset.cc \
|
||||||
|
../src/polyset-gl.cc \
|
||||||
|
../src/GeometryUtils.cc \
|
||||||
../src/svg.cc \
|
../src/svg.cc \
|
||||||
|
../src/grid.cc \
|
||||||
../src/node.cc \
|
../src/node.cc \
|
||||||
../src/export.cc \
|
../src/export.cc \
|
||||||
../src/polyset-utils.cc \
|
../src/polyset-utils.cc \
|
||||||
../src/progress.cc \
|
../src/progress.cc \
|
||||||
../src/printutils.cc
|
../src/printutils.cc \
|
||||||
|
../src/libtess2/Source/bucketalloc.c \
|
||||||
|
../src/libtess2/Source/dict.c \
|
||||||
|
../src/libtess2/Source/geom.c \
|
||||||
|
../src/libtess2/Source/mesh.c \
|
||||||
|
../src/libtess2/Source/priorityq.c \
|
||||||
|
../src/libtess2/Source/sweep.c \
|
||||||
|
../src/libtess2/Source/tess.c
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ debug: DEFINES += DEBUG
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
INCLUDEPATH += ../src
|
INCLUDEPATH += ../src ../src/libtess2/Include
|
||||||
DEPENDPATH += ../src
|
DEPENDPATH += ../src
|
||||||
|
|
||||||
# Handle custom library location.
|
# Handle custom library location.
|
||||||
|
|
@ -87,23 +87,42 @@ include(../common.pri)
|
||||||
HEADERS += ../src/cgal.h \
|
HEADERS += ../src/cgal.h \
|
||||||
../src/cgalutils.h \
|
../src/cgalutils.h \
|
||||||
../src/linalg.h \
|
../src/linalg.h \
|
||||||
|
../src/grid.h \
|
||||||
../src/polyset.h \
|
../src/polyset.h \
|
||||||
../src/polyset-utils.h \
|
../src/polyset-utils.h \
|
||||||
../src/printutils.h
|
../src/printutils.h \
|
||||||
|
../src/GeometryUtils.h \
|
||||||
|
../src/libtess2/Include/tesselator.h \
|
||||||
|
../src/libtess2/Source/bucketalloc.h \
|
||||||
|
../src/libtess2/Source/dict.h \
|
||||||
|
../src/libtess2/Source/geom.h \
|
||||||
|
../src/libtess2/Source/mesh.h \
|
||||||
|
../src/libtess2/Source/priorityq.h \
|
||||||
|
../src/libtess2/Source/sweep.h \
|
||||||
|
../src/libtess2/Source/tess.h
|
||||||
|
|
||||||
SOURCES += export_nef.cpp \
|
SOURCES += export_nef.cpp \
|
||||||
../src/polygon2d.cc \
|
../src/polygon2d.cc \
|
||||||
../src/polygon2d-CGAL.cc \
|
../src/polygon2d-CGAL.cc \
|
||||||
../src/CGAL_Nef_polyhedron.cc \
|
../src/CGAL_Nef_polyhedron.cc \
|
||||||
../src/CGAL_Nef_polyhedron_DxfData.cc \
|
|
||||||
../src/cgalutils.cc \
|
../src/cgalutils.cc \
|
||||||
|
../src/cgalutils-applyops.cc \
|
||||||
../src/cgalutils-tess.cc \
|
../src/cgalutils-tess.cc \
|
||||||
../src/cgalutils-polyhedron.cc \
|
../src/cgalutils-polyhedron.cc \
|
||||||
../src/polyset.cc \
|
../src/polyset.cc \
|
||||||
|
../src/polyset-gl.cc \
|
||||||
|
../src/GeometryUtils.cc \
|
||||||
../src/svg.cc \
|
../src/svg.cc \
|
||||||
|
../src/grid.cc \
|
||||||
../src/node.cc \
|
../src/node.cc \
|
||||||
../src/export.cc \
|
../src/export.cc \
|
||||||
../src/polyset-utils.cc \
|
../src/polyset-utils.cc \
|
||||||
../src/progress.cc \
|
../src/progress.cc \
|
||||||
../src/printutils.cc \
|
../src/printutils.cc \
|
||||||
../src/grid.cc
|
../src/libtess2/Source/bucketalloc.c \
|
||||||
|
../src/libtess2/Source/dict.c \
|
||||||
|
../src/libtess2/Source/geom.c \
|
||||||
|
../src/libtess2/Source/mesh.c \
|
||||||
|
../src/libtess2/Source/priorityq.c \
|
||||||
|
../src/libtess2/Source/sweep.c \
|
||||||
|
../src/libtess2/Source/tess.c
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#333333",
|
"background" : "#333333",
|
||||||
|
"axes-color" : "#c1c1c1",
|
||||||
"opencsg-face-front" : "#cccccc",
|
"opencsg-face-front" : "#cccccc",
|
||||||
"opencsg-face-back" : "#5563dd",
|
"opencsg-face-back" : "#5563dd",
|
||||||
"cgal-face-front" : "#cccccc",
|
"cgal-face-front" : "#cccccc",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#333333",
|
"background" : "#333333",
|
||||||
|
"axes-color" : "#c1c1c1",
|
||||||
"opencsg-face-front" : "#eeeeee",
|
"opencsg-face-front" : "#eeeeee",
|
||||||
"opencsg-face-back" : "#0babc8",
|
"opencsg-face-back" : "#0babc8",
|
||||||
"cgal-face-front" : "#eeeeee",
|
"cgal-face-front" : "#eeeeee",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#aaaaff",
|
"background" : "#aaaaff",
|
||||||
|
"axes-color" : "#222233",
|
||||||
"opencsg-face-front" : "#ddddff",
|
"opencsg-face-front" : "#ddddff",
|
||||||
"opencsg-face-back" : "#dd22dd",
|
"opencsg-face-back" : "#dd22dd",
|
||||||
"cgal-face-front" : "#ddddff",
|
"cgal-face-front" : "#ddddff",
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#ffffe5",
|
"background" : "#ffffe5",
|
||||||
|
"axes-color" : "#191916",
|
||||||
"opencsg-face-front" : "#f9d72c",
|
"opencsg-face-front" : "#f9d72c",
|
||||||
"opencsg-face-back" : "#f9d72c",
|
"opencsg-face-back" : "#f9d72c",
|
||||||
"cgal-face-front" : "#f9d72c",
|
"cgal-face-front" : "#f9d72c",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#fafafa",
|
"background" : "#fafafa",
|
||||||
|
"axes-color" : "#323232",
|
||||||
"opencsg-face-front" : "#16a085",
|
"opencsg-face-front" : "#16a085",
|
||||||
"opencsg-face-back" : "#dbf4da",
|
"opencsg-face-back" : "#dbf4da",
|
||||||
"cgal-face-front" : "#16a085",
|
"cgal-face-front" : "#16a085",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#fdf6e3",
|
"background" : "#fdf6e3",
|
||||||
|
"axes-color" : "#191816",
|
||||||
"opencsg-face-front" : "#b58800",
|
"opencsg-face-front" : "#b58800",
|
||||||
"opencsg-face-back" : "#882233",
|
"opencsg-face-back" : "#882233",
|
||||||
"cgal-face-front" : "#b58800",
|
"cgal-face-front" : "#b58800",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#000000",
|
"background" : "#000000",
|
||||||
|
"axes-color" : "#e5e5e5",
|
||||||
"opencsg-face-front" : "#ffffe0",
|
"opencsg-face-front" : "#ffffe0",
|
||||||
"opencsg-face-back" : "#00ffff",
|
"opencsg-face-back" : "#00ffff",
|
||||||
"cgal-face-front" : "#ffffe0",
|
"cgal-face-front" : "#ffffe0",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#aa4444",
|
"background" : "#aa4444",
|
||||||
|
"axes-color" : "#220d0d",
|
||||||
"opencsg-face-front" : "#ffaaaa",
|
"opencsg-face-front" : "#ffaaaa",
|
||||||
"opencsg-face-back" : "#882233",
|
"opencsg-face-back" : "#882233",
|
||||||
"cgal-face-front" : "#ffaaaa",
|
"cgal-face-front" : "#ffaaaa",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#1d1f21",
|
"background" : "#1d1f21",
|
||||||
|
"axes-color" : "#e8e8e8",
|
||||||
"opencsg-face-front" : "#81a2be",
|
"opencsg-face-front" : "#81a2be",
|
||||||
"opencsg-face-back" : "#de935f",
|
"opencsg-face-back" : "#de935f",
|
||||||
"cgal-face-front" : "#8abeb7",
|
"cgal-face-front" : "#8abeb7",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
"colors" : {
|
"colors" : {
|
||||||
"background" : "#f8f8f8",
|
"background" : "#f8f8f8",
|
||||||
|
"axes-color" : "#181818",
|
||||||
"opencsg-face-front" : "#4271ae",
|
"opencsg-face-front" : "#4271ae",
|
||||||
"opencsg-face-back" : "#f5871f",
|
"opencsg-face-back" : "#f5871f",
|
||||||
"cgal-face-front" : "#3e999f",
|
"cgal-face-front" : "#3e999f",
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ include(flex.pri)
|
||||||
include(bison.pri)
|
include(bison.pri)
|
||||||
include(cgal.pri)
|
include(cgal.pri)
|
||||||
include(opencsg.pri)
|
include(opencsg.pri)
|
||||||
|
include(opengl.pri)
|
||||||
include(glew.pri)
|
include(glew.pri)
|
||||||
include(eigen.pri)
|
include(eigen.pri)
|
||||||
include(boost.pri)
|
include(boost.pri)
|
||||||
|
|
@ -18,3 +19,4 @@ include(harfbuzz.pri)
|
||||||
include(freetype.pri)
|
include(freetype.pri)
|
||||||
include(fontconfig.pri)
|
include(fontconfig.pri)
|
||||||
include(scintilla.pri)
|
include(scintilla.pri)
|
||||||
|
include(c++11.pri)
|
||||||
|
|
|
||||||
9
contrib/appdata.its
Normal file
9
contrib/appdata.its
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!-- Copyright 2013 Richard Hughes <richard@hughsie.com> -->
|
||||||
|
<its:rules
|
||||||
|
xmlns:its="http://www.w3.org/2005/11/its"
|
||||||
|
version="1.0">
|
||||||
|
<its:translateRule translate="no" selector="/component"/>
|
||||||
|
<its:translateRule translate="yes"
|
||||||
|
selector="/component/summary |
|
||||||
|
/component/description"/>
|
||||||
|
</its:rules>
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
;;; scad-mode.el --- Major mode for editing SCAD files
|
;;; scad-mode.el --- A major mode for editing OpenSCAD code
|
||||||
|
|
||||||
;; Author: Len Trigg
|
;; Author: Len Trigg, Łukasz Stelmach
|
||||||
;; Maintainer: Len Trigg <lenbok@gmail.com>
|
;; Maintainer: Len Trigg <lenbok@gmail.com>
|
||||||
;; Created: March 2010
|
;; Created: March 2010
|
||||||
;; Modified: 24 May 2014
|
;; Modified: 28 Mar 2015
|
||||||
;; Keywords: languages
|
;; Keywords: languages
|
||||||
;; URL: https://raw.github.com/openscad/openscad/master/contrib/scad-mode.el
|
;; URL: https://raw.github.com/openscad/openscad/master/contrib/scad-mode.el
|
||||||
;; Version: 91.0
|
;; Version: 91.0
|
||||||
|
|
@ -26,11 +26,11 @@
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;
|
;;
|
||||||
;; This is a major-mode to implement the SCAD constructs and
|
;; This is a major-mode to implement the SCAD constructs and
|
||||||
;; font-locking for openscad
|
;; font-locking for OpenSCAD
|
||||||
;;
|
;;
|
||||||
;; If installing manually, insert the following into your emacs startup:
|
;; If installing manually, insert the following into your emacs startup:
|
||||||
;;
|
;;
|
||||||
;; (autoload 'scad-mode "scad-mode" "Major mode for editing SCAD code." t)
|
;; (autoload 'scad-mode "scad-mode" "A major mode for editing OpenSCAD code." t)
|
||||||
;; (add-to-list 'auto-mode-alist '("\\.scad$" . scad-mode))
|
;; (add-to-list 'auto-mode-alist '("\\.scad$" . scad-mode))
|
||||||
;;
|
;;
|
||||||
;; or
|
;; or
|
||||||
|
|
@ -48,6 +48,8 @@
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(add-to-list 'auto-mode-alist '("\\.scad$" . scad-mode))
|
(add-to-list 'auto-mode-alist '("\\.scad$" . scad-mode))
|
||||||
|
|
||||||
|
(require 'cc-mode)
|
||||||
|
|
||||||
(defcustom scad-command
|
(defcustom scad-command
|
||||||
'"openscad"
|
'"openscad"
|
||||||
"Path to openscad executable"
|
"Path to openscad executable"
|
||||||
|
|
@ -68,30 +70,41 @@
|
||||||
"str"
|
"str"
|
||||||
"lookup" "version" "version_num" "len" "search"
|
"lookup" "version" "version_num" "len" "search"
|
||||||
"dxf_dim" "dxf_cross" ;;dxfdim.cc
|
"dxf_dim" "dxf_cross" ;;dxfdim.cc
|
||||||
|
"norm" "cross" ;;2014.03
|
||||||
|
"concat" "chr" ;;2015.03
|
||||||
)
|
)
|
||||||
"SCAD functions."
|
"SCAD functions."
|
||||||
:type 'list
|
:type 'list
|
||||||
:group 'scad-font-lock)
|
:group 'scad-font-lock)
|
||||||
|
|
||||||
(defcustom scad-modules
|
(defcustom scad-modules
|
||||||
'("child" "children" "echo" "assign" "for" "intersection_for" "if" "else" ;;control.cc
|
'("children" "echo" "for" "intersection_for" "if" "else" ;;control.cc
|
||||||
"cube" "sphere" "cylinder" "polyhedron" "square" "circle" "polygon" ;;primitives.cc
|
"cube" "sphere" "cylinder" "polyhedron" "square" "circle" "polygon" ;;primitives.cc
|
||||||
"scale" "rotate" "translate" "mirror" "multmatrix" ;;transform.cc
|
"scale" "rotate" "translate" "mirror" "multmatrix" ;;transform.cc
|
||||||
"union" "difference" "intersection" ;;csgops.cc
|
"union" "difference" "intersection" ;;csgops.cc
|
||||||
"render" ;;render.cc
|
"render" ;;render.cc
|
||||||
"color" ;;color.cc
|
"color" ;;color.cc
|
||||||
"surface" ;;surface.cc
|
"surface" ;;surface.cc
|
||||||
"dxf_linear_extrude" "linear_extrude" ;;linearextrude.cc
|
"linear_extrude" ;;linearextrude.cc
|
||||||
"dxf_rotate_extrude" "rotate_extrude" ;;rotateextrude.cc
|
"rotate_extrude" ;;rotateextrude.cc
|
||||||
"import_stl" "import_off" "import_dxf" "import" ;;import.cc
|
"import" ;;import.cc
|
||||||
"group" ;;builtin.cc
|
"group" ;;builtin.cc
|
||||||
"projection" ;;projection.cc
|
"projection" ;;projection.cc
|
||||||
"minkowski" "glide" "subdiv" "hull" "resize" ;;cgaladv.cc
|
"minkowski" "glide" "subdiv" "hull" "resize" ;;cgaladv.cc
|
||||||
|
"parent_module" ;;2014.03
|
||||||
|
"let" "offset" "text" ;;2015.03
|
||||||
)
|
)
|
||||||
"SCAD modules."
|
"SCAD modules."
|
||||||
:type 'list
|
:type 'list
|
||||||
:group 'scad-font-lock)
|
:group 'scad-font-lock)
|
||||||
|
|
||||||
|
(defcustom scad-deprecated
|
||||||
|
'("child" "assign" "dxf_linear_extrude" "dxf_rotate_extrude"
|
||||||
|
"import_stl" "import_off" "import_dxf")
|
||||||
|
"SCAD deprecated modules and functions."
|
||||||
|
:type 'list
|
||||||
|
:group 'scad-font-lock)
|
||||||
|
|
||||||
(defcustom scad-operators
|
(defcustom scad-operators
|
||||||
'("+" "-" "*" "/" "%"
|
'("+" "-" "*" "/" "%"
|
||||||
"&&" "||" "!"
|
"&&" "||" "!"
|
||||||
|
|
@ -103,9 +116,9 @@
|
||||||
|
|
||||||
(defvar scad-mode-map
|
(defvar scad-mode-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map "\t" 'scad-indent-line)
|
|
||||||
(define-key map [(control c) (control o)] 'scad-open-current-buffer)
|
(define-key map [(control c) (control o)] 'scad-open-current-buffer)
|
||||||
(define-key map [return] 'newline-and-indent)
|
(define-key map [return] 'newline-and-indent)
|
||||||
|
;;(define-key map [(control c) (control s)] 'c-show-syntactic-information) ;; Debugging info
|
||||||
map)
|
map)
|
||||||
"Keymap for `scad-mode'.")
|
"Keymap for `scad-mode'.")
|
||||||
|
|
||||||
|
|
@ -138,6 +151,7 @@
|
||||||
(defvar scad-keywords-regexp (regexp-opt scad-keywords 'words))
|
(defvar scad-keywords-regexp (regexp-opt scad-keywords 'words))
|
||||||
(defvar scad-modules-regexp (regexp-opt scad-modules 'words))
|
(defvar scad-modules-regexp (regexp-opt scad-modules 'words))
|
||||||
(defvar scad-functions-regexp (regexp-opt scad-functions 'words))
|
(defvar scad-functions-regexp (regexp-opt scad-functions 'words))
|
||||||
|
(defvar scad-deprecated-regexp (regexp-opt scad-deprecated 'words))
|
||||||
(defvar scad-operators-regexp (regexp-opt scad-operators))
|
(defvar scad-operators-regexp (regexp-opt scad-operators))
|
||||||
|
|
||||||
(defvar scad-font-lock-keywords
|
(defvar scad-font-lock-keywords
|
||||||
|
|
@ -149,30 +163,41 @@
|
||||||
(,scad-keywords-regexp . font-lock-keyword-face)
|
(,scad-keywords-regexp . font-lock-keyword-face)
|
||||||
(,scad-modules-regexp . font-lock-builtin-face)
|
(,scad-modules-regexp . font-lock-builtin-face)
|
||||||
(,scad-functions-regexp . font-lock-function-name-face)
|
(,scad-functions-regexp . font-lock-function-name-face)
|
||||||
|
(,scad-deprecated-regexp . font-lock-warning-face)
|
||||||
;(,scad-operators-regexp . font-lock-operator-face) ;; This actually looks pretty ugly
|
;(,scad-operators-regexp . font-lock-operator-face) ;; This actually looks pretty ugly
|
||||||
;("\\(\\<\\S +\\>\\)\\s *(" 1 font-lock-function-name-face t) ;; Seems to override other stuff (e.g. in comments and builtins)
|
;("\\(\\<\\S +\\>\\)\\s *(" 1 font-lock-function-name-face t) ;; Seems to override other stuff (e.g. in comments and builtins)
|
||||||
)
|
)
|
||||||
"Keyword highlighting specification for `scad-mode'.")
|
"Keyword highlighting specification for `scad-mode'.")
|
||||||
|
(defconst scad-font-lock-keywords-1 scad-font-lock-keywords)
|
||||||
|
(defconst scad-font-lock-keywords-2 scad-font-lock-keywords)
|
||||||
|
(defconst scad-font-lock-keywords-3 scad-font-lock-keywords)
|
||||||
|
|
||||||
;(defvar scad-imenu-generic-expression ...)
|
(defvar scad-indent-style nil
|
||||||
;(defvar scad-outline-regexp ...)
|
"The style of indentation for scad-mode. Defaults to \"k&r\" if
|
||||||
|
nil. If you want to set the style with file local variables use
|
||||||
|
the `c-file-style' variable")
|
||||||
|
|
||||||
|
(put 'scad-mode 'c-mode-prefix "scad-")
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-derived-mode scad-mode fundamental-mode "SCAD"
|
(define-derived-mode scad-mode prog-mode "SCAD"
|
||||||
"A major mode for editing SCAD files."
|
"Major mode for editing OpenSCAD code.
|
||||||
:syntax-table scad-mode-syntax-table
|
|
||||||
(set (make-local-variable 'font-lock-defaults) '(scad-font-lock-keywords))
|
|
||||||
(set (make-local-variable 'indent-line-function) 'scad-indent-line)
|
|
||||||
;(set (make-local-variable 'imenu-generic-expression) scad-imenu-generic-expression)
|
|
||||||
;(set (make-local-variable 'outline-regexp) scad-outline-regexp)
|
|
||||||
;; set comment styles for scad mode
|
|
||||||
(set (make-local-variable 'comment-start) "//")
|
|
||||||
(set (make-local-variable 'comment-end) "")
|
|
||||||
(set (make-local-variable 'block-comment-start) "/*")
|
|
||||||
(set (make-local-variable 'block-comment-end) "*/")
|
|
||||||
|
|
||||||
)
|
To see what version of CC Mode you are running, enter `\\[c-version]'.
|
||||||
|
|
||||||
|
The hook `c-mode-common-hook' is run with no args at mode
|
||||||
|
initialization, then `scad-mode-hook'.
|
||||||
|
|
||||||
|
Key bindings:
|
||||||
|
\\{scad-mode-map}"
|
||||||
|
(c-initialize-cc-mode)
|
||||||
|
;; (setq local-abbrev-table scad-mode-abbrev-table
|
||||||
|
;; abbrev-mode t)
|
||||||
|
(use-local-map scad-mode-map)
|
||||||
|
(c-set-offset (quote cpp-macro) 0 nil)
|
||||||
|
(c-basic-common-init 'scad-mode (or scad-indent-style "k&r"))
|
||||||
|
(c-font-lock-init)
|
||||||
|
(c-run-mode-hooks 'c-mode-common-hook 'scad-mode-hook)
|
||||||
|
(c-update-modeline))
|
||||||
|
|
||||||
;; From: http://stackoverflow.com/questions/14520073/add-words-for-dynamic-expansion-to-emacs-mode
|
;; From: http://stackoverflow.com/questions/14520073/add-words-for-dynamic-expansion-to-emacs-mode
|
||||||
(defun scad-prime-dabbrev ()
|
(defun scad-prime-dabbrev ()
|
||||||
|
|
@ -181,69 +206,12 @@
|
||||||
(with-current-buffer (get-buffer-create " *scad words*")
|
(with-current-buffer (get-buffer-create " *scad words*")
|
||||||
(scad-mode)
|
(scad-mode)
|
||||||
(insert "module function use include") ; Explicitly add these -- they're not in the below vars
|
(insert "module function use include") ; Explicitly add these -- they're not in the below vars
|
||||||
(insert (mapconcat 'identity (append scad-keywords scad-functions scad-modules) " ")))))
|
(insert (mapconcat 'identity (append scad-keywords scad-functions scad-modules scad-deprecated) " ")))))
|
||||||
(add-hook 'scad-mode-hook 'scad-prime-dabbrev)
|
(add-hook 'scad-mode-hook 'scad-prime-dabbrev)
|
||||||
|
|
||||||
|
|
||||||
;;; Indentation, based on http://www.emacswiki.org/emacs/download/actionscript-mode-haas-7.0.el
|
|
||||||
|
|
||||||
(defun scad-indent-line ()
|
|
||||||
"Indent current line of SCAD code."
|
|
||||||
(interactive)
|
|
||||||
(let ((savep (> (current-column) (current-indentation)))
|
|
||||||
(indent (max (scad-calculate-indentation) 0)))
|
|
||||||
(if savep
|
|
||||||
(save-excursion (indent-line-to indent))
|
|
||||||
(indent-line-to indent))))
|
|
||||||
|
|
||||||
(defun scad-calculate-indentation ()
|
|
||||||
"Return the column to which the current line should be indented."
|
|
||||||
(save-excursion
|
|
||||||
(scad-maybe-skip-leading-close-delim)
|
|
||||||
(let ((pos (point)))
|
|
||||||
(beginning-of-line)
|
|
||||||
(if (not (search-backward-regexp "[^\n\t\r ]" 1 0))
|
|
||||||
0
|
|
||||||
(progn
|
|
||||||
(scad-maybe-skip-leading-close-delim)
|
|
||||||
(+ (current-indentation) (* standard-indent (scad-count-scope-depth (point) pos))))))))
|
|
||||||
|
|
||||||
(defun scad-maybe-skip-leading-close-delim ()
|
|
||||||
(beginning-of-line)
|
|
||||||
(forward-to-indentation 0)
|
|
||||||
(if (looking-at "\\s)")
|
|
||||||
(forward-char)
|
|
||||||
(beginning-of-line)))
|
|
||||||
|
|
||||||
(defun scad-face-at-point (pos)
|
|
||||||
"Return face descriptor for char at point."
|
|
||||||
(plist-get (text-properties-at pos) 'face))
|
|
||||||
|
|
||||||
(defun scad-count-scope-depth (rstart rend)
|
|
||||||
"Return difference between open and close scope delimeters."
|
|
||||||
(save-excursion
|
|
||||||
(goto-char rstart)
|
|
||||||
(let ((open-count 0)
|
|
||||||
(close-count 0)
|
|
||||||
opoint)
|
|
||||||
(while (and (< (point) rend)
|
|
||||||
(progn (setq opoint (point))
|
|
||||||
(re-search-forward "\\s)\\|\\s(" rend t)))
|
|
||||||
(if (= opoint (point))
|
|
||||||
(forward-char 1)
|
|
||||||
(cond
|
|
||||||
;; Don't count if in string or comment.
|
|
||||||
((scad-face-at-point (- (point) 1)))
|
|
||||||
((looking-back "\\s)")
|
|
||||||
(setq close-count (+ close-count 1)))
|
|
||||||
((looking-back "\\s(")
|
|
||||||
(setq open-count (+ open-count 1)))
|
|
||||||
)))
|
|
||||||
(- open-count close-count))))
|
|
||||||
|
|
||||||
(defun scad-open-current-buffer ()
|
(defun scad-open-current-buffer ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(call-process scad-command nil 0 nil (buffer-file-name)))
|
(call-process scad-command nil 0 nil (buffer-file-name)))
|
||||||
|
|
||||||
(provide 'scad)
|
(provide 'scad-mode)
|
||||||
;;; scad-mode.el ends here
|
;;; scad-mode.el ends here
|
||||||
|
|
|
||||||
17
csgopnode.h
Normal file
17
csgopnode.h
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "node.h"
|
||||||
|
#include "visitor.h"
|
||||||
|
#include "enums.h"
|
||||||
|
|
||||||
|
class CsgNode : public AbstractNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OpenSCADOperator type;
|
||||||
|
CsgNode(const ModuleInstantiation *mi, OpenSCADOperator type) : AbstractNode(mi), type(type) { }
|
||||||
|
virtual Response accept(class State &state, Visitor &visitor) const {
|
||||||
|
return visitor.visit(state, *this);
|
||||||
|
}
|
||||||
|
virtual std::string toString() const;
|
||||||
|
virtual std::string name() const;
|
||||||
|
};
|
||||||
259
doc/Python-LICENSE.txt
Normal file
259
doc/Python-LICENSE.txt
Normal file
|
|
@ -0,0 +1,259 @@
|
||||||
|
Part of OpenSCAD is copied from Python (linalg.cc/hash_floating_point()),
|
||||||
|
so the python license is included below.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
A. HISTORY OF THE SOFTWARE
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Python was created in the early 1990s by Guido van Rossum at Stichting
|
||||||
|
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
|
||||||
|
as a successor of a language called ABC. Guido remains Python's
|
||||||
|
principal author, although it includes many contributions from others.
|
||||||
|
|
||||||
|
In 1995, Guido continued his work on Python at the Corporation for
|
||||||
|
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
|
||||||
|
in Reston, Virginia where he released several versions of the
|
||||||
|
software.
|
||||||
|
|
||||||
|
In May 2000, Guido and the Python core development team moved to
|
||||||
|
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
|
||||||
|
year, the PythonLabs team moved to Digital Creations (now Zope
|
||||||
|
Corporation, see http://www.zope.com). In 2001, the Python Software
|
||||||
|
Foundation (PSF, see http://www.python.org/psf/) was formed, a
|
||||||
|
non-profit organization created specifically to own Python-related
|
||||||
|
Intellectual Property. Zope Corporation is a sponsoring member of
|
||||||
|
the PSF.
|
||||||
|
|
||||||
|
All Python releases are Open Source (see http://www.opensource.org for
|
||||||
|
the Open Source Definition). Historically, most, but not all, Python
|
||||||
|
releases have also been GPL-compatible; the table below summarizes
|
||||||
|
the various releases.
|
||||||
|
|
||||||
|
Release Derived Year Owner GPL-
|
||||||
|
from compatible? (1)
|
||||||
|
|
||||||
|
0.9.0 thru 1.2 1991-1995 CWI yes
|
||||||
|
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
|
||||||
|
1.6 1.5.2 2000 CNRI no
|
||||||
|
2.0 1.6 2000 BeOpen.com no
|
||||||
|
1.6.1 1.6 2001 CNRI yes (2)
|
||||||
|
2.1 2.0+1.6.1 2001 PSF no
|
||||||
|
2.0.1 2.0+1.6.1 2001 PSF yes
|
||||||
|
2.1.1 2.1+2.0.1 2001 PSF yes
|
||||||
|
2.1.2 2.1.1 2002 PSF yes
|
||||||
|
2.1.3 2.1.2 2002 PSF yes
|
||||||
|
2.2 and above 2.1.1 2001-now PSF yes
|
||||||
|
|
||||||
|
Footnotes:
|
||||||
|
|
||||||
|
(1) GPL-compatible doesn't mean that we're distributing Python under
|
||||||
|
the GPL. All Python licenses, unlike the GPL, let you distribute
|
||||||
|
a modified version without making your changes open source. The
|
||||||
|
GPL-compatible licenses make it possible to combine Python with
|
||||||
|
other software that is released under the GPL; the others don't.
|
||||||
|
|
||||||
|
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
|
||||||
|
because its license has a choice of law clause. According to
|
||||||
|
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
|
||||||
|
is "not incompatible" with the GPL.
|
||||||
|
|
||||||
|
Thanks to the many outside volunteers who have worked under Guido's
|
||||||
|
direction to make these releases possible.
|
||||||
|
|
||||||
|
|
||||||
|
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
|
||||||
|
===============================================================
|
||||||
|
|
||||||
|
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
||||||
|
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
||||||
|
otherwise using this software ("Python") in source or binary form and
|
||||||
|
its associated documentation.
|
||||||
|
|
||||||
|
2. Subject to the terms and conditions of this License Agreement, PSF hereby
|
||||||
|
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
|
||||||
|
analyze, test, perform and/or display publicly, prepare derivative works,
|
||||||
|
distribute, and otherwise use Python alone or in any derivative version,
|
||||||
|
provided, however, that PSF's License Agreement and PSF's notice of copyright,
|
||||||
|
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
|
2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved"
|
||||||
|
are retained in Python alone or in any derivative version prepared by Licensee.
|
||||||
|
|
||||||
|
3. In the event Licensee prepares a derivative work that is based on
|
||||||
|
or incorporates Python or any part thereof, and wants to make
|
||||||
|
the derivative work available to others as provided herein, then
|
||||||
|
Licensee hereby agrees to include in any such work a brief summary of
|
||||||
|
the changes made to Python.
|
||||||
|
|
||||||
|
4. PSF is making Python available to Licensee on an "AS IS"
|
||||||
|
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||||
|
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
||||||
|
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||||
|
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
||||||
|
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||||
|
|
||||||
|
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||||
|
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||||
|
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
||||||
|
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||||
|
|
||||||
|
6. This License Agreement will automatically terminate upon a material
|
||||||
|
breach of its terms and conditions.
|
||||||
|
|
||||||
|
7. Nothing in this License Agreement shall be deemed to create any
|
||||||
|
relationship of agency, partnership, or joint venture between PSF and
|
||||||
|
Licensee. This License Agreement does not grant permission to use PSF
|
||||||
|
trademarks or trade name in a trademark sense to endorse or promote
|
||||||
|
products or services of Licensee, or any third party.
|
||||||
|
|
||||||
|
8. By copying, installing or otherwise using Python, Licensee
|
||||||
|
agrees to be bound by the terms and conditions of this License
|
||||||
|
Agreement.
|
||||||
|
|
||||||
|
|
||||||
|
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
|
||||||
|
|
||||||
|
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
|
||||||
|
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
|
||||||
|
Individual or Organization ("Licensee") accessing and otherwise using
|
||||||
|
this software in source or binary form and its associated
|
||||||
|
documentation ("the Software").
|
||||||
|
|
||||||
|
2. Subject to the terms and conditions of this BeOpen Python License
|
||||||
|
Agreement, BeOpen hereby grants Licensee a non-exclusive,
|
||||||
|
royalty-free, world-wide license to reproduce, analyze, test, perform
|
||||||
|
and/or display publicly, prepare derivative works, distribute, and
|
||||||
|
otherwise use the Software alone or in any derivative version,
|
||||||
|
provided, however, that the BeOpen Python License is retained in the
|
||||||
|
Software, alone or in any derivative version prepared by Licensee.
|
||||||
|
|
||||||
|
3. BeOpen is making the Software available to Licensee on an "AS IS"
|
||||||
|
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||||
|
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
|
||||||
|
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||||
|
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
|
||||||
|
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||||
|
|
||||||
|
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
|
||||||
|
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
|
||||||
|
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
|
||||||
|
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||||
|
|
||||||
|
5. This License Agreement will automatically terminate upon a material
|
||||||
|
breach of its terms and conditions.
|
||||||
|
|
||||||
|
6. This License Agreement shall be governed by and interpreted in all
|
||||||
|
respects by the law of the State of California, excluding conflict of
|
||||||
|
law provisions. Nothing in this License Agreement shall be deemed to
|
||||||
|
create any relationship of agency, partnership, or joint venture
|
||||||
|
between BeOpen and Licensee. This License Agreement does not grant
|
||||||
|
permission to use BeOpen trademarks or trade names in a trademark
|
||||||
|
sense to endorse or promote products or services of Licensee, or any
|
||||||
|
third party. As an exception, the "BeOpen Python" logos available at
|
||||||
|
http://www.pythonlabs.com/logos.html may be used according to the
|
||||||
|
permissions granted on that web page.
|
||||||
|
|
||||||
|
7. By copying, installing or otherwise using the software, Licensee
|
||||||
|
agrees to be bound by the terms and conditions of this License
|
||||||
|
Agreement.
|
||||||
|
|
||||||
|
|
||||||
|
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
1. This LICENSE AGREEMENT is between the Corporation for National
|
||||||
|
Research Initiatives, having an office at 1895 Preston White Drive,
|
||||||
|
Reston, VA 20191 ("CNRI"), and the Individual or Organization
|
||||||
|
("Licensee") accessing and otherwise using Python 1.6.1 software in
|
||||||
|
source or binary form and its associated documentation.
|
||||||
|
|
||||||
|
2. Subject to the terms and conditions of this License Agreement, CNRI
|
||||||
|
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
||||||
|
license to reproduce, analyze, test, perform and/or display publicly,
|
||||||
|
prepare derivative works, distribute, and otherwise use Python 1.6.1
|
||||||
|
alone or in any derivative version, provided, however, that CNRI's
|
||||||
|
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
|
||||||
|
1995-2001 Corporation for National Research Initiatives; All Rights
|
||||||
|
Reserved" are retained in Python 1.6.1 alone or in any derivative
|
||||||
|
version prepared by Licensee. Alternately, in lieu of CNRI's License
|
||||||
|
Agreement, Licensee may substitute the following text (omitting the
|
||||||
|
quotes): "Python 1.6.1 is made available subject to the terms and
|
||||||
|
conditions in CNRI's License Agreement. This Agreement together with
|
||||||
|
Python 1.6.1 may be located on the Internet using the following
|
||||||
|
unique, persistent identifier (known as a handle): 1895.22/1013. This
|
||||||
|
Agreement may also be obtained from a proxy server on the Internet
|
||||||
|
using the following URL: http://hdl.handle.net/1895.22/1013".
|
||||||
|
|
||||||
|
3. In the event Licensee prepares a derivative work that is based on
|
||||||
|
or incorporates Python 1.6.1 or any part thereof, and wants to make
|
||||||
|
the derivative work available to others as provided herein, then
|
||||||
|
Licensee hereby agrees to include in any such work a brief summary of
|
||||||
|
the changes made to Python 1.6.1.
|
||||||
|
|
||||||
|
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
|
||||||
|
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||||
|
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
|
||||||
|
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||||
|
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
|
||||||
|
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||||
|
|
||||||
|
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||||
|
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||||
|
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
|
||||||
|
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||||
|
|
||||||
|
6. This License Agreement will automatically terminate upon a material
|
||||||
|
breach of its terms and conditions.
|
||||||
|
|
||||||
|
7. This License Agreement shall be governed by the federal
|
||||||
|
intellectual property law of the United States, including without
|
||||||
|
limitation the federal copyright law, and, to the extent such
|
||||||
|
U.S. federal law does not apply, by the law of the Commonwealth of
|
||||||
|
Virginia, excluding Virginia's conflict of law provisions.
|
||||||
|
Notwithstanding the foregoing, with regard to derivative works based
|
||||||
|
on Python 1.6.1 that incorporate non-separable material that was
|
||||||
|
previously distributed under the GNU General Public License (GPL), the
|
||||||
|
law of the Commonwealth of Virginia shall govern this License
|
||||||
|
Agreement only as to issues arising under or with respect to
|
||||||
|
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
|
||||||
|
License Agreement shall be deemed to create any relationship of
|
||||||
|
agency, partnership, or joint venture between CNRI and Licensee. This
|
||||||
|
License Agreement does not grant permission to use CNRI trademarks or
|
||||||
|
trade name in a trademark sense to endorse or promote products or
|
||||||
|
services of Licensee, or any third party.
|
||||||
|
|
||||||
|
8. By clicking on the "ACCEPT" button where indicated, or by copying,
|
||||||
|
installing or otherwise using Python 1.6.1, Licensee agrees to be
|
||||||
|
bound by the terms and conditions of this License Agreement.
|
||||||
|
|
||||||
|
ACCEPT
|
||||||
|
|
||||||
|
|
||||||
|
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
|
||||||
|
The Netherlands. All rights reserved.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
|
documentation for any purpose and without fee is hereby granted,
|
||||||
|
provided that the above copyright notice appear in all copies and that
|
||||||
|
both that copyright notice and this permission notice appear in
|
||||||
|
supporting documentation, and that the name of Stichting Mathematisch
|
||||||
|
Centrum or CWI not be used in advertising or publicity pertaining to
|
||||||
|
distribution of the software without specific, written prior
|
||||||
|
permission.
|
||||||
|
|
||||||
|
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||||
|
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
||||||
|
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||||
|
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
@ -82,8 +82,10 @@ If exporting an image, specify the pixel width and height
|
||||||
If exporting an image, specify whether to use orthographic or perspective
|
If exporting an image, specify whether to use orthographic or perspective
|
||||||
projection
|
projection
|
||||||
.TP
|
.TP
|
||||||
.B \-\-colorscheme=[Cornfield|Sunset|Metallic|Starnight|BeforeDawn|Nature|DeepOcean]
|
.B \-\-colorscheme=\fIscheme
|
||||||
If exporting an image, use the specified color scheme for the rendering.
|
If exporting an image, use the specified color scheme for the rendering.
|
||||||
|
\fIscheme\fP can be any of \fBCornfield\fP, \fBSunset\fP, \fBMetallic\fP,
|
||||||
|
\fBStarnight\fP, \fBBeforeDawn\fP, \fBNature\fP or \fBDeepOcean\fP.
|
||||||
.TP
|
.TP
|
||||||
.B \-v, \-\-version
|
.B \-v, \-\-version
|
||||||
Show version of program.
|
Show version of program.
|
||||||
|
|
@ -106,7 +108,7 @@ distance 500, with orthographic projection:
|
||||||
Set the 'mode' variable in example017 so that it will render only the
|
Set the 'mode' variable in example017 so that it will render only the
|
||||||
parts of the shape. Export to a .dxf file.
|
parts of the shape. Export to a .dxf file.
|
||||||
.PP
|
.PP
|
||||||
.B openscad -x example017.dxf -D'mode="parts"' examples/example017.scad
|
.B openscad -o example017.dxf -D'mode="parts"' examples/example017.scad
|
||||||
|
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
OpenSCAD was written by Clifford Wolf, Marius Kintel, and others.
|
OpenSCAD was written by Clifford Wolf, Marius Kintel, and others.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ Given:
|
||||||
|
|
||||||
o Make sure we have a $VERSION branch. If not, create one
|
o Make sure we have a $VERSION branch. If not, create one
|
||||||
|
|
||||||
|
o Update releases/$VERSION.md
|
||||||
|
o scripts/makereleasenotes.sh
|
||||||
|
|
||||||
o Update VERSION and VERSIONDATE in
|
o Update VERSION and VERSIONDATE in
|
||||||
openscad.pro
|
openscad.pro
|
||||||
scripts/publish-macosx.sh
|
scripts/publish-macosx.sh
|
||||||
|
|
@ -12,12 +15,16 @@ o Update VERSION and VERSIONDATE in
|
||||||
|
|
||||||
o git tag "openscad-$VERSION"
|
o git tag "openscad-$VERSION"
|
||||||
o ./scripts/git-archive-all.py --prefix=openscad-$VERSION/ openscad-$VERSION.src.tar.gz
|
o ./scripts/git-archive-all.py --prefix=openscad-$VERSION/ openscad-$VERSION.src.tar.gz
|
||||||
o git push --tags $VERSION
|
o git push --tags
|
||||||
o Upload Source package
|
o Upload Source package
|
||||||
$ scp openscad-$VERSION.src.tar.gz openscad@files.openscad.org:www
|
$ scp openscad-$VERSION.src.tar.gz openscad@files.openscad.org:www
|
||||||
o Write short release email to mailing list
|
|
||||||
o Tweet as OpenSCAD
|
o Revert VERSION and VERSIONDATE in openscad.pro scripts/publish-macosx.sh scripts/release-common.sh scripts/publish-mingw-x.sh tests/CMakeLists.txt
|
||||||
o Notify package managers
|
|
||||||
|
o Announce:
|
||||||
|
- Write short release email to mailing list
|
||||||
|
- Tweet as OpenSCAD
|
||||||
|
- Notify package managers
|
||||||
- Debian/Ubuntu: https://launchpad.net/~chrysn
|
- Debian/Ubuntu: https://launchpad.net/~chrysn
|
||||||
- Ubuntu PPA: https://github.com/hyperair
|
- Ubuntu PPA: https://github.com/hyperair
|
||||||
- Fedora: Miro Hrončok <miro@hroncok.cz> or <mhroncok@redhat.com>
|
- Fedora: Miro Hrončok <miro@hroncok.cz> or <mhroncok@redhat.com>
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,13 @@ o scripts/makereleasenotes.sh
|
||||||
|
|
||||||
o Update version number in doc/openscad.1
|
o Update version number in doc/openscad.1
|
||||||
o Update copyright year in AboutDialog.html and mainwin.cc
|
o Update copyright year in AboutDialog.html and mainwin.cc
|
||||||
o Add VERSION and VERSIONDATE in openscad.pro, scripts/publish-macosx.sh, scripts/release-common.sh
|
o Add VERSION and VERSIONDATE in openscad.pro, scripts/publish-macosx.sh, scripts/release-common.sh tests/CMakeLists.txt
|
||||||
o Add VERSION in tests/CMakeLists.txt, scripts/publish-mingw-x.sh
|
o Add VERSION in tests/CMakeLists.txt, scripts/publish-mingw-x.sh
|
||||||
|
|
||||||
o Tag release
|
o Tag release
|
||||||
git tag "openscad-$VERSION"
|
git tag "openscad-$VERSION"
|
||||||
|
|
||||||
o Revert VERSION and VERSIONDATE in
|
o Revert VERSION and VERSIONDATE in openscad.pro scripts/publish-macosx.sh scripts/release-common.sh scripts/publish-mingw-x.sh tests/CMakeLists.txt
|
||||||
openscad.pro, scripts/publish-macosx.sh, scripts/release-common.sh, scripts/publish-mingw-x.sh
|
|
||||||
|
|
||||||
o build source package
|
o build source package
|
||||||
scripts/git-archive-all.py --prefix=openscad-$VERSION/ openscad-$VERSION.src.tar.gz
|
scripts/git-archive-all.py --prefix=openscad-$VERSION/ openscad-$VERSION.src.tar.gz
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ files.
|
||||||
$ make clean && qmake && make
|
$ make clean && qmake && make
|
||||||
|
|
||||||
Then run the script to scan the source files, and regenerate .pot & .po files.
|
Then run the script to scan the source files, and regenerate .pot & .po files.
|
||||||
|
You'll need itstool (http://itstool.org/) installed.
|
||||||
|
|
||||||
$ ./scripts/translation-update.sh
|
$ ./scripts/translation-update.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
echo(version=version());
|
echo(version=version());
|
||||||
|
|
||||||
// rotate_extrude() always rotates the 2D shape 360 degrees
|
// rotate_extrude() rotates a 2D shape around the Z axis.
|
||||||
// around the Z axis. Note that the 2D shape must be either
|
// Note that the 2D shape must be either completely on the
|
||||||
// completely on the positive or negative side of the X axis.
|
// positive or negative side of the X axis.
|
||||||
color("red")
|
color("red")
|
||||||
rotate_extrude()
|
rotate_extrude()
|
||||||
translate([10, 0])
|
translate([10, 0])
|
||||||
|
|
@ -23,6 +23,26 @@ color("green")
|
||||||
polygon( points=[[0,0],[8,4],[4,8],[4,12],[12,16],[0,20]] );
|
polygon( points=[[0,0],[8,4],[4,8],[4,12],[12,16],[0,20]] );
|
||||||
|
|
||||||
|
|
||||||
|
// By default rotate_extrude forms a full 360 degree circle,
|
||||||
|
// but a partial rotation can be performed by using the angle parameter.
|
||||||
|
// Positive angles create an arc starting from the X axis, going counter-clockwise.
|
||||||
|
// Negative angles generate an arc in the clockwise direction.
|
||||||
|
color("magenta")
|
||||||
|
translate([40,40]){
|
||||||
|
rotate_extrude(angle=180)
|
||||||
|
translate([12.5,0])
|
||||||
|
square(5);
|
||||||
|
translate([7.5,0])
|
||||||
|
rotate_extrude(angle=180)
|
||||||
|
translate([5,0])
|
||||||
|
square(5);
|
||||||
|
translate([-7.5,0])
|
||||||
|
rotate_extrude(angle=-180)
|
||||||
|
translate([5,0])
|
||||||
|
square(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Written in 2015 by Torsten Paul <Torsten.Paul@gmx.de>
|
// Written in 2015 by Torsten Paul <Torsten.Paul@gmx.de>
|
||||||
//
|
//
|
||||||
// To the extent possible under law, the author(s) have dedicated all
|
// To the extent possible under law, the author(s) have dedicated all
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@ y_shift=thisFont[0][1];
|
||||||
hours=["one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"];
|
hours=["one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"];
|
||||||
|
|
||||||
module clock_hour_words(word_offset=20.0,word_height=2.0) {
|
module clock_hour_words(word_offset=20.0,word_height=2.0) {
|
||||||
for(i=[0:(len(hours)-1)]) assign( hourHandAngle=(i+1)*360/len(hours), theseIndicies=search(hours[i],thisFont[2],1,1) ) {
|
for(i=[0:(len(hours)-1)]) {
|
||||||
|
hourHandAngle=(i+1)*360/len(hours);
|
||||||
|
theseIndicies=search(hours[i],thisFont[2],1,1);
|
||||||
rotate(90-hourHandAngle) translate([word_offset,0])
|
rotate(90-hourHandAngle) translate([word_offset,0])
|
||||||
for( j=[0:(len(theseIndicies)-1)] ) translate([j*x_shift,-y_shift/2]) {
|
for( j=[0:(len(theseIndicies)-1)] ) translate([j*x_shift,-y_shift/2]) {
|
||||||
linear_extrude(height=word_height) polygon(points=thisFont[2][theseIndicies[j]][6][0],paths=thisFont[2][theseIndicies[j]][6][1]);
|
linear_extrude(height=word_height) polygon(points=thisFont[2][theseIndicies[j]][6][0],paths=thisFont[2][theseIndicies[j]][6][1]);
|
||||||
|
|
|
||||||
2
glew.pri
2
glew.pri
|
|
@ -10,7 +10,9 @@ glew {
|
||||||
|
|
||||||
unix:LIBS += -lGLEW
|
unix:LIBS += -lGLEW
|
||||||
CONFIG(mingw-cross-env): {
|
CONFIG(mingw-cross-env): {
|
||||||
|
!CONFIG(mingw-cross-env-shared) {
|
||||||
DEFINES += GLEW_STATIC
|
DEFINES += GLEW_STATIC
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
win32:LIBS += -lglew32
|
win32:LIBS += -lglew32
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ isEmpty(GLIB2_LIBPATH) {
|
||||||
GLIB2_LIBS = -L$$GLIB2_LIBPATH -lglib-2.0
|
GLIB2_LIBS = -L$$GLIB2_LIBPATH -lglib-2.0
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG(mingw-cross-env) {
|
CONFIG(mingw-cross-env)|CONFIG(mingw-cross-env-shared) {
|
||||||
#message("mingw")
|
#message("mingw")
|
||||||
isEmpty(GLIB2_INCLUDEPATH) {
|
isEmpty(GLIB2_INCLUDEPATH) {
|
||||||
MXE_TARGET_DIR=$$(MXETARGETDIR)
|
MXE_TARGET_DIR=$$(MXETARGETDIR)
|
||||||
|
|
|
||||||
BIN
icons/flattr.png
BIN
icons/flattr.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB |
|
|
@ -6,3 +6,4 @@ Icon=openscad
|
||||||
Exec=openscad %f
|
Exec=openscad %f
|
||||||
MimeType=application/x-openscad;
|
MimeType=application/x-openscad;
|
||||||
Categories=Graphics;3DGraphics;Engineering;
|
Categories=Graphics;3DGraphics;Engineering;
|
||||||
|
Keywords=3d;solid;geometry;csg;model;stl;
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 570 B After Width: | Height: | Size: 979 B |
Binary file not shown.
|
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 991 B |
|
|
@ -936,7 +936,7 @@ msgid "PolySet Cache size"
|
||||||
msgstr "Velikost PolySet cache"
|
msgstr "Velikost PolySet cache"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1158
|
#: objects/ui_Preferences.h:1158
|
||||||
msgid "Allow to open multiple documents"
|
msgid "Allow opening multiple documents"
|
||||||
msgstr "Povolit současné otevření více dokumentů"
|
msgstr "Povolit současné otevření více dokumentů"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1159
|
#: objects/ui_Preferences.h:1159
|
||||||
|
|
@ -1086,7 +1086,7 @@ msgstr[2] "Kompilace vyvolala %1 varování."
|
||||||
|
|
||||||
#: src/mainwin.cc:990
|
#: src/mainwin.cc:990
|
||||||
msgid " For details see <a href=\"#console\">console window</a>."
|
msgid " For details see <a href=\"#console\">console window</a>."
|
||||||
msgstr "Pro podrobnosti nahlédněte do <a href=\"#console\">konzole</a>."
|
msgstr " Pro podrobnosti nahlédněte do <a href=\"#console\">konzole</a>."
|
||||||
|
|
||||||
#: src/mainwin.cc:1355
|
#: src/mainwin.cc:1355
|
||||||
msgid "Save File"
|
msgid "Save File"
|
||||||
|
|
|
||||||
|
|
@ -956,7 +956,7 @@ msgid "PolySet Cache size"
|
||||||
msgstr "PolySet Cache Größe"
|
msgstr "PolySet Cache Größe"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1158
|
#: objects/ui_Preferences.h:1158
|
||||||
msgid "Allow to open multiple documents"
|
msgid "Allow opening multiple documents"
|
||||||
msgstr "Öffnen von mehreren Dokumenten erlauben"
|
msgstr "Öffnen von mehreren Dokumenten erlauben"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1159
|
#: objects/ui_Preferences.h:1159
|
||||||
|
|
|
||||||
|
|
@ -993,7 +993,7 @@ msgid "PolySet Cache size"
|
||||||
msgstr "Tamaño de cache de PolySet"
|
msgstr "Tamaño de cache de PolySet"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1159
|
#: objects/ui_Preferences.h:1159
|
||||||
msgid "Allow to open multiple documents"
|
msgid "Allow opening multiple documents"
|
||||||
msgstr "Permitir a abrir varios documentos"
|
msgstr "Permitir a abrir varios documentos"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1160
|
#: objects/ui_Preferences.h:1160
|
||||||
|
|
|
||||||
|
|
@ -956,7 +956,7 @@ msgid "PolySet Cache size"
|
||||||
msgstr "Taille du Cache PolySet"
|
msgstr "Taille du Cache PolySet"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1158
|
#: objects/ui_Preferences.h:1158
|
||||||
msgid "Allow to open multiple documents"
|
msgid "Allow opening multiple documents"
|
||||||
msgstr "Autoriser l'ouverture de plusieurs documents"
|
msgstr "Autoriser l'ouverture de plusieurs documents"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1159
|
#: objects/ui_Preferences.h:1159
|
||||||
|
|
|
||||||
|
|
@ -926,7 +926,7 @@ msgid "PolySet Cache size"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1158
|
#: objects/ui_Preferences.h:1158
|
||||||
msgid "Allow to open multiple documents"
|
msgid "Allow opening multiple documents"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1159
|
#: objects/ui_Preferences.h:1159
|
||||||
|
|
|
||||||
|
|
@ -954,7 +954,7 @@ msgid "PolySet Cache size"
|
||||||
msgstr "Размер кэша PolySet"
|
msgstr "Размер кэша PolySet"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1158
|
#: objects/ui_Preferences.h:1158
|
||||||
msgid "Allow to open multiple documents"
|
msgid "Allow opening multiple documents"
|
||||||
msgstr "Разрешить открытие нескольких документов"
|
msgstr "Разрешить открытие нескольких документов"
|
||||||
|
|
||||||
#: objects/ui_Preferences.h:1159
|
#: objects/ui_Preferences.h:1159
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
# cross compilation unix->win32
|
# cross compilation unix->win32
|
||||||
|
# To use static linking, pass CONFIG+=mingw-cross-env to qmake
|
||||||
|
# To use shared linking, pass CONFIG+=mingw-cross-env-shared to qmake
|
||||||
CONFIG(mingw-cross-env) {
|
CONFIG(mingw-cross-env) {
|
||||||
LIBS += mingw-cross-env/lib/libglew32s.a
|
LIBS += mingw-cross-env/lib/libglew32s.a
|
||||||
LIBS += mingw-cross-env/lib/libglut.a
|
LIBS += mingw-cross-env/lib/libglut.a
|
||||||
|
|
@ -19,6 +21,17 @@ CONFIG(mingw-cross-env) {
|
||||||
LIBS += mingw-cross-env/lib/libexpat.a
|
LIBS += mingw-cross-env/lib/libexpat.a
|
||||||
LIBS += mingw-cross-env/lib/libintl.a
|
LIBS += mingw-cross-env/lib/libintl.a
|
||||||
LIBS += mingw-cross-env/lib/libiconv.a
|
LIBS += mingw-cross-env/lib/libiconv.a
|
||||||
|
}
|
||||||
|
|
||||||
|
CONFIG(mingw-cross-env-shared) {
|
||||||
|
# on MXE, the shared library .dll files are under 'bin' not 'lib'.
|
||||||
|
QMAKE_LFLAGS += -L./mingw-cross-env/bin
|
||||||
|
LIBS += -lglew32 -lglut -lopengl32 -lGLEW -lglu32
|
||||||
|
LIBS += -lopencsg -lmpfr -lgmp -lCGAL
|
||||||
|
LIBS += -lfontconfig -lfreetype -lharfbuzz -lbz2 -lexpat -lintl -liconv
|
||||||
|
}
|
||||||
|
|
||||||
|
CONFIG(mingw-cross-env)|CONFIG(mingw-cross-env-shared) {
|
||||||
QMAKE_CXXFLAGS += -fpermissive
|
QMAKE_CXXFLAGS += -fpermissive
|
||||||
WINSTACKSIZE = 8388608 # 8MB # github issue 116
|
WINSTACKSIZE = 8388608 # 8MB # github issue 116
|
||||||
QMAKE_CXXFLAGS += -Wl,--stack,$$WINSTACKSIZE
|
QMAKE_CXXFLAGS += -Wl,--stack,$$WINSTACKSIZE
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
opencsg {
|
opencsg {
|
||||||
DEFINES += ENABLE_OPENCSG
|
DEFINES += ENABLE_OPENCSG
|
||||||
CONFIG += glew
|
|
||||||
|
|
||||||
# Optionally specify location of OpenCSG using the
|
# Optionally specify location of OpenCSG using the
|
||||||
# OPENCSGDIR env. variable
|
# OPENCSGDIR env. variable
|
||||||
|
|
|
||||||
22
opengl.pri
Normal file
22
opengl.pri
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Prefer QOpenGLWidget for non-Windows platforms
|
||||||
|
# To explicitly enable QOpenGLWidget: qmake CONFIG += qopenglwidget
|
||||||
|
# To explicitly enable QGLWidget: qmake CONFIG += qglwidget
|
||||||
|
!win*: CONFIG += qopenglwidget
|
||||||
|
qopenglwidget:!qglwidget:!lessThan(QT_VERSION, 5.4): CONFIG += using_qopenglwidget
|
||||||
|
|
||||||
|
using_qopenglwidget {
|
||||||
|
message("Using QOpenGLWidget")
|
||||||
|
DEFINES += USE_QOPENGLWIDGET
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message("Using QGLWidget")
|
||||||
|
QT += opengl
|
||||||
|
}
|
||||||
|
|
||||||
|
# see http://fedoraproject.org/wiki/UnderstandingDSOLinkChange
|
||||||
|
# and https://github.com/openscad/openscad/pull/119
|
||||||
|
# ( QT += opengl does not automatically link glu on some DSO systems. )
|
||||||
|
unix:!macx {
|
||||||
|
QMAKE_LIBS_OPENGL *= -lGLU
|
||||||
|
QMAKE_LIBS_OPENGL *= -lX11
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<application>
|
<component type="desktop">
|
||||||
<id type="desktop">openscad.desktop</id>
|
<id>openscad.desktop</id>
|
||||||
<licence>CC0</licence>
|
<metadata_license>CC0-1.0</metadata_license>
|
||||||
|
<project_license>GPL-2.0+ and CC0-1.0</project_license>
|
||||||
|
<name>OpenSCAD</name>
|
||||||
<summary>The Programmers Solid 3D CAD Modeller</summary>
|
<summary>The Programmers Solid 3D CAD Modeller</summary>
|
||||||
<description>
|
<description>
|
||||||
<p>OpenSCAD is a software for creating solid 3D CAD models. Unlike most free software for creating 3D models (such as Blender) it does not focus on the artistic aspects of 3D modelling but instead on the CAD aspects. Thus it might be the application you are looking for when you are planning to create 3D models of machine parts but pretty sure is not what you are looking for when you are more interested in creating computer-animated movies.</p>
|
<p>OpenSCAD is a software for creating solid 3D CAD models. Unlike most free software for creating 3D models (such as Blender) it does not focus on the artistic aspects of 3D modelling but instead on the CAD aspects. Thus it might be the application you are looking for when you are planning to create 3D models of machine parts but pretty sure is not what you are looking for when you are more interested in creating computer-animated movies.</p>
|
||||||
|
|
@ -9,8 +11,12 @@
|
||||||
<p>OpenSCAD provides two main modelling techniques: First there is constructive solid geometry (aka CSG) and second there is extrusion of 2D outlines. As data exchange format format for this 2D outlines Autocad DXF files are used. In addition to 2D paths for extrusion it is also possible to read design parameters from DXF files. Besides DXF files OpenSCAD can read and create 3D models in the STL and OFF file formats.</p>
|
<p>OpenSCAD provides two main modelling techniques: First there is constructive solid geometry (aka CSG) and second there is extrusion of 2D outlines. As data exchange format format for this 2D outlines Autocad DXF files are used. In addition to 2D paths for extrusion it is also possible to read design parameters from DXF files. Besides DXF files OpenSCAD can read and create 3D models in the STL and OFF file formats.</p>
|
||||||
</description>
|
</description>
|
||||||
<screenshots>
|
<screenshots>
|
||||||
<screenshot type="default" width="800" height="437">http://www.openscad.org/images/appdata-screenshot-1.png</screenshot>
|
<screenshot type="default">
|
||||||
<screenshot width="800" height="465">http://www.openscad.org/images/appdata-screenshot-2.png</screenshot>
|
<image>http://www.openscad.org/images/appdata-screenshot-1.png</image>
|
||||||
|
</screenshot>
|
||||||
|
<screenshot>
|
||||||
|
<image>http://www.openscad.org/images/appdata-screenshot-2.png</image>
|
||||||
|
</screenshot>
|
||||||
</screenshots>
|
</screenshots>
|
||||||
<url type="homepage">http://www.openscad.org/</url>
|
<url type="homepage">http://www.openscad.org/</url>
|
||||||
</application>
|
</component>
|
||||||
78
openscad.pro
78
openscad.pro
|
|
@ -100,26 +100,9 @@ macx {
|
||||||
APP_RESOURCES.files = OpenSCAD.sdef dsa_pub.pem icons/SCAD.icns
|
APP_RESOURCES.files = OpenSCAD.sdef dsa_pub.pem icons/SCAD.icns
|
||||||
QMAKE_BUNDLE_DATA += APP_RESOURCES
|
QMAKE_BUNDLE_DATA += APP_RESOURCES
|
||||||
LIBS += -framework Cocoa -framework ApplicationServices
|
LIBS += -framework Cocoa -framework ApplicationServices
|
||||||
|
|
||||||
# Mac needs special care to link against the correct C++ library
|
|
||||||
# We attempt to auto-detect it by inspecting Boost
|
|
||||||
dirs = $${BOOSTDIR} $${QMAKE_LIBDIR}
|
|
||||||
for(dir, dirs) {
|
|
||||||
system(grep -q __112basic_string $${dir}/libboost_thread* >& /dev/null) {
|
|
||||||
message("Detected libc++-linked boost in $${dir}")
|
|
||||||
CONFIG += libc++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
libc++ {
|
|
||||||
QMAKE_CXXFLAGS += -stdlib=libc++
|
|
||||||
QMAKE_LFLAGS += -stdlib=libc++
|
|
||||||
QMAKE_OBJECTIVE_CFLAGS += -stdlib=libc++
|
|
||||||
# libc++ on requires Mac OS X 10.7+
|
|
||||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
win* {
|
win* {
|
||||||
RC_FILE = openscad_win32.rc
|
RC_FILE = openscad_win32.rc
|
||||||
QMAKE_CXXFLAGS += -DNOGDI
|
QMAKE_CXXFLAGS += -DNOGDI
|
||||||
|
|
@ -133,21 +116,12 @@ mingw* {
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG += qt
|
CONFIG += qt
|
||||||
QT += opengl concurrent
|
QT += widgets concurrent
|
||||||
|
|
||||||
# see http://fedoraproject.org/wiki/UnderstandingDSOLinkChange
|
|
||||||
# and https://github.com/openscad/openscad/pull/119
|
|
||||||
# ( QT += opengl does not automatically link glu on some DSO systems. )
|
|
||||||
unix:!macx {
|
|
||||||
QMAKE_LIBS_OPENGL *= -lGLU
|
|
||||||
QMAKE_LIBS_OPENGL *= -lX11
|
|
||||||
}
|
|
||||||
|
|
||||||
netbsd* {
|
netbsd* {
|
||||||
QMAKE_LFLAGS += -L/usr/X11R7/lib
|
QMAKE_LFLAGS += -L/usr/X11R7/lib
|
||||||
QMAKE_LFLAGS += -Wl,-R/usr/X11R7/lib
|
QMAKE_LFLAGS += -Wl,-R/usr/X11R7/lib
|
||||||
QMAKE_LFLAGS += -Wl,-R/usr/pkg/lib
|
QMAKE_LFLAGS += -Wl,-R/usr/pkg/lib
|
||||||
!clang: { QMAKE_CXXFLAGS += -std=c++0x }
|
|
||||||
# FIXME: Can the lines below be removed in favour of the OPENSCAD_LIBDIR handling above?
|
# FIXME: Can the lines below be removed in favour of the OPENSCAD_LIBDIR handling above?
|
||||||
!isEmpty(OPENSCAD_LIBDIR) {
|
!isEmpty(OPENSCAD_LIBDIR) {
|
||||||
QMAKE_CFLAGS = -I$$OPENSCAD_LIBDIR/include $$QMAKE_CFLAGS
|
QMAKE_CFLAGS = -I$$OPENSCAD_LIBDIR/include $$QMAKE_CFLAGS
|
||||||
|
|
@ -181,7 +155,6 @@ netbsd* {
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-variable
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-variable
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-function
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-function
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-c++11-extensions
|
|
||||||
# gettext
|
# gettext
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-format-security
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-format-security
|
||||||
# might want to actually turn this on once in a while
|
# might want to actually turn this on once in a while
|
||||||
|
|
@ -195,8 +168,10 @@ CONFIG(skip-version-check) {
|
||||||
|
|
||||||
# Application configuration
|
# Application configuration
|
||||||
macx:CONFIG += mdi
|
macx:CONFIG += mdi
|
||||||
|
CONFIG += c++11
|
||||||
CONFIG += cgal
|
CONFIG += cgal
|
||||||
CONFIG += opencsg
|
CONFIG += opencsg
|
||||||
|
CONFIG += glew
|
||||||
CONFIG += boost
|
CONFIG += boost
|
||||||
CONFIG += eigen
|
CONFIG += eigen
|
||||||
CONFIG += glib-2.0
|
CONFIG += glib-2.0
|
||||||
|
|
@ -206,13 +181,19 @@ CONFIG += fontconfig
|
||||||
CONFIG += gettext
|
CONFIG += gettext
|
||||||
|
|
||||||
#Uncomment the following line to enable the QScintilla editor
|
#Uncomment the following line to enable the QScintilla editor
|
||||||
CONFIG += scintilla
|
!nogui {
|
||||||
|
CONFIG += scintilla
|
||||||
|
}
|
||||||
|
|
||||||
# Make experimental features available
|
# Make experimental features available
|
||||||
experimental {
|
experimental {
|
||||||
DEFINES += ENABLE_EXPERIMENTAL
|
DEFINES += ENABLE_EXPERIMENTAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nogui {
|
||||||
|
DEFINES += OPENSCAD_NOGUI
|
||||||
|
}
|
||||||
|
|
||||||
mdi {
|
mdi {
|
||||||
DEFINES += ENABLE_MDI
|
DEFINES += ENABLE_MDI
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +201,7 @@ mdi {
|
||||||
include(common.pri)
|
include(common.pri)
|
||||||
|
|
||||||
# mingw has to come after other items so OBJECT_DIRS will work properly
|
# mingw has to come after other items so OBJECT_DIRS will work properly
|
||||||
CONFIG(mingw-cross-env) {
|
CONFIG(mingw-cross-env)|CONFIG(mingw-cross-env-shared) {
|
||||||
include(mingw-cross-env.pri)
|
include(mingw-cross-env.pri)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -262,6 +243,8 @@ HEADERS += src/typedefs.h \
|
||||||
src/QGLView.h \
|
src/QGLView.h \
|
||||||
src/GLView.h \
|
src/GLView.h \
|
||||||
src/MainWindow.h \
|
src/MainWindow.h \
|
||||||
|
src/OpenSCADApp.h \
|
||||||
|
src/WindowManager.h \
|
||||||
src/Preferences.h \
|
src/Preferences.h \
|
||||||
src/OpenCSGWarningDialog.h \
|
src/OpenCSGWarningDialog.h \
|
||||||
src/AboutDialog.h \
|
src/AboutDialog.h \
|
||||||
|
|
@ -272,8 +255,9 @@ HEADERS += src/typedefs.h \
|
||||||
src/context.h \
|
src/context.h \
|
||||||
src/modcontext.h \
|
src/modcontext.h \
|
||||||
src/evalcontext.h \
|
src/evalcontext.h \
|
||||||
src/csgterm.h \
|
src/csgops.h \
|
||||||
src/csgtermnormalizer.h \
|
src/CSGTreeNormalizer.h \
|
||||||
|
src/CSGTreeEvaluator.h \
|
||||||
src/dxfdata.h \
|
src/dxfdata.h \
|
||||||
src/dxfdim.h \
|
src/dxfdim.h \
|
||||||
src/export.h \
|
src/export.h \
|
||||||
|
|
@ -282,6 +266,7 @@ HEADERS += src/typedefs.h \
|
||||||
src/function.h \
|
src/function.h \
|
||||||
src/exceptions.h \
|
src/exceptions.h \
|
||||||
src/grid.h \
|
src/grid.h \
|
||||||
|
src/hash.h \
|
||||||
src/highlighter.h \
|
src/highlighter.h \
|
||||||
src/localscope.h \
|
src/localscope.h \
|
||||||
src/module.h \
|
src/module.h \
|
||||||
|
|
@ -319,12 +304,10 @@ HEADERS += src/typedefs.h \
|
||||||
src/ModuleCache.h \
|
src/ModuleCache.h \
|
||||||
src/GeometryCache.h \
|
src/GeometryCache.h \
|
||||||
src/GeometryEvaluator.h \
|
src/GeometryEvaluator.h \
|
||||||
src/CSGTermEvaluator.h \
|
|
||||||
src/Tree.h \
|
src/Tree.h \
|
||||||
src/DrawingCallback.h \
|
src/DrawingCallback.h \
|
||||||
src/FreetypeRenderer.h \
|
src/FreetypeRenderer.h \
|
||||||
src/FontCache.h \
|
src/FontCache.h \
|
||||||
src/mathc99.h \
|
|
||||||
src/memory.h \
|
src/memory.h \
|
||||||
src/linalg.h \
|
src/linalg.h \
|
||||||
src/Camera.h \
|
src/Camera.h \
|
||||||
|
|
@ -351,7 +334,6 @@ src/FontCache.h \
|
||||||
|
|
||||||
SOURCES += src/version_check.cc \
|
SOURCES += src/version_check.cc \
|
||||||
src/ProgressWidget.cc \
|
src/ProgressWidget.cc \
|
||||||
src/mathc99.cc \
|
|
||||||
src/linalg.cc \
|
src/linalg.cc \
|
||||||
src/Camera.cc \
|
src/Camera.cc \
|
||||||
src/handle_dep.cc \
|
src/handle_dep.cc \
|
||||||
|
|
@ -366,14 +348,16 @@ SOURCES += src/version_check.cc \
|
||||||
src/context.cc \
|
src/context.cc \
|
||||||
src/modcontext.cc \
|
src/modcontext.cc \
|
||||||
src/evalcontext.cc \
|
src/evalcontext.cc \
|
||||||
src/csgterm.cc \
|
src/csgnode.cc \
|
||||||
src/csgtermnormalizer.cc \
|
src/CSGTreeNormalizer.cc \
|
||||||
|
src/CSGTreeEvaluator.cc \
|
||||||
src/Geometry.cc \
|
src/Geometry.cc \
|
||||||
src/Polygon2d.cc \
|
src/Polygon2d.cc \
|
||||||
src/clipper-utils.cc \
|
src/clipper-utils.cc \
|
||||||
src/polyset-utils.cc \
|
src/polyset-utils.cc \
|
||||||
src/GeometryUtils.cc \
|
src/GeometryUtils.cc \
|
||||||
src/polyset.cc \
|
src/polyset.cc \
|
||||||
|
src/polyset-gl.cc \
|
||||||
src/csgops.cc \
|
src/csgops.cc \
|
||||||
src/transform.cc \
|
src/transform.cc \
|
||||||
src/color.cc \
|
src/color.cc \
|
||||||
|
|
@ -419,15 +403,21 @@ SOURCES += src/version_check.cc \
|
||||||
src/AutoUpdater.cc \
|
src/AutoUpdater.cc \
|
||||||
\
|
\
|
||||||
src/grid.cc \
|
src/grid.cc \
|
||||||
|
src/hash.cc \
|
||||||
src/builtin.cc \
|
src/builtin.cc \
|
||||||
src/calc.cc \
|
src/calc.cc \
|
||||||
src/export.cc \
|
src/export.cc \
|
||||||
|
src/export_stl.cc \
|
||||||
|
src/export_amf.cc \
|
||||||
|
src/export_off.cc \
|
||||||
|
src/export_dxf.cc \
|
||||||
|
src/export_svg.cc \
|
||||||
|
src/export_nef.cc \
|
||||||
src/export_png.cc \
|
src/export_png.cc \
|
||||||
src/import.cc \
|
src/import.cc \
|
||||||
src/renderer.cc \
|
src/renderer.cc \
|
||||||
src/colormap.cc \
|
src/colormap.cc \
|
||||||
src/ThrownTogetherRenderer.cc \
|
src/ThrownTogetherRenderer.cc \
|
||||||
src/CSGTermEvaluator.cc \
|
|
||||||
src/svg.cc \
|
src/svg.cc \
|
||||||
src/OffscreenView.cc \
|
src/OffscreenView.cc \
|
||||||
src/fbo.cc \
|
src/fbo.cc \
|
||||||
|
|
@ -437,6 +427,8 @@ SOURCES += src/version_check.cc \
|
||||||
\
|
\
|
||||||
src/openscad.cc \
|
src/openscad.cc \
|
||||||
src/mainwin.cc \
|
src/mainwin.cc \
|
||||||
|
src/OpenSCADApp.cc \
|
||||||
|
src/WindowManager.cc \
|
||||||
src/UIUtils.cc \
|
src/UIUtils.cc \
|
||||||
src/Dock.cc \
|
src/Dock.cc \
|
||||||
src/FontListDialog.cc \
|
src/FontListDialog.cc \
|
||||||
|
|
@ -499,6 +491,8 @@ HEADERS += src/cgal.h \
|
||||||
src/Polygon2d-CGAL.h
|
src/Polygon2d-CGAL.h
|
||||||
|
|
||||||
SOURCES += src/cgalutils.cc \
|
SOURCES += src/cgalutils.cc \
|
||||||
|
src/cgalutils-applyops.cc \
|
||||||
|
src/cgalutils-project.cc \
|
||||||
src/cgalutils-tess.cc \
|
src/cgalutils-tess.cc \
|
||||||
src/cgalutils-polyhedron.cc \
|
src/cgalutils-polyhedron.cc \
|
||||||
src/CGALCache.cc \
|
src/CGALCache.cc \
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
<file>icons/prefs3DView.png</file>
|
<file>icons/prefs3DView.png</file>
|
||||||
<file>icons/prefsEditor.png</file>
|
<file>icons/prefsEditor.png</file>
|
||||||
<file>icons/prefsUpdate.png</file>
|
<file>icons/prefsUpdate.png</file>
|
||||||
<file>icons/flattr.png</file>
|
|
||||||
<file>src/AboutDialog.html</file>
|
<file>src/AboutDialog.html</file>
|
||||||
<file>images/export.png</file>
|
<file>images/export.png</file>
|
||||||
<file>images/axes.png</file>
|
<file>images/axes.png</file>
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,11 @@
|
||||||
gluTessCallback(tess_, GLenum(GLU_TESS_BEGIN),
|
gluTessCallback(tess_, GLenum(GLU_TESS_BEGIN),
|
||||||
(GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &beginCallback);
|
(GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &beginCallback);
|
||||||
gluTessCallback(tess_, GLenum(GLU_TESS_END),
|
gluTessCallback(tess_, GLenum(GLU_TESS_END),
|
||||||
|
@@ -410,6 +429,7 @@
|
||||||
|
gluTessEndPolygon(tess_);
|
||||||
|
// CGAL_NEF_TRACEN("End Polygon");
|
||||||
|
gluDeleteTess(tess_);
|
||||||
|
+ combineCallback(NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void construct_axes() const
|
||||||
|
|
|
||||||
23
patches/qt5/QTBUG-46846.patch
Normal file
23
patches/qt5/QTBUG-46846.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
|
||||||
|
index 83e94c4..80957e6 100644
|
||||||
|
--- a/src/widgets/widgets/qlabel.cpp
|
||||||
|
+++ b/src/widgets/widgets/qlabel.cpp
|
||||||
|
@@ -1076,14 +1076,16 @@ void QLabel::paintEvent(QPaintEvent *)
|
||||||
|
if (d->pixmap && !d->pixmap->isNull()) {
|
||||||
|
QPixmap pix;
|
||||||
|
if (d->scaledcontents) {
|
||||||
|
- if (!d->scaledpixmap || d->scaledpixmap->size() != cr.size()) {
|
||||||
|
+ QSize scaledSize = cr.size() * devicePixelRatio();
|
||||||
|
+ if (!d->scaledpixmap || d->scaledpixmap->size() != scaledSize) {
|
||||||
|
if (!d->cachedimage)
|
||||||
|
d->cachedimage = new QImage(d->pixmap->toImage());
|
||||||
|
delete d->scaledpixmap;
|
||||||
|
QImage scaledImage =
|
||||||
|
- d->cachedimage->scaled(cr.size() * devicePixelRatio(),
|
||||||
|
+ d->cachedimage->scaled(scaledSize,
|
||||||
|
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
|
d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage));
|
||||||
|
+ d->scaledpixmap->setDevicePixelRatio(devicePixelRatio());
|
||||||
|
}
|
||||||
|
pix = *d->scaledpixmap;
|
||||||
|
} else
|
||||||
|
|
@ -10,6 +10,16 @@ INCLUDEPATH += $$[QT_INSTALL_HEADERS]
|
||||||
|
|
||||||
LIBS += -L$$[QT_INSTALL_LIBS]
|
LIBS += -L$$[QT_INSTALL_LIBS]
|
||||||
|
|
||||||
|
QT5LIB=qt5scintilla2
|
||||||
|
|
||||||
|
unix:linux* {
|
||||||
|
FEDORA32LIBS=/usr/lib/libqscintilla2-qt5.so
|
||||||
|
FEDORA64LIBS=/usr/lib64/libqscintilla2-qt5.so
|
||||||
|
exists($$FEDORA32LIBS) | exists($$FEDORA64LIBS) {
|
||||||
|
QT5LIB=qscintilla2-qt5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
mac: {
|
mac: {
|
||||||
#LIBS += -lqscintilla2_debug
|
#LIBS += -lqscintilla2_debug
|
||||||
|
|
@ -19,7 +29,8 @@ CONFIG(debug, debug|release) {
|
||||||
LIBS += -lqscintilla2d
|
LIBS += -lqscintilla2d
|
||||||
} else {
|
} else {
|
||||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||||
LIBS += -lqt5scintilla2
|
message("Using $$QT5LIB as library name")
|
||||||
|
LIBS += -l$$QT5LIB
|
||||||
} else {
|
} else {
|
||||||
LIBS += -lqscintilla2
|
LIBS += -lqscintilla2
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +44,8 @@ CONFIG(debug, debug|release) {
|
||||||
LIBS += -lqscintilla2
|
LIBS += -lqscintilla2
|
||||||
} else {
|
} else {
|
||||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||||
LIBS += -lqt5scintilla2
|
message("Using $$QT5LIB as library name")
|
||||||
|
LIBS += -l$$QT5LIB
|
||||||
} else {
|
} else {
|
||||||
LIBS += -lqscintilla2
|
LIBS += -lqscintilla2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,43 @@
|
||||||
|
## 2015.03-3
|
||||||
|
|
||||||
|
**OS X only: Auto-update vulnerability fix**
|
||||||
|
|
||||||
|
## 2015.03-2
|
||||||
|
|
||||||
|
**Bugfixes**
|
||||||
|
* \#1483 - Fix Z-fighting in Ortho view
|
||||||
|
* \#1479 - No check for infinite $fn
|
||||||
|
* \#1472 - "nan" in list comprehension causes crash
|
||||||
|
* \#452 - rands() fails when the seed is a floating point number
|
||||||
|
* \#1407 - Recursive module crash
|
||||||
|
* \#1425 - Animate Filename Generation - Duplicate/Missing Filenames
|
||||||
|
* \#1420 - expression-evaluation-tests fails on arm64
|
||||||
|
* \#1410 - Crash when a polygon contains NaN
|
||||||
|
* \#1378 - Linear extrude plus infinite twist causes crash instead of just an error
|
||||||
|
* \#1358 - Add more detailed installer information including version number
|
||||||
|
* \#1356 - Crash when multiplying matrices with undefined elements
|
||||||
|
* \#1350 - Saving file when HD is full ends up in data loss
|
||||||
|
* \#1342 - Syntax Highlighting Does Not Work on Linux Mint 17.1
|
||||||
|
* \#1337 - Simple detection of script and direction based on given text
|
||||||
|
* \#1325 - Crash when polygons with > 3 indices turn out to be degenerate
|
||||||
|
* \#1329 - version() returned ```[0,0,0]```
|
||||||
|
|
||||||
|
## 2015.03-1
|
||||||
|
|
||||||
|
**Bugfixes**
|
||||||
|
* \#1203 - Linux: Missing icons on Xfce
|
||||||
|
* \#1258 - Occasional crash when exporting STL
|
||||||
|
* \#1260 - Minimal window width too large
|
||||||
|
* \#1264 - Replace All sometimes caused a hang
|
||||||
|
* \#1274 - Fixed some preview bugs on Intel GPUs (OpenCSG 1.4.0)
|
||||||
|
* \#1276 - Module recursion sometimes caused a crash
|
||||||
|
* \#1277 - Automatic reload sometimes messed up camera position
|
||||||
|
* \#1284 - Animation flicker eliminated
|
||||||
|
* \#1294 - Support reproducible builds
|
||||||
|
* \#1317 - Normals vectors in STL were sometimes 0 0 0
|
||||||
|
|
||||||
|
## 2015.03
|
||||||
|
|
||||||
**Language Features:**
|
**Language Features:**
|
||||||
* Added text() module for 2D text
|
* Added text() module for 2D text
|
||||||
* Added offset() module for 2D offsets
|
* Added offset() module for 2D offsets
|
||||||
|
|
|
||||||
8
releases/2016.XX.md
Normal file
8
releases/2016.XX.md
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
**Language Features:**
|
||||||
|
* Added angle parameter to rotate_extrude()
|
||||||
|
|
||||||
|
**Program Features:**
|
||||||
|
|
||||||
|
**Bugfixes/improvements:**
|
||||||
|
|
||||||
|
**Deprecations:**
|
||||||
|
|
@ -4,15 +4,37 @@ scintilla {
|
||||||
|
|
||||||
DEFINES += USE_SCINTILLA_EDITOR
|
DEFINES += USE_SCINTILLA_EDITOR
|
||||||
|
|
||||||
|
QSCILOADED =
|
||||||
|
OPENSCAD_LIBDIR = $$(OPENSCAD_LIBRARIES)
|
||||||
|
|
||||||
|
!isEmpty(OPENSCAD_LIBDIR) {
|
||||||
|
exists($$OPENSCAD_LIBDIR) {
|
||||||
|
exists($$OPENSCAD_LIBDIR/lib/x86_64-linux-gnu/qt5/mkspecs/features/qscintilla2.prf) {
|
||||||
|
include($$OPENSCAD_LIBDIR/lib/x86_64-linux-gnu/qt5/mkspecs/features/qscintilla2.prf)
|
||||||
|
INCLUDEPATH = $$OPENSCAD_LIBDIR/include/qt5 $$INCLUDEPATH
|
||||||
|
LIBS = -L$$OPENSCAD_LIBDIR/lib/x86_64-linux-gnu $$LIBS
|
||||||
|
QSCILOADED=yes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# The qscintilla2.prf which ships with QScintilla is broken for Mac/Windows
|
# The qscintilla2.prf which ships with QScintilla is broken for Mac/Windows
|
||||||
# debug builds, so we supply our own
|
# debug builds, so we supply our own
|
||||||
|
isEmpty(QSCILOADED) {
|
||||||
win32|macx: {
|
win32|macx: {
|
||||||
include(qscintilla2.prf)
|
include(qscintilla2.prf)
|
||||||
|
QSCILOADED=yes
|
||||||
}
|
}
|
||||||
else: {
|
}
|
||||||
|
|
||||||
|
isEmpty(QSCILOADED) {
|
||||||
load(qscintilla2) {
|
load(qscintilla2) {
|
||||||
|
QSCILOADED=yes
|
||||||
# All good, found installed *.prf file.
|
# All good, found installed *.prf file.
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isEmpty(QSCILOADED) {
|
||||||
# Older scintilla libs (e.g. 2.7.2 on fedora20) do not provide the
|
# Older scintilla libs (e.g. 2.7.2 on fedora20) do not provide the
|
||||||
# prf file.
|
# prf file.
|
||||||
#
|
#
|
||||||
|
|
@ -21,6 +43,7 @@ scintilla {
|
||||||
#
|
#
|
||||||
message("Using local copy of qscintilla2.prf instead.")
|
message("Using local copy of qscintilla2.prf instead.")
|
||||||
include(qscintilla2.prf)
|
include(qscintilla2.prf)
|
||||||
|
QSCILOADED=yes
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,17 @@ check_nsis()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_zip()
|
||||||
|
if [ ! "`command -v zip`" ]; then
|
||||||
|
echo the zip command was not found. please install zip
|
||||||
|
echo on debian, sudo apt-get install zip
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo zip found.
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
get_openscad_source_code()
|
get_openscad_source_code()
|
||||||
{
|
{
|
||||||
if [ -d openscad ]; then
|
if [ -d openscad ]; then
|
||||||
|
|
@ -251,7 +262,7 @@ upload_win32()
|
||||||
SUMMARY1="Windows x86-32 Snapshot Installer"
|
SUMMARY1="Windows x86-32 Snapshot Installer"
|
||||||
SUMMARY2="Windows x86-32 Snapshot Zipfile"
|
SUMMARY2="Windows x86-32 Snapshot Zipfile"
|
||||||
SUMMARY3="Windows x86-32 Snapshot Tests"
|
SUMMARY3="Windows x86-32 Snapshot Tests"
|
||||||
BASEDIR=./mingw32/
|
BASEDIR=./mingw32.static/
|
||||||
WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32-Installer.exe
|
WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32-Installer.exe
|
||||||
WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32.zip
|
WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32.zip
|
||||||
WIN32_PACKAGEFILE3=OpenSCAD-Tests-$DATECODE-x86-32.zip
|
WIN32_PACKAGEFILE3=OpenSCAD-Tests-$DATECODE-x86-32.zip
|
||||||
|
|
@ -277,7 +288,7 @@ upload_win64()
|
||||||
SUMMARY1="Windows x86-64 Snapshot Zipfile"
|
SUMMARY1="Windows x86-64 Snapshot Zipfile"
|
||||||
SUMMARY2="Windows x86-64 Snapshot Installer"
|
SUMMARY2="Windows x86-64 Snapshot Installer"
|
||||||
SUMMARY3="Windows x86-64 Snapshot Tests"
|
SUMMARY3="Windows x86-64 Snapshot Tests"
|
||||||
BASEDIR=./mingw64/
|
BASEDIR=./mingw64.static/
|
||||||
WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64-Installer.exe
|
WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64-Installer.exe
|
||||||
WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64.zip
|
WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64.zip
|
||||||
WIN64_PACKAGEFILE3=OpenSCAD-Tests-$DATECODE-x86-64.zip
|
WIN64_PACKAGEFILE3=OpenSCAD-Tests-$DATECODE-x86-64.zip
|
||||||
|
|
@ -409,6 +420,7 @@ main()
|
||||||
fi
|
fi
|
||||||
check_starting_path
|
check_starting_path
|
||||||
check_nsis
|
check_nsis
|
||||||
|
check_zip
|
||||||
read_username_from_user
|
read_username_from_user
|
||||||
read_password_from_user
|
read_password_from_user
|
||||||
get_openscad_source_code
|
get_openscad_source_code
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,21 @@
|
||||||
EXAMPLES := ../../examples
|
EXAMPLES := ../../examples
|
||||||
|
LOG := out.log
|
||||||
SRC=$(wildcard $(EXAMPLES)/*/*.scad)
|
SRC=$(wildcard $(EXAMPLES)/*/*.scad)
|
||||||
PNG=$(patsubst $(EXAMPLES)/%.scad,html/%.png,$(SRC))
|
PNG=$(patsubst $(EXAMPLES)/%.scad,html/%.png,$(SRC))
|
||||||
HTML=$(patsubst $(EXAMPLES)/%.scad,html/%.html,$(SRC))
|
HTML=$(patsubst $(EXAMPLES)/%.scad,html/%.html,$(SRC))
|
||||||
|
|
||||||
OPENSCAD := ../../OpenSCAD.app/Contents/MacOS/OpenSCAD
|
OPENSCAD := $(shell ls ../../openscad ../../OpenSCAD.app/Contents/MacOS/OpenSCAD 2>/dev/null | head -n 1)
|
||||||
#OPENSCAD := openscad
|
|
||||||
ARGS := --imgsize=1200,900 --camera=0,0,0,55,0,25,180 --viewall --autocenter
|
ARGS := --imgsize=1200,900 --camera=0,0,0,55,0,25,180 --viewall --autocenter
|
||||||
|
|
||||||
all : $(PNG) $(HTML) example-data.js assets
|
all : info $(PNG) $(HTML) example-data.js assets
|
||||||
|
|
||||||
|
.PHONY: info
|
||||||
|
info:
|
||||||
|
@echo Using $(OPENSCAD)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean :
|
clean :
|
||||||
rm -rf html
|
rm -rf html $(LOG)
|
||||||
|
|
||||||
.PHONY: assets
|
.PHONY: assets
|
||||||
assets :
|
assets :
|
||||||
|
|
@ -21,7 +25,7 @@ assets :
|
||||||
example-data.js :
|
example-data.js :
|
||||||
( \
|
( \
|
||||||
echo "openscad_examples = ["; \
|
echo "openscad_examples = ["; \
|
||||||
for a in Basics Functions Shapes Extrusion Advanced; \
|
for a in `grep '\[' ../../examples/examples.json | tr -d ' \t":[]'`; \
|
||||||
do \
|
do \
|
||||||
echo " {"; \
|
echo " {"; \
|
||||||
echo " name : \"$$a\","; \
|
echo " name : \"$$a\","; \
|
||||||
|
|
@ -38,7 +42,7 @@ example-data.js :
|
||||||
|
|
||||||
html/%.png : $(EXAMPLES)/%.scad
|
html/%.png : $(EXAMPLES)/%.scad
|
||||||
mkdir -p `dirname $@`
|
mkdir -p `dirname $@`
|
||||||
$(OPENSCAD) $(ARGS) -o $@ $< > out.log 2>&1
|
$(OPENSCAD) $(ARGS) -o $@ $< > $(LOG) 2>&1
|
||||||
|
|
||||||
html/%.html : $(EXAMPLES)/%.scad template-pre.html template-post.html
|
html/%.html : $(EXAMPLES)/%.scad template-pre.html template-post.html
|
||||||
#echo $(notdir $(patsubst %.scad,%.png,$<))
|
#echo $(notdir $(patsubst %.scad,%.png,$<))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
.rainbow {
|
||||||
|
border-spacing: 0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
.rainbow .line:hover {
|
||||||
|
background-color: #eee8d5;
|
||||||
|
}
|
||||||
|
.rainbow .line .line-number {
|
||||||
|
text-align: right;
|
||||||
|
background-color: #eee8d5;
|
||||||
|
padding-left: 0.8em;
|
||||||
|
padding-right: 0.8em;
|
||||||
|
}
|
||||||
|
.rainbow .line .line-number:before {
|
||||||
|
content: attr(data-line-number);
|
||||||
|
}
|
||||||
|
.rainbow .line .line-code {
|
||||||
|
padding-left: 1em;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
14
scripts/examples-html/assets/js/README
Normal file
14
scripts/examples-html/assets/js/README
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
JavaScript Libraries:
|
||||||
|
|
||||||
|
Rainbow by Craig Campbell
|
||||||
|
* https://github.com/ccampbell/rainbow
|
||||||
|
* Apache License, Version 2.0
|
||||||
|
|
||||||
|
Rainbow.linenumbers.js by Blender3D
|
||||||
|
* https://github.com/Blender3D/rainbow.linenumbers.js
|
||||||
|
* Apache License, Version 2.0
|
||||||
|
|
||||||
|
Dropdown Menu by Oliver Gast
|
||||||
|
* http://www.olivergast.de/blog/2012/04/18/css3-dropdown-menu/
|
||||||
|
* (update in http://www.olivergast.de/blog/2015/05/12/css-ein-horizontales-dropdown-menue-reloaded/)
|
||||||
|
* No specific license, download states "download for free usage"
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
* Generic language patterns
|
* Generic language patterns
|
||||||
*
|
*
|
||||||
* @author Craig Campbell
|
* @author Craig Campbell
|
||||||
* @version 1.0.11
|
* @version 1.0.13
|
||||||
*/
|
*/
|
||||||
Rainbow.extend([
|
Rainbow.extend([
|
||||||
{
|
{
|
||||||
|
|
@ -25,7 +25,7 @@ Rainbow.extend([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'pattern': /(\(|\s|\[|\=|:|\+|\.)(('|")([^\\\1]|\\.)*?(\3))/gm
|
'pattern': /(\(|\s|\[|\=|:|\+|\.|\{)(('|")([^\\\1]|\\.)*?(\3))/gm
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'comment',
|
'name': 'comment',
|
||||||
|
|
|
||||||
798
scripts/examples-html/assets/js/rainbow.js
Normal file
798
scripts/examples-html/assets/js/rainbow.js
Normal file
|
|
@ -0,0 +1,798 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2013 Craig Campbell
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* Rainbow is a simple code syntax highlighter
|
||||||
|
*
|
||||||
|
* @preserve @version 1.2
|
||||||
|
* @url rainbowco.de
|
||||||
|
*/
|
||||||
|
window['Rainbow'] = (function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* array of replacements to process at the end
|
||||||
|
*
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
var replacements = {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* an array of start and end positions of blocks to be replaced
|
||||||
|
*
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
replacement_positions = {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* an array of the language patterns specified for each language
|
||||||
|
*
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
language_patterns = {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* an array of languages and whether they should bypass the default patterns
|
||||||
|
*
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
bypass_defaults = {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* processing level
|
||||||
|
*
|
||||||
|
* replacements are stored at this level so if there is a sub block of code
|
||||||
|
* (for example php inside of html) it runs at a different level
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
CURRENT_LEVEL = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constant used to refer to the default language
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
DEFAULT_LANGUAGE = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used as counters so we can selectively call setTimeout
|
||||||
|
* after processing a certain number of matches/replacements
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
match_counter = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
replacement_counter = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {null|string}
|
||||||
|
*/
|
||||||
|
global_class,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {null|Function}
|
||||||
|
*/
|
||||||
|
onHighlight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cross browser get attribute for an element
|
||||||
|
*
|
||||||
|
* @see http://stackoverflow.com/questions/3755227/cross-browser-javascript-getattribute-method
|
||||||
|
*
|
||||||
|
* @param {Node} el
|
||||||
|
* @param {string} attr attribute you are trying to get
|
||||||
|
* @returns {string|number}
|
||||||
|
*/
|
||||||
|
function _attr(el, attr, attrs, i) {
|
||||||
|
var result = (el.getAttribute && el.getAttribute(attr)) || 0;
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
attrs = el.attributes;
|
||||||
|
|
||||||
|
for (i = 0; i < attrs.length; ++i) {
|
||||||
|
if (attrs[i].nodeName === attr) {
|
||||||
|
return attrs[i].nodeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds a class to a given code block
|
||||||
|
*
|
||||||
|
* @param {Element} el
|
||||||
|
* @param {string} class_name class name to add
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function _addClass(el, class_name) {
|
||||||
|
el.className += el.className ? ' ' + class_name : class_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if a block has a given class
|
||||||
|
*
|
||||||
|
* @param {Element} el
|
||||||
|
* @param {string} class_name class name to check for
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
function _hasClass(el, class_name) {
|
||||||
|
return (' ' + el.className + ' ').indexOf(' ' + class_name + ' ') > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the language for this block of code
|
||||||
|
*
|
||||||
|
* @param {Element} block
|
||||||
|
* @returns {string|null}
|
||||||
|
*/
|
||||||
|
function _getLanguageForBlock(block) {
|
||||||
|
|
||||||
|
// if this doesn't have a language but the parent does then use that
|
||||||
|
// this means if for example you have: <pre data-language="php">
|
||||||
|
// with a bunch of <code> blocks inside then you do not have
|
||||||
|
// to specify the language for each block
|
||||||
|
var language = _attr(block, 'data-language') || _attr(block.parentNode, 'data-language');
|
||||||
|
|
||||||
|
// this adds support for specifying language via a css class
|
||||||
|
// you can use the Google Code Prettify style: <pre class="lang-php">
|
||||||
|
// or the HTML5 style: <pre><code class="language-php">
|
||||||
|
if (!language) {
|
||||||
|
var pattern = /\blang(?:uage)?-(\w+)/,
|
||||||
|
match = block.className.match(pattern) || block.parentNode.className.match(pattern);
|
||||||
|
|
||||||
|
if (match) {
|
||||||
|
language = match[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* makes sure html entities are always used for tags
|
||||||
|
*
|
||||||
|
* @param {string} code
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function _htmlEntities(code) {
|
||||||
|
return code.replace(/</g, '<').replace(/>/g, '>').replace(/&(?![\w\#]+;)/g, '&');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* determines if a new match intersects with an existing one
|
||||||
|
*
|
||||||
|
* @param {number} start1 start position of existing match
|
||||||
|
* @param {number} end1 end position of existing match
|
||||||
|
* @param {number} start2 start position of new match
|
||||||
|
* @param {number} end2 end position of new match
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
function _intersects(start1, end1, start2, end2) {
|
||||||
|
if (start2 >= start1 && start2 < end1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return end2 > start1 && end2 < end1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* determines if two different matches have complete overlap with each other
|
||||||
|
*
|
||||||
|
* @param {number} start1 start position of existing match
|
||||||
|
* @param {number} end1 end position of existing match
|
||||||
|
* @param {number} start2 start position of new match
|
||||||
|
* @param {number} end2 end position of new match
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
function _hasCompleteOverlap(start1, end1, start2, end2) {
|
||||||
|
|
||||||
|
// if the starting and end positions are exactly the same
|
||||||
|
// then the first one should stay and this one should be ignored
|
||||||
|
if (start2 == start1 && end2 == end1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return start2 <= start1 && end2 >= end1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* determines if the match passed in falls inside of an existing match
|
||||||
|
* this prevents a regex pattern from matching inside of a bigger pattern
|
||||||
|
*
|
||||||
|
* @param {number} start - start position of new match
|
||||||
|
* @param {number} end - end position of new match
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
function _matchIsInsideOtherMatch(start, end) {
|
||||||
|
for (var key in replacement_positions[CURRENT_LEVEL]) {
|
||||||
|
key = parseInt(key, 10);
|
||||||
|
|
||||||
|
// if this block completely overlaps with another block
|
||||||
|
// then we should remove the other block and return false
|
||||||
|
if (_hasCompleteOverlap(key, replacement_positions[CURRENT_LEVEL][key], start, end)) {
|
||||||
|
delete replacement_positions[CURRENT_LEVEL][key];
|
||||||
|
delete replacements[CURRENT_LEVEL][key];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_intersects(key, replacement_positions[CURRENT_LEVEL][key], start, end)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* takes a string of code and wraps it in a span tag based on the name
|
||||||
|
*
|
||||||
|
* @param {string} name name of the pattern (ie keyword.regex)
|
||||||
|
* @param {string} code block of code to wrap
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function _wrapCodeInSpan(name, code) {
|
||||||
|
return '<span class="' + name.replace(/\./g, ' ') + (global_class ? ' ' + global_class : '') + '">' + code + '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* finds out the position of group match for a regular expression
|
||||||
|
*
|
||||||
|
* @see http://stackoverflow.com/questions/1985594/how-to-find-index-of-groups-in-match
|
||||||
|
*
|
||||||
|
* @param {Object} match
|
||||||
|
* @param {number} group_number
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
function _indexOfGroup(match, group_number) {
|
||||||
|
var index = 0,
|
||||||
|
i;
|
||||||
|
|
||||||
|
for (i = 1; i < group_number; ++i) {
|
||||||
|
if (match[i]) {
|
||||||
|
index += match[i].length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* matches a regex pattern against a block of code
|
||||||
|
* finds all matches that should be processed and stores the positions
|
||||||
|
* of where they should be replaced within the string
|
||||||
|
*
|
||||||
|
* this is where pretty much all the work is done but it should not
|
||||||
|
* be called directly
|
||||||
|
*
|
||||||
|
* @param {RegExp} pattern
|
||||||
|
* @param {string} code
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function _processPattern(regex, pattern, code, callback)
|
||||||
|
{
|
||||||
|
if (typeof regex === "undefined" || regex === null) {
|
||||||
|
//console.warn("undefined regular expression")
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
var match = regex.exec(code);
|
||||||
|
|
||||||
|
if (!match) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
++match_counter;
|
||||||
|
|
||||||
|
// treat match 0 the same way as name
|
||||||
|
if (!pattern['name'] && typeof pattern['matches'][0] == 'string') {
|
||||||
|
pattern['name'] = pattern['matches'][0];
|
||||||
|
delete pattern['matches'][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
var replacement = match[0],
|
||||||
|
start_pos = match.index,
|
||||||
|
end_pos = match[0].length + start_pos,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* callback to process the next match of this pattern
|
||||||
|
*/
|
||||||
|
processNext = function() {
|
||||||
|
var nextCall = function() {
|
||||||
|
_processPattern(regex, pattern, code, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
// every 100 items we process let's call set timeout
|
||||||
|
// to let the ui breathe a little
|
||||||
|
return match_counter % 100 > 0 ? nextCall() : setTimeout(nextCall, 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
// if this is not a child match and it falls inside of another
|
||||||
|
// match that already happened we should skip it and continue processing
|
||||||
|
if (_matchIsInsideOtherMatch(start_pos, end_pos)) {
|
||||||
|
return processNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* callback for when a match was successfully processed
|
||||||
|
*
|
||||||
|
* @param {string} replacement
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
var onMatchSuccess = function(replacement) {
|
||||||
|
// if this match has a name then wrap it in a span tag
|
||||||
|
if (pattern['name']) {
|
||||||
|
replacement = _wrapCodeInSpan(pattern['name'], replacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('LEVEL', CURRENT_LEVEL, 'replace', match[0], 'with', replacement, 'at position', start_pos, 'to', end_pos);
|
||||||
|
|
||||||
|
// store what needs to be replaced with what at this position
|
||||||
|
if (!replacements[CURRENT_LEVEL]) {
|
||||||
|
replacements[CURRENT_LEVEL] = {};
|
||||||
|
replacement_positions[CURRENT_LEVEL] = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
replacements[CURRENT_LEVEL][start_pos] = {
|
||||||
|
'replace': match[0],
|
||||||
|
'with': replacement
|
||||||
|
};
|
||||||
|
|
||||||
|
// store the range of this match so we can use it for comparisons
|
||||||
|
// with other matches later
|
||||||
|
replacement_positions[CURRENT_LEVEL][start_pos] = end_pos;
|
||||||
|
|
||||||
|
// process the next match
|
||||||
|
processNext();
|
||||||
|
},
|
||||||
|
|
||||||
|
// if this pattern has sub matches for different groups in the regex
|
||||||
|
// then we should process them one at a time by rerunning them through
|
||||||
|
// this function to generate the new replacement
|
||||||
|
//
|
||||||
|
// we run through them backwards because the match position of earlier
|
||||||
|
// matches will not change depending on what gets replaced in later
|
||||||
|
// matches
|
||||||
|
group_keys = keys(pattern['matches']),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* callback for processing a sub group
|
||||||
|
*
|
||||||
|
* @param {number} i
|
||||||
|
* @param {Array} group_keys
|
||||||
|
* @param {Function} callback
|
||||||
|
*/
|
||||||
|
processGroup = function(i, group_keys, callback) {
|
||||||
|
if (i >= group_keys.length) {
|
||||||
|
return callback(replacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
var processNextGroup = function() {
|
||||||
|
processGroup(++i, group_keys, callback);
|
||||||
|
},
|
||||||
|
block = match[group_keys[i]];
|
||||||
|
|
||||||
|
// if there is no match here then move on
|
||||||
|
if (!block) {
|
||||||
|
return processNextGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
var group = pattern['matches'][group_keys[i]],
|
||||||
|
language = group['language'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* process group is what group we should use to actually process
|
||||||
|
* this match group
|
||||||
|
*
|
||||||
|
* for example if the subgroup pattern looks like this
|
||||||
|
* 2: {
|
||||||
|
* 'name': 'keyword',
|
||||||
|
* 'pattern': /true/g
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* then we use that as is, but if it looks like this
|
||||||
|
*
|
||||||
|
* 2: {
|
||||||
|
* 'name': 'keyword',
|
||||||
|
* 'matches': {
|
||||||
|
* 'name': 'special',
|
||||||
|
* 'pattern': /whatever/g
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* we treat the 'matches' part as the pattern and keep
|
||||||
|
* the name around to wrap it with later
|
||||||
|
*/
|
||||||
|
process_group = group['name'] && group['matches'] ? group['matches'] : group,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* takes the code block matched at this group, replaces it
|
||||||
|
* with the highlighted block, and optionally wraps it with
|
||||||
|
* a span with a name
|
||||||
|
*
|
||||||
|
* @param {string} block
|
||||||
|
* @param {string} replace_block
|
||||||
|
* @param {string|null} match_name
|
||||||
|
*/
|
||||||
|
_replaceAndContinue = function(block, replace_block, match_name) {
|
||||||
|
replacement = _replaceAtPosition(_indexOfGroup(match, group_keys[i]), block, match_name ? _wrapCodeInSpan(match_name, replace_block) : replace_block, replacement);
|
||||||
|
processNextGroup();
|
||||||
|
};
|
||||||
|
|
||||||
|
// if this is a sublanguage go and process the block using that language
|
||||||
|
if (language) {
|
||||||
|
return _highlightBlockForLanguage(block, language, function(code) {
|
||||||
|
_replaceAndContinue(block, code);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// if this is a string then this match is directly mapped to selector
|
||||||
|
// so all we have to do is wrap it in a span and continue
|
||||||
|
if (typeof group === 'string') {
|
||||||
|
return _replaceAndContinue(block, block, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the process group can be a single pattern or an array of patterns
|
||||||
|
// _processCodeWithPatterns always expects an array so we convert it here
|
||||||
|
_processCodeWithPatterns(block, process_group.length ? process_group : [process_group], function(code) {
|
||||||
|
_replaceAndContinue(block, code, group['matches'] ? group['name'] : 0);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
processGroup(0, group_keys, onMatchSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* should a language bypass the default patterns?
|
||||||
|
*
|
||||||
|
* if you call Rainbow.extend() and pass true as the third argument
|
||||||
|
* it will bypass the defaults
|
||||||
|
*/
|
||||||
|
function _bypassDefaultPatterns(language)
|
||||||
|
{
|
||||||
|
return bypass_defaults[language];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns a list of regex patterns for this language
|
||||||
|
*
|
||||||
|
* @param {string} language
|
||||||
|
* @returns {Array}
|
||||||
|
*/
|
||||||
|
function _getPatternsForLanguage(language) {
|
||||||
|
var patterns = language_patterns[language] || [],
|
||||||
|
default_patterns = language_patterns[DEFAULT_LANGUAGE] || [];
|
||||||
|
|
||||||
|
return _bypassDefaultPatterns(language) ? patterns : patterns.concat(default_patterns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* substring replace call to replace part of a string at a certain position
|
||||||
|
*
|
||||||
|
* @param {number} position the position where the replacement should happen
|
||||||
|
* @param {string} replace the text we want to replace
|
||||||
|
* @param {string} replace_with the text we want to replace it with
|
||||||
|
* @param {string} code the code we are doing the replacing in
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function _replaceAtPosition(position, replace, replace_with, code) {
|
||||||
|
var sub_string = code.substr(position);
|
||||||
|
return code.substr(0, position) + sub_string.replace(replace, replace_with);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sorts an object by index descending
|
||||||
|
*
|
||||||
|
* @param {Object} object
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
function keys(object) {
|
||||||
|
var locations = [],
|
||||||
|
replacement,
|
||||||
|
pos;
|
||||||
|
|
||||||
|
for(var location in object) {
|
||||||
|
if (object.hasOwnProperty(location)) {
|
||||||
|
locations.push(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// numeric descending
|
||||||
|
return locations.sort(function(a, b) {
|
||||||
|
return b - a;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* processes a block of code using specified patterns
|
||||||
|
*
|
||||||
|
* @param {string} code
|
||||||
|
* @param {Array} patterns
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function _processCodeWithPatterns(code, patterns, callback)
|
||||||
|
{
|
||||||
|
// we have to increase the level here so that the
|
||||||
|
// replacements will not conflict with each other when
|
||||||
|
// processing sub blocks of code
|
||||||
|
++CURRENT_LEVEL;
|
||||||
|
|
||||||
|
// patterns are processed one at a time through this function
|
||||||
|
function _workOnPatterns(patterns, i)
|
||||||
|
{
|
||||||
|
// still have patterns to process, keep going
|
||||||
|
if (i < patterns.length) {
|
||||||
|
return _processPattern(patterns[i]['pattern'], patterns[i], code, function() {
|
||||||
|
_workOnPatterns(patterns, ++i);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// we are done processing the patterns
|
||||||
|
// process the replacements and update the DOM
|
||||||
|
_processReplacements(code, function(code) {
|
||||||
|
|
||||||
|
// when we are done processing replacements
|
||||||
|
// we are done at this level so we can go back down
|
||||||
|
delete replacements[CURRENT_LEVEL];
|
||||||
|
delete replacement_positions[CURRENT_LEVEL];
|
||||||
|
--CURRENT_LEVEL;
|
||||||
|
callback(code);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_workOnPatterns(patterns, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* process replacements in the string of code to actually update the markup
|
||||||
|
*
|
||||||
|
* @param {string} code the code to process replacements in
|
||||||
|
* @param {Function} onComplete what to do when we are done processing
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function _processReplacements(code, onComplete) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* processes a single replacement
|
||||||
|
*
|
||||||
|
* @param {string} code
|
||||||
|
* @param {Array} positions
|
||||||
|
* @param {number} i
|
||||||
|
* @param {Function} onComplete
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function _processReplacement(code, positions, i, onComplete) {
|
||||||
|
if (i < positions.length) {
|
||||||
|
++replacement_counter;
|
||||||
|
var pos = positions[i],
|
||||||
|
replacement = replacements[CURRENT_LEVEL][pos];
|
||||||
|
code = _replaceAtPosition(pos, replacement['replace'], replacement['with'], code);
|
||||||
|
|
||||||
|
// process next function
|
||||||
|
var next = function() {
|
||||||
|
_processReplacement(code, positions, ++i, onComplete);
|
||||||
|
};
|
||||||
|
|
||||||
|
// use a timeout every 250 to not freeze up the UI
|
||||||
|
return replacement_counter % 250 > 0 ? next() : setTimeout(next, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
var string_positions = keys(replacements[CURRENT_LEVEL]);
|
||||||
|
_processReplacement(code, string_positions, 0, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* takes a string of code and highlights it according to the language specified
|
||||||
|
*
|
||||||
|
* @param {string} code
|
||||||
|
* @param {string} language
|
||||||
|
* @param {Function} onComplete
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function _highlightBlockForLanguage(code, language, onComplete) {
|
||||||
|
var patterns = _getPatternsForLanguage(language);
|
||||||
|
_processCodeWithPatterns(_htmlEntities(code), patterns, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* highlight an individual code block
|
||||||
|
*
|
||||||
|
* @param {Array} code_blocks
|
||||||
|
* @param {number} i
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function _highlightCodeBlock(code_blocks, i, onComplete) {
|
||||||
|
if (i < code_blocks.length) {
|
||||||
|
var block = code_blocks[i],
|
||||||
|
language = _getLanguageForBlock(block);
|
||||||
|
|
||||||
|
if (!_hasClass(block, 'rainbow') && language) {
|
||||||
|
language = language.toLowerCase();
|
||||||
|
|
||||||
|
_addClass(block, 'rainbow');
|
||||||
|
|
||||||
|
return _highlightBlockForLanguage(block.innerHTML, language, function(code) {
|
||||||
|
block.innerHTML = code;
|
||||||
|
|
||||||
|
// reset the replacement arrays
|
||||||
|
replacements = {};
|
||||||
|
replacement_positions = {};
|
||||||
|
|
||||||
|
// if you have a listener attached tell it that this block is now highlighted
|
||||||
|
if (onHighlight) {
|
||||||
|
onHighlight(block, language);
|
||||||
|
}
|
||||||
|
|
||||||
|
// process the next block
|
||||||
|
setTimeout(function() {
|
||||||
|
_highlightCodeBlock(code_blocks, ++i, onComplete);
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return _highlightCodeBlock(code_blocks, ++i, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onComplete) {
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* start highlighting all the code blocks
|
||||||
|
*
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function _highlight(node, onComplete) {
|
||||||
|
|
||||||
|
// the first argument can be an Event or a DOM Element
|
||||||
|
// I was originally checking instanceof Event but that makes it break
|
||||||
|
// when using mootools
|
||||||
|
//
|
||||||
|
// @see https://github.com/ccampbell/rainbow/issues/32
|
||||||
|
//
|
||||||
|
node = node && typeof node.getElementsByTagName == 'function' ? node : document;
|
||||||
|
|
||||||
|
var pre_blocks = node.getElementsByTagName('pre'),
|
||||||
|
code_blocks = node.getElementsByTagName('code'),
|
||||||
|
i,
|
||||||
|
final_pre_blocks = [],
|
||||||
|
final_code_blocks = [];
|
||||||
|
|
||||||
|
// first loop through all pre blocks to find which ones to highlight
|
||||||
|
// also strip whitespace
|
||||||
|
for (i = 0; i < pre_blocks.length; ++i) {
|
||||||
|
|
||||||
|
// strip whitespace around code tags when they are inside of a pre tag
|
||||||
|
// this makes the themes look better because you can't accidentally
|
||||||
|
// add extra linebreaks at the start and end
|
||||||
|
//
|
||||||
|
// when the pre tag contains a code tag then strip any extra whitespace
|
||||||
|
// for example
|
||||||
|
// <pre>
|
||||||
|
// <code>var foo = true;</code>
|
||||||
|
// </pre>
|
||||||
|
//
|
||||||
|
// will become
|
||||||
|
// <pre><code>var foo = true;</code></pre>
|
||||||
|
//
|
||||||
|
// if you want to preserve whitespace you can use a pre tag on its own
|
||||||
|
// without a code tag inside of it
|
||||||
|
if (pre_blocks[i].getElementsByTagName('code').length) {
|
||||||
|
pre_blocks[i].innerHTML = pre_blocks[i].innerHTML.replace(/^\s+/, '').replace(/\s+$/, '');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the pre block has no code blocks then we are going to want to
|
||||||
|
// process it directly
|
||||||
|
final_pre_blocks.push(pre_blocks[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @see http://stackoverflow.com/questions/2735067/how-to-convert-a-dom-node-list-to-an-array-in-javascript
|
||||||
|
// we are going to process all <code> blocks
|
||||||
|
for (i = 0; i < code_blocks.length; ++i) {
|
||||||
|
final_code_blocks.push(code_blocks[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
_highlightCodeBlock(final_code_blocks.concat(final_pre_blocks), 0, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* public methods
|
||||||
|
*/
|
||||||
|
return {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* extends the language pattern matches
|
||||||
|
*
|
||||||
|
* @param {*} language name of language
|
||||||
|
* @param {*} patterns array of patterns to add on
|
||||||
|
* @param {boolean|null} bypass if true this will bypass the default language patterns
|
||||||
|
*/
|
||||||
|
extend: function(language, patterns, bypass) {
|
||||||
|
|
||||||
|
// if there is only one argument then we assume that we want to
|
||||||
|
// extend the default language rules
|
||||||
|
if (arguments.length == 1) {
|
||||||
|
patterns = language;
|
||||||
|
language = DEFAULT_LANGUAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bypass_defaults[language] = bypass;
|
||||||
|
language_patterns[language] = patterns.concat(language_patterns[language] || []);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* call back to let you do stuff in your app after a piece of code has been highlighted
|
||||||
|
*
|
||||||
|
* @param {Function} callback
|
||||||
|
*/
|
||||||
|
onHighlight: function(callback) {
|
||||||
|
onHighlight = callback;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* method to set a global class that will be applied to all spans
|
||||||
|
*
|
||||||
|
* @param {string} class_name
|
||||||
|
*/
|
||||||
|
addClass: function(class_name) {
|
||||||
|
global_class = class_name;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* starts the magic rainbow
|
||||||
|
*
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
color: function() {
|
||||||
|
|
||||||
|
// if you want to straight up highlight a string you can pass the string of code,
|
||||||
|
// the language, and a callback function
|
||||||
|
if (typeof arguments[0] == 'string') {
|
||||||
|
return _highlightBlockForLanguage(arguments[0], arguments[1], arguments[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if you pass a callback function then we rerun the color function
|
||||||
|
// on all the code and call the callback function on complete
|
||||||
|
if (typeof arguments[0] == 'function') {
|
||||||
|
return _highlight(0, arguments[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise we use whatever node you passed in with an optional
|
||||||
|
// callback function as the second parameter
|
||||||
|
_highlight(arguments[0], arguments[1]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}) ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds event listener to start highlighting
|
||||||
|
*/
|
||||||
|
(function() {
|
||||||
|
if (document.addEventListener) {
|
||||||
|
return document.addEventListener('DOMContentLoaded', Rainbow.color, false);
|
||||||
|
}
|
||||||
|
window.attachEvent('onload', Rainbow.color);
|
||||||
|
}) ();
|
||||||
|
|
||||||
|
// When using Google closure compiler in advanced mode some methods
|
||||||
|
// get renamed. This keeps a public reference to these methods so they can
|
||||||
|
// still be referenced from outside this library.
|
||||||
|
Rainbow["onHighlight"] = Rainbow.onHighlight;
|
||||||
|
Rainbow["addClass"] = Rainbow.addClass;
|
||||||
118
scripts/examples-html/assets/js/rainbow.linenumbers.js
Normal file
118
scripts/examples-html/assets/js/rainbow.linenumbers.js
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
// Only install the plugin if Rainbow is present and has been loaded
|
||||||
|
if (window.Rainbow) window.Rainbow.linenumbers = (function(Rainbow) {
|
||||||
|
/**
|
||||||
|
* Splits up a single element into individual lines
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} elem
|
||||||
|
* @returns {Array}
|
||||||
|
*/
|
||||||
|
function splitElement(elem) {
|
||||||
|
if (elem.nodeType === 3) {
|
||||||
|
// Just split up the text node
|
||||||
|
return elem.nodeValue.split('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, we need to split up the HTML
|
||||||
|
var sourceLines = elem.innerHTML.split('\n');
|
||||||
|
var lines = [];
|
||||||
|
|
||||||
|
// Wraps each chunk in the parent element. For example:
|
||||||
|
// <b>foo\nbar</b> -> [<b>foo</b>, <b>bar</b>]
|
||||||
|
for (var i = 0; i < sourceLines.length; i++) {
|
||||||
|
// Handles <b>\nbar</b> -> [, <b>bar</b>]
|
||||||
|
if (sourceLines[i] === '') {
|
||||||
|
lines.push('');
|
||||||
|
} else {
|
||||||
|
var wrapper = elem.cloneNode(true);
|
||||||
|
wrapper.innerHTML = sourceLines[i];
|
||||||
|
|
||||||
|
var div = document.createElement('div');
|
||||||
|
div.appendChild(wrapper.cloneNode(true));
|
||||||
|
|
||||||
|
lines.push(div.innerHTML);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Splits up the element containing highlighted source code
|
||||||
|
* into an array of lines
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} block
|
||||||
|
* @returns {Array}
|
||||||
|
*/
|
||||||
|
function splitLines(block) {
|
||||||
|
var lines = [''];
|
||||||
|
|
||||||
|
for (var i = 0; i < block.childNodes.length; i++) {
|
||||||
|
var elemLines = splitElement(block.childNodes[i]);
|
||||||
|
|
||||||
|
// The first element in elemLines is
|
||||||
|
// a continuation of the previous line
|
||||||
|
lines[lines.length - 1] += elemLines[0];
|
||||||
|
|
||||||
|
// The remaining elements get their own lines
|
||||||
|
for (var j = 1; j < elemLines.length; j++) {
|
||||||
|
lines.push(elemLines[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the array of lines
|
||||||
|
return lines;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Callback is called when Rainbow has highlighted a block
|
||||||
|
Rainbow.onHighlight(function(block) {
|
||||||
|
// This addresses an issue when Rainbow.color() is called multiple times.
|
||||||
|
// Since code element is replaced with table element below,
|
||||||
|
// second pass of Rainbow.color() will result in block.parentNode being null.
|
||||||
|
if (!block || !block.parentNode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a table wrapper
|
||||||
|
var table = document.createElement('table');
|
||||||
|
table.className = 'rainbow';
|
||||||
|
table.setAttribute('data-language', block.getAttribute('data-language'));
|
||||||
|
|
||||||
|
// Split up the lines of the block
|
||||||
|
var lines = splitLines(block);
|
||||||
|
|
||||||
|
// For each line
|
||||||
|
for (var i = 0; i < lines.length; i++) {
|
||||||
|
var line = lines[i];
|
||||||
|
var index = i + 1;
|
||||||
|
|
||||||
|
// Create a row
|
||||||
|
var row = table.insertRow(-1);
|
||||||
|
row.className = 'line line-' + index;
|
||||||
|
|
||||||
|
// Create a cell which displays the line number with CSS
|
||||||
|
var lineNumber = row.insertCell(-1);
|
||||||
|
lineNumber.className = 'line-number';
|
||||||
|
lineNumber.setAttribute('data-line-number', index);
|
||||||
|
|
||||||
|
// Add in the actual line of source code
|
||||||
|
var code = row.insertCell(-1);
|
||||||
|
code.className = 'line-code';
|
||||||
|
|
||||||
|
// If the line is blank, add a newline to make it copyable.
|
||||||
|
if (line === '') {
|
||||||
|
line = '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
code.innerHTML = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the block is a <pre> element, its parent is not an element
|
||||||
|
// generated by Rainbow (i.e. it could be <body>). We don't want
|
||||||
|
// to clear this.
|
||||||
|
var parent = (block.nodeName.toLowerCase() === 'pre') ? block : block.parentNode;
|
||||||
|
|
||||||
|
// Clear the parent element and use the table in place of the <code> block
|
||||||
|
parent.innerHTML = '';
|
||||||
|
parent.appendChild(table);
|
||||||
|
});
|
||||||
|
})(window.Rainbow);
|
||||||
2
scripts/examples-html/assets/js/rainbow.linenumbers.min.js
vendored
Normal file
2
scripts/examples-html/assets/js/rainbow.linenumbers.min.js
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
window.Rainbow&&(window.Rainbow.linenumbers=function(m){m.onHighlight(function(c){if(c&&c.parentNode){var h=document.createElement("table");h.className="rainbow";h.setAttribute("data-language",c.getAttribute("data-language"));for(var e=[""],d=0;d<c.childNodes.length;d++){var a;a=c.childNodes[d];if(3===a.nodeType)a=a.nodeValue.split("\n");else{for(var b=a.innerHTML.split("\n"),f=[],g=0;g<b.length;g++)if(""===b[g])f.push("");else{var k=a.cloneNode(!0);k.innerHTML=b[g];var l=document.createElement("div");
|
||||||
|
l.appendChild(k.cloneNode(!0));f.push(l.innerHTML)}a=f}e[e.length-1]+=a[0];for(b=1;b<a.length;b++)e.push(a[b])}for(d=0;d<e.length;d++)a=e[d],b=d+1,f=h.insertRow(-1),f.className="line line-"+b,g=f.insertCell(-1),g.className="line-number",g.setAttribute("data-line-number",b),b=f.insertCell(-1),b.className="line-code",""===a&&(a="\n"),b.innerHTML=a;c="pre"===c.nodeName.toLowerCase()?c:c.parentNode;c.innerHTML="";c.appendChild(h)}})}(window.Rainbow));
|
||||||
|
|
@ -6,10 +6,12 @@
|
||||||
<link rel="stylesheet" href="../assets/css/main.css" type="text/css"/>
|
<link rel="stylesheet" href="../assets/css/main.css" type="text/css"/>
|
||||||
<link rel="stylesheet" href="../assets/css/menu.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="../assets/css/menu.css" type="text/css" media="screen" />
|
||||||
<link rel="stylesheet" href="../assets/css/solarized-light.css" type="text/css"/>
|
<link rel="stylesheet" href="../assets/css/solarized-light.css" type="text/css"/>
|
||||||
|
<link rel="stylesheet" href="../assets/css/solarized-light-linenumbers.css" type="text/css" />
|
||||||
|
|
||||||
<script src="../example-data.js" type="text/javascript"></script>
|
<script src="../example-data.js" type="text/javascript"></script>
|
||||||
<script src="../assets/js/menu.js" type="text/javascript"></script>
|
<script src="../assets/js/menu.js" type="text/javascript"></script>
|
||||||
<script src="../assets/js/rainbow.min.js" type="text/javascript"></script>
|
<script src="../assets/js/rainbow.min.js" type="text/javascript"></script>
|
||||||
|
<script src="../assets/js/rainbow.linenumbers.min.js" type="text/javascript"></script>
|
||||||
<script src="../assets/js/language/generic.js" type="text/javascript"></script>
|
<script src="../assets/js/language/generic.js" type="text/javascript"></script>
|
||||||
<script src="../assets/js/language/javascript.js" type="text/javascript"></script>
|
<script src="../assets/js/language/javascript.js" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,4 @@
|
||||||
#
|
#
|
||||||
# Requires release.token and releases/<version>.md
|
# Requires release.token and releases/<version>.md
|
||||||
|
|
||||||
curl https://api.github.com/repos/openscad/openscad/releases -H "Authorization: token $(<release.token)" -d "$(./scripts/makereleasejson.py $1)"
|
curl https://api.github.com/repos/openscad/openscad/releases -H "Authorization: token $(<release.token>)" -d "$(./scripts/makereleasejson.py $1)"
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,13 @@ File /r /x mingw-cross-env color-schemes
|
||||||
${registerExtension} "$INSTDIR\openscad.exe" ".scad" "OpenSCAD_File"
|
${registerExtension} "$INSTDIR\openscad.exe" ".scad" "OpenSCAD_File"
|
||||||
CreateShortCut $SMPROGRAMS\OpenSCAD.lnk $INSTDIR\openscad.exe
|
CreateShortCut $SMPROGRAMS\OpenSCAD.lnk $INSTDIR\openscad.exe
|
||||||
WriteUninstaller $INSTDIR\Uninstall.exe
|
WriteUninstaller $INSTDIR\Uninstall.exe
|
||||||
|
# see https://msdn.microsoft.com/en-us/library/aa372105(v=vs.85).aspx
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "DisplayName" "OpenSCAD (remove only)"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "DisplayName" "OpenSCAD (remove only)"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "DisplayVersion" "${VERSION}"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "Publisher" "The OpenSCAD Developers"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "URLInfoAbout" "http://www.openscad.org/"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "URLUpdateInfo" "http://www.openscad.org/downloads.html"
|
||||||
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "HelpLink" "http://forum.openscad.org/"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "UninstallString" "$INSTDIR\Uninstall.exe"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenSCAD" "UninstallString" "$INSTDIR\Uninstall.exe"
|
||||||
WriteRegStr HKCR ".scad" "PerceivedType" "text"
|
WriteRegStr HKCR ".scad" "PerceivedType" "text"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# This script builds all library dependencies of OpenSCAD for Mac OS X.
|
# This script builds all library dependencies of OpenSCAD for Mac OS X.
|
||||||
# The libraries will be build in 64-bit (and optionally 32-bit mode) mode
|
# The libraries will be build in 64-bit mode and backwards compatible with 10.7 "Lion".
|
||||||
# and backwards compatible with 10.5 "Leopard".
|
|
||||||
#
|
#
|
||||||
# This script must be run from the OpenSCAD source root directory
|
# This script must be run from the OpenSCAD source root directory
|
||||||
#
|
#
|
||||||
# Usage: macosx-build-dependencies.sh [-6lcd] [<package>]
|
# Usage: macosx-build-dependencies.sh [-16lcdf] [<package>]
|
||||||
# -6 Build only 64-bit binaries
|
# -3 Build using C++03 and libstdc++ (default is C++11 and libc++)
|
||||||
# -l Force use of LLVM compiler
|
# -l Force use of LLVM compiler
|
||||||
# -c Force use of clang compiler
|
# -c Force use of clang compiler
|
||||||
# -d Build for deployment (if not specified, e.g. Sparkle won't be built)
|
# -d Build for deployment (if not specified, e.g. Sparkle won't be built)
|
||||||
|
|
@ -25,43 +24,43 @@ OPENSCADDIR=$PWD
|
||||||
SRCDIR=$BASEDIR/src
|
SRCDIR=$BASEDIR/src
|
||||||
DEPLOYDIR=$BASEDIR/install
|
DEPLOYDIR=$BASEDIR/install
|
||||||
MAC_OSX_VERSION_MIN=10.7
|
MAC_OSX_VERSION_MIN=10.7
|
||||||
OPTION_32BIT=false
|
|
||||||
OPTION_LLVM=false
|
OPTION_LLVM=false
|
||||||
OPTION_CLANG=false
|
OPTION_CLANG=false
|
||||||
OPTION_GCC=false
|
OPTION_GCC=false
|
||||||
OPTION_DEPLOY=false
|
OPTION_DEPLOY=false
|
||||||
OPTION_FORCE=0
|
OPTION_FORCE=0
|
||||||
|
OPTION_CXX11=true
|
||||||
|
|
||||||
PACKAGES=(
|
PACKAGES=(
|
||||||
"eigen 3.2.4"
|
|
||||||
"gmp 5.1.3"
|
|
||||||
"mpfr 3.1.2"
|
|
||||||
"boost 1.57.0"
|
|
||||||
"qt5 5.4.1"
|
|
||||||
"qscintilla 2.8.4"
|
|
||||||
# NB! For eigen, also update the path in the function
|
# NB! For eigen, also update the path in the function
|
||||||
|
"eigen 3.2.6"
|
||||||
|
"gmp 5.1.3"
|
||||||
|
"mpfr 3.1.3"
|
||||||
|
"boost 1.59.0"
|
||||||
|
"qt5 5.5.1"
|
||||||
|
"qscintilla 2.8.4"
|
||||||
# NB! For CGAL, also update the actual download URL in the function
|
# NB! For CGAL, also update the actual download URL in the function
|
||||||
"cgal 4.5.2"
|
"cgal 4.6.3"
|
||||||
"glew 1.12.0"
|
"glew 1.13.0"
|
||||||
"gettext 0.19.4"
|
"gettext 0.19.6"
|
||||||
"libffi 3.2.1"
|
"libffi 3.2.1"
|
||||||
"glib2 2.42.1"
|
"glib2 2.46.1"
|
||||||
"opencsg 1.4.0"
|
"opencsg 1.4.0"
|
||||||
"freetype 2.5.5"
|
"freetype 2.6.1"
|
||||||
"ragel 6.9"
|
"ragel 6.9"
|
||||||
"harfbuzz 0.9.37"
|
"harfbuzz 1.0.6"
|
||||||
"libxml2 2.9.2"
|
"libxml2 2.9.2"
|
||||||
"fontconfig 2.11.1"
|
"fontconfig 2.11.1"
|
||||||
)
|
)
|
||||||
DEPLOY_PACKAGES=(
|
DEPLOY_PACKAGES=(
|
||||||
"sparkle Cocoanetics:1e7dcb1a48b96d1a8c62100b5864bd50211cbae1"
|
"sparkle 1.13.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
printUsage()
|
printUsage()
|
||||||
{
|
{
|
||||||
echo "Usage: $0 [-6lcd] [<package>]"
|
echo "Usage: $0 [-3lcdf] [<package>]"
|
||||||
echo
|
echo
|
||||||
echo " -6 Build only 64-bit binaries"
|
echo " -3 Build using C++03 and libstdc++"
|
||||||
echo " -l Force use of LLVM compiler"
|
echo " -l Force use of LLVM compiler"
|
||||||
echo " -c Force use of clang compiler"
|
echo " -c Force use of clang compiler"
|
||||||
echo " -d Build for deployment"
|
echo " -d Build for deployment"
|
||||||
|
|
@ -109,7 +108,6 @@ build()
|
||||||
build_$package $version
|
build_$package $version
|
||||||
set +e
|
set +e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Usage: is_installed <package> [<version>]
|
# Usage: is_installed <package> [<version>]
|
||||||
|
|
@ -185,9 +183,6 @@ build_qt()
|
||||||
sed -i "" -e "s/::TabletProximityRec/TabletProximityRec/g" src/gui/kernel/qt_cocoa_helpers_mac_p.h
|
sed -i "" -e "s/::TabletProximityRec/TabletProximityRec/g" src/gui/kernel/qt_cocoa_helpers_mac_p.h
|
||||||
PLATFORM="-platform unsupported/macx-clang"
|
PLATFORM="-platform unsupported/macx-clang"
|
||||||
fi
|
fi
|
||||||
if $OPTION_32BIT; then
|
|
||||||
QT_32BIT="-arch x86"
|
|
||||||
fi
|
|
||||||
case "$OSX_VERSION" in
|
case "$OSX_VERSION" in
|
||||||
9)
|
9)
|
||||||
# libtiff fails in the linker step with Mavericks / XCode 5.0.1
|
# libtiff fails in the linker step with Mavericks / XCode 5.0.1
|
||||||
|
|
@ -199,7 +194,7 @@ build_qt()
|
||||||
MACOSX_RELEASE_OPTIONS=
|
MACOSX_RELEASE_OPTIONS=
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
./configure -prefix $DEPLOYDIR -release $QT_32BIT -arch x86_64 -opensource -confirm-license $PLATFORM -fast -no-qt3support -no-svg -no-phonon -no-audio-backend -no-multimedia -no-javascript-jit -no-script -no-scripttools -no-declarative -no-xmlpatterns -nomake demos -nomake examples -nomake docs -nomake translations -no-webkit $MACOSX_RELEASE_OPTIONS
|
./configure -prefix $DEPLOYDIR -release -arch x86_64 -opensource -confirm-license $PLATFORM -fast -no-qt3support -no-svg -no-phonon -no-audio-backend -no-multimedia -no-javascript-jit -no-script -no-scripttools -no-declarative -no-xmlpatterns -nomake demos -nomake examples -nomake docs -nomake translations -no-webkit $MACOSX_RELEASE_OPTIONS
|
||||||
make -j"$NUMCPU" install
|
make -j"$NUMCPU" install
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,15 +216,20 @@ build_qt5()
|
||||||
fi
|
fi
|
||||||
tar xzf qt-everywhere-opensource-src-$version.tar.gz
|
tar xzf qt-everywhere-opensource-src-$version.tar.gz
|
||||||
cd qt-everywhere-opensource-src-$version
|
cd qt-everywhere-opensource-src-$version
|
||||||
./configure -prefix $DEPLOYDIR -release -opensource -confirm-license \
|
patch -d qtbase -p1 < $OPENSCADDIR/patches/qt5/QTBUG-46846.patch
|
||||||
|
if ! $USING_CXX11; then
|
||||||
|
QT_EXTRA_FLAGS="-no-c++11"
|
||||||
|
fi
|
||||||
|
CXXFLAGS="$CXXSTDFLAGS" ./configure -prefix $DEPLOYDIR $QT_EXTRA_FLAGS -release -opensource -confirm-license \
|
||||||
-nomake examples -nomake tests \
|
-nomake examples -nomake tests \
|
||||||
-no-xcb -no-c++11 -no-glib -no-harfbuzz -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc \
|
-no-xcb -no-glib -no-harfbuzz -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc \
|
||||||
-no-sql-psql -no-sql-sqlite2 -no-sql-tds -no-cups -no-qml-debug \
|
-no-sql-psql -no-sql-sqlite2 -no-sql-tds -no-cups -no-qml-debug \
|
||||||
-skip activeqt -skip connectivity -skip declarative -skip doc \
|
-skip activeqt -skip connectivity -skip declarative -skip doc \
|
||||||
-skip enginio -skip graphicaleffects -skip location -skip multimedia \
|
-skip enginio -skip graphicaleffects -skip location -skip multimedia \
|
||||||
-skip quick1 -skip quickcontrols -skip script -skip sensors -skip serialport \
|
-skip quick1 -skip quickcontrols -skip script -skip sensors -skip serialport \
|
||||||
-skip svg -skip webkit -skip webkit-examples -skip websockets -skip xmlpatterns
|
-skip svg -skip webkit -skip webkit-examples -skip websockets -skip xmlpatterns -skip qtwebchannel
|
||||||
make -j"$NUMCPU" install
|
make -j"$NUMCPU"
|
||||||
|
make install
|
||||||
}
|
}
|
||||||
|
|
||||||
check_qscintilla()
|
check_qscintilla()
|
||||||
|
|
@ -248,8 +248,8 @@ build_qscintilla()
|
||||||
fi
|
fi
|
||||||
tar xzf QScintilla-gpl-$version.tar.gz
|
tar xzf QScintilla-gpl-$version.tar.gz
|
||||||
cd QScintilla-gpl-$version/Qt4Qt5
|
cd QScintilla-gpl-$version/Qt4Qt5
|
||||||
qmake qscintilla.pro
|
qmake QMAKE_CXXFLAGS+="$CXXSTDFLAGS" QMAKE_LFLAGS+="$CXXSTDFLAGS" qscintilla.pro
|
||||||
make -j6 install
|
make -j"$NUMCPU" install
|
||||||
install_name_tool -id $DEPLOYDIR/lib/libqscintilla2.dylib $DEPLOYDIR/lib/libqscintilla2.dylib
|
install_name_tool -id $DEPLOYDIR/lib/libqscintilla2.dylib $DEPLOYDIR/lib/libqscintilla2.dylib
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,9 +258,6 @@ check_gmp()
|
||||||
check_file lib/libgmp.dylib
|
check_file lib/libgmp.dylib
|
||||||
}
|
}
|
||||||
|
|
||||||
# Hack warning: gmplib is built separately in 32-bit and 64-bit mode
|
|
||||||
# and then merged afterwards. gmplib's header files are dependent on
|
|
||||||
# the CPU architecture on which configure was run and will be patched accordingly.
|
|
||||||
build_gmp()
|
build_gmp()
|
||||||
{
|
{
|
||||||
version=$1
|
version=$1
|
||||||
|
|
@ -273,87 +270,11 @@ build_gmp()
|
||||||
fi
|
fi
|
||||||
tar xjf gmp-$version.tar.bz2
|
tar xjf gmp-$version.tar.bz2
|
||||||
cd gmp-$version
|
cd gmp-$version
|
||||||
patch -p0 gmp-h.in << EOF
|
./configure --prefix=$DEPLOYDIR CXXFLAGS="$CXXSTDFLAGS" CFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS="$LDSTDFLAGS -mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" ABI=64 --enable-cxx
|
||||||
--- gmp-5.1.3/gmp-h.in.old 2013-12-02 20:16:26.000000000 -0800
|
make -j"$NUMCPU" install
|
||||||
+++ gmp-5.1.3/gmp-h.in 2013-12-02 20:21:22.000000000 -0800
|
|
||||||
@@ -27,13 +27,38 @@
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
install_name_tool -id $DEPLOYDIR/lib/libgmp.dylib $DEPLOYDIR/lib/libgmp.dylib
|
||||||
-/* Instantiated by configure. */
|
install_name_tool -id $DEPLOYDIR/lib/libgmpxx.dylib $DEPLOYDIR/lib/libgmpxx.dylib
|
||||||
#if ! defined (__GMP_WITHIN_CONFIGURE)
|
|
||||||
+/* For benefit of fat builds on MacOSX, generate a .h file that can
|
|
||||||
+ * be used with a universal fat library
|
|
||||||
+ */
|
|
||||||
+#if defined(__x86_64__)
|
|
||||||
+#define __GMP_HAVE_HOST_CPU_FAMILY_power 0
|
|
||||||
+#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
|
|
||||||
+#define GMP_LIMB_BITS 64
|
|
||||||
+#define GMP_NAIL_BITS 0
|
|
||||||
+#elif defined(__i386__)
|
|
||||||
+#define __GMP_HAVE_HOST_CPU_FAMILY_power 0
|
|
||||||
+#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
|
|
||||||
+#define GMP_LIMB_BITS 32
|
|
||||||
+#define GMP_NAIL_BITS 0
|
|
||||||
+#elif defined(__powerpc64__)
|
|
||||||
+#define __GMP_HAVE_HOST_CPU_FAMILY_power 0
|
|
||||||
+#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 1
|
|
||||||
+#define GMP_LIMB_BITS 64
|
|
||||||
+#define GMP_NAIL_BITS 0
|
|
||||||
+#elif defined(__ppc__)
|
|
||||||
+#define __GMP_HAVE_HOST_CPU_FAMILY_power 0
|
|
||||||
+#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 1
|
|
||||||
+#define GMP_LIMB_BITS 32
|
|
||||||
+#define GMP_NAIL_BITS 0
|
|
||||||
+#else
|
|
||||||
+/* For other architectures, fall back on values computed by configure */
|
|
||||||
#define __GMP_HAVE_HOST_CPU_FAMILY_power @HAVE_HOST_CPU_FAMILY_power@
|
|
||||||
#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc @HAVE_HOST_CPU_FAMILY_powerpc@
|
|
||||||
#define GMP_LIMB_BITS @GMP_LIMB_BITS@
|
|
||||||
#define GMP_NAIL_BITS @GMP_NAIL_BITS@
|
|
||||||
#endif
|
|
||||||
+#endif
|
|
||||||
#define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS)
|
|
||||||
#define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS)
|
|
||||||
#define GMP_NUMB_MAX GMP_NUMB_MASK
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if $OPTION_32BIT; then
|
|
||||||
mkdir build-i386
|
|
||||||
cd build-i386
|
|
||||||
../configure --prefix=$DEPLOYDIR/i386 "CFLAGS=-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" ABI=32 --enable-cxx
|
|
||||||
make install
|
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 64-bit version
|
|
||||||
mkdir build-x86_64
|
|
||||||
cd build-x86_64
|
|
||||||
../configure --prefix=$DEPLOYDIR/x86_64 "CFLAGS=-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" ABI=64 --enable-cxx
|
|
||||||
make install
|
|
||||||
|
|
||||||
# merge
|
|
||||||
cd $DEPLOYDIR
|
|
||||||
mkdir -p lib
|
|
||||||
if $OPTION_32BIT; then
|
|
||||||
lipo -create i386/lib/libgmp.dylib x86_64/lib/libgmp.dylib -output lib/libgmp.dylib
|
|
||||||
lipo -create i386/lib/libgmpxx.dylib x86_64/lib/libgmpxx.dylib -output lib/libgmpxx.dylib
|
|
||||||
else
|
|
||||||
cp x86_64/lib/libgmp.dylib lib/libgmp.dylib
|
|
||||||
cp x86_64/lib/libgmpxx.dylib lib/libgmpxx.dylib
|
|
||||||
fi
|
|
||||||
install_name_tool -id $DEPLOYDIR/lib/libgmp.dylib lib/libgmp.dylib
|
|
||||||
install_name_tool -id $DEPLOYDIR/lib/libgmpxx.dylib lib/libgmpxx.dylib
|
|
||||||
install_name_tool -change $DEPLOYDIR/x86_64/lib/libgmp.10.dylib $DEPLOYDIR/lib/libgmp.dylib lib/libgmpxx.dylib
|
|
||||||
if $OPTION_32BIT; then
|
|
||||||
cp lib/libgmp.dylib i386/lib/
|
|
||||||
cp lib/libgmp.dylib x86_64/lib/
|
|
||||||
cp lib/libgmpxx.dylib i386/lib/
|
|
||||||
cp lib/libgmpxx.dylib x86_64/lib/
|
|
||||||
fi
|
|
||||||
mkdir -p include
|
|
||||||
cp x86_64/include/gmp.h include/
|
|
||||||
cp x86_64/include/gmpxx.h include/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_mpfr()
|
check_mpfr()
|
||||||
|
|
@ -363,6 +284,11 @@ check_mpfr()
|
||||||
|
|
||||||
# As with gmplib, mpfr is built separately in 32-bit and 64-bit mode and then merged
|
# As with gmplib, mpfr is built separately in 32-bit and 64-bit mode and then merged
|
||||||
# afterwards.
|
# afterwards.
|
||||||
|
check_mpfr()
|
||||||
|
{
|
||||||
|
check_file include/mpfr.h
|
||||||
|
}
|
||||||
|
|
||||||
build_mpfr()
|
build_mpfr()
|
||||||
{
|
{
|
||||||
version=$1
|
version=$1
|
||||||
|
|
@ -375,33 +301,11 @@ build_mpfr()
|
||||||
fi
|
fi
|
||||||
tar xjf mpfr-$version.tar.bz2
|
tar xjf mpfr-$version.tar.bz2
|
||||||
cd mpfr-$version
|
cd mpfr-$version
|
||||||
# curl -O http://www.mpfr.org/mpfr-$version/allpatches
|
|
||||||
# patch -N -Z -p1 < allpatches
|
|
||||||
if $OPTION_32BIT; then
|
|
||||||
mkdir build-i386
|
|
||||||
cd build-i386
|
|
||||||
../configure --prefix=$DEPLOYDIR/i386 --with-gmp=$DEPLOYDIR/i386 CFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch i386"
|
|
||||||
make install
|
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 64-bit version
|
./configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR CFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64"
|
||||||
mkdir build-x86_64
|
make -j"$NUMCPU" install
|
||||||
cd build-x86_64
|
|
||||||
../configure --prefix=$DEPLOYDIR/x86_64 --with-gmp=$DEPLOYDIR/x86_64 CFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64"
|
|
||||||
make install
|
|
||||||
|
|
||||||
# merge
|
install_name_tool -id $DEPLOYDIR/lib/libmpfr.dylib $DEPLOYDIR/lib/libmpfr.dylib
|
||||||
cd $DEPLOYDIR
|
|
||||||
if $OPTION_32BIT; then
|
|
||||||
lipo -create i386/lib/libmpfr.dylib x86_64/lib/libmpfr.dylib -output lib/libmpfr.dylib
|
|
||||||
else
|
|
||||||
cp x86_64/lib/libmpfr.dylib lib/libmpfr.dylib
|
|
||||||
fi
|
|
||||||
install_name_tool -id $DEPLOYDIR/lib/libmpfr.dylib lib/libmpfr.dylib
|
|
||||||
mkdir -p include
|
|
||||||
cp x86_64/include/mpfr.h include/
|
|
||||||
cp x86_64/include/mpf2mpfr.h include/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_boost()
|
check_boost()
|
||||||
|
|
@ -424,9 +328,6 @@ build_boost()
|
||||||
cd boost_$bversion
|
cd boost_$bversion
|
||||||
# We only need the thread and program_options libraries
|
# We only need the thread and program_options libraries
|
||||||
./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,chrono,system,regex
|
./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,chrono,system,regex
|
||||||
if $OPTION_32BIT; then
|
|
||||||
BOOST_EXTRA_FLAGS="-arch i386"
|
|
||||||
fi
|
|
||||||
if $USING_LLVM; then
|
if $USING_LLVM; then
|
||||||
BOOST_TOOLSET="toolset=darwin-llvm"
|
BOOST_TOOLSET="toolset=darwin-llvm"
|
||||||
echo "using darwin : llvm : llvm-g++ ;" >> tools/build/user-config.jam
|
echo "using darwin : llvm : llvm-g++ ;" >> tools/build/user-config.jam
|
||||||
|
|
@ -434,7 +335,7 @@ build_boost()
|
||||||
BOOST_TOOLSET="toolset=clang"
|
BOOST_TOOLSET="toolset=clang"
|
||||||
echo "using clang ;" >> tools/build/user-config.jam
|
echo "using clang ;" >> tools/build/user-config.jam
|
||||||
fi
|
fi
|
||||||
./b2 -j"$NUMCPU" -d+2 $BOOST_TOOLSET cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS -headerpad_max_install_names" install
|
./b2 -j"$NUMCPU" -d+2 $BOOST_TOOLSET cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $CXXSTDFLAGS" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $LDSTDFLAGS -headerpad_max_install_names" install
|
||||||
install_name_tool -id $DEPLOYDIR/lib/libboost_thread.dylib $DEPLOYDIR/lib/libboost_thread.dylib
|
install_name_tool -id $DEPLOYDIR/lib/libboost_thread.dylib $DEPLOYDIR/lib/libboost_thread.dylib
|
||||||
install_name_tool -change libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_thread.dylib
|
install_name_tool -change libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_thread.dylib
|
||||||
install_name_tool -change libboost_chrono.dylib $DEPLOYDIR/lib/libboost_chrono.dylib $DEPLOYDIR/lib/libboost_thread.dylib
|
install_name_tool -change libboost_chrono.dylib $DEPLOYDIR/lib/libboost_chrono.dylib $DEPLOYDIR/lib/libboost_thread.dylib
|
||||||
|
|
@ -460,8 +361,9 @@ build_cgal()
|
||||||
cd $BASEDIR/src
|
cd $BASEDIR/src
|
||||||
rm -rf CGAL-$version
|
rm -rf CGAL-$version
|
||||||
if [ ! -f CGAL-$version.tar.gz ]; then
|
if [ ! -f CGAL-$version.tar.gz ]; then
|
||||||
# 4.5.2
|
# 4.6.3
|
||||||
curl -O https://gforge.inria.fr/frs/download.php/file/34512/CGAL-$version.tar.gz
|
curl -O https://gforge.inria.fr/frs/download.php/file/35138/CGAL-$version.tar.gz
|
||||||
|
# 4.5.2 curl -O https://gforge.inria.fr/frs/download.php/file/34512/CGAL-$version.tar.gz
|
||||||
# 4.5.1 curl -O https://gforge.inria.fr/frs/download.php/file/34400/CGAL-$version.tar.gz
|
# 4.5.1 curl -O https://gforge.inria.fr/frs/download.php/file/34400/CGAL-$version.tar.gz
|
||||||
# 4.5 curl -O https://gforge.inria.fr/frs/download.php/file/34149/CGAL-$version.tar.gz
|
# 4.5 curl -O https://gforge.inria.fr/frs/download.php/file/34149/CGAL-$version.tar.gz
|
||||||
# 4.4 curl -O https://gforge.inria.fr/frs/download.php/file/33525/CGAL-$version.tar.gz
|
# 4.4 curl -O https://gforge.inria.fr/frs/download.php/file/33525/CGAL-$version.tar.gz
|
||||||
|
|
@ -477,10 +379,7 @@ build_cgal()
|
||||||
fi
|
fi
|
||||||
tar xzf CGAL-$version.tar.gz
|
tar xzf CGAL-$version.tar.gz
|
||||||
cd CGAL-$version
|
cd CGAL-$version
|
||||||
if $OPTION_32BIT; then
|
CXXFLAGS="$CXXSTDFLAGS" cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.dylib -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.dylib -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.dylib -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DBOOST_ROOT=$DEPLOYDIR -DBoost_USE_MULTITHREADED=false
|
||||||
CGAL_EXTRA_FLAGS=";i386"
|
|
||||||
fi
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.dylib -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.dylib -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.dylib -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$CGAL_EXTRA_FLAGS" -DBOOST_ROOT=$DEPLOYDIR -DBoost_USE_MULTITHREADED=false
|
|
||||||
make -j"$NUMCPU" install
|
make -j"$NUMCPU" install
|
||||||
make install
|
make install
|
||||||
install_name_tool -id $DEPLOYDIR/lib/libCGAL.dylib $DEPLOYDIR/lib/libCGAL.dylib
|
install_name_tool -id $DEPLOYDIR/lib/libCGAL.dylib $DEPLOYDIR/lib/libCGAL.dylib
|
||||||
|
|
@ -506,10 +405,7 @@ build_glew()
|
||||||
tar xzf glew-$version.tgz
|
tar xzf glew-$version.tgz
|
||||||
cd glew-$version
|
cd glew-$version
|
||||||
mkdir -p $DEPLOYDIR/lib/pkgconfig
|
mkdir -p $DEPLOYDIR/lib/pkgconfig
|
||||||
if $OPTION_32BIT; then
|
make GLEW_DEST=$DEPLOYDIR CC=$CC CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64" STRIP= install
|
||||||
GLEW_EXTRA_FLAGS="-arch i386"
|
|
||||||
fi
|
|
||||||
make GLEW_DEST=$DEPLOYDIR CC=$CC CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=$MAC_OSX_VERSION_MIN $GLEW_EXTRA_FLAGS -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN $GLEW_EXTRA_FLAGS -arch x86_64" STRIP= install
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_opencsg()
|
check_opencsg()
|
||||||
|
|
@ -530,10 +426,7 @@ build_opencsg()
|
||||||
tar xzf OpenCSG-$version.tar.gz
|
tar xzf OpenCSG-$version.tar.gz
|
||||||
cd OpenCSG-$version
|
cd OpenCSG-$version
|
||||||
patch -p1 < $OPENSCADDIR/patches/OpenCSG-$version-MacOSX-port.patch
|
patch -p1 < $OPENSCADDIR/patches/OpenCSG-$version-MacOSX-port.patch
|
||||||
if $OPTION_32BIT; then
|
qmake -r QMAKE_CXXFLAGS+="-I$DEPLOYDIR/include $CXXSTDFLAGS" QMAKE_LFLAGS+="-L$DEPLOYDIR/lib $LDSTDFLAGS" CONFIG+="x86_64" DESTDIR=$DEPLOYDIR
|
||||||
OPENCSG_EXTRA_FLAGS="x86"
|
|
||||||
fi
|
|
||||||
qmake -r QMAKE_CXXFLAGS+="-I$DEPLOYDIR/include" QMAKE_LFLAGS+="-L$DEPLOYDIR/lib" CONFIG+="x86_64 $OPENCSG_EXTRA_FLAGS" DESTDIR=$DEPLOYDIR
|
|
||||||
make install
|
make install
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -567,6 +460,7 @@ build_eigen()
|
||||||
elif [ $version = "3.2.2" ]; then EIGENDIR=eigen-eigen-1306d75b4a21;
|
elif [ $version = "3.2.2" ]; then EIGENDIR=eigen-eigen-1306d75b4a21;
|
||||||
elif [ $version = "3.2.3" ]; then EIGENDIR=eigen-eigen-36fd1ba04c12;
|
elif [ $version = "3.2.3" ]; then EIGENDIR=eigen-eigen-36fd1ba04c12;
|
||||||
elif [ $version = "3.2.4" ]; then EIGENDIR=eigen-eigen-10219c95fe65;
|
elif [ $version = "3.2.4" ]; then EIGENDIR=eigen-eigen-10219c95fe65;
|
||||||
|
elif [ $version = "3.2.6" ]; then EIGENDIR=eigen-eigen-c58038c56923;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $EIGENDIR = "none" ]; then
|
if [ $EIGENDIR = "none" ]; then
|
||||||
|
|
@ -584,10 +478,7 @@ build_eigen()
|
||||||
cd eigen-$version
|
cd eigen-$version
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
if $OPTION_32BIT; then
|
CXXFLAGS="$CXXSTDFLAGS" cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_TEST_NOQT=TRUE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64" ..
|
||||||
EIGEN_EXTRA_FLAGS=";i386"
|
|
||||||
fi
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_TEST_NOQT=TRUE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$EIGEN_EXTRA_FLAGS" ..
|
|
||||||
make -j"$NUMCPU" install
|
make -j"$NUMCPU" install
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -596,35 +487,48 @@ check_sparkle()
|
||||||
check_file lib/Sparkle.framework/Sparkle
|
check_file lib/Sparkle.framework/Sparkle
|
||||||
}
|
}
|
||||||
|
|
||||||
# Usage: build_sparkle <githubuser>:<commitID>
|
# Usage:
|
||||||
|
# build_sparkle <githubuser>:<commitID>
|
||||||
|
# build_sparkle <version>
|
||||||
|
|
||||||
build_sparkle()
|
build_sparkle()
|
||||||
{
|
{
|
||||||
v=$1
|
# Binary install:
|
||||||
github=${1%%:*} # Cut at first colon
|
version=$1
|
||||||
version=${1#*:} # cut until first colon
|
|
||||||
|
|
||||||
echo "Building Sparkle" $version "..."
|
|
||||||
|
|
||||||
# Let Sparkle use the default compiler
|
|
||||||
unset CC
|
|
||||||
unset CXX
|
|
||||||
|
|
||||||
cd $BASEDIR/src
|
cd $BASEDIR/src
|
||||||
rm -rf Sparkle-$version
|
rm -rf Sparkle-$version
|
||||||
if [ ! -f Sparkle-$version.zip ]; then
|
if [ ! -f Sparkle-$version.tar.bz2 ]; then
|
||||||
curl -o Sparkle-$version.zip https://nodeload.github.com/$github/Sparkle/zip/$version
|
curl -LO https://github.com/sparkle-project/Sparkle/releases/download/$version/Sparkle-$version.tar.bz2
|
||||||
fi
|
fi
|
||||||
unzip -q Sparkle-$version.zip
|
mkdir Sparkle-$version
|
||||||
cd Sparkle-$version
|
cd Sparkle-$version
|
||||||
patch -p1 < $OPENSCADDIR/patches/sparkle.patch
|
tar xjf ../Sparkle-$version.tar.bz2
|
||||||
if $OPTION_32BIT; then
|
cp -Rf Sparkle.framework $DEPLOYDIR/lib/
|
||||||
SPARKLE_EXTRA_FLAGS="-arch i386"
|
|
||||||
fi
|
# Build from source:
|
||||||
xcodebuild clean
|
# v=$1
|
||||||
xcodebuild -arch x86_64 $SPARKLE_EXTRA_FLAGS
|
# github=${1%%:*} # Cut at first colon
|
||||||
rm -rf $DEPLOYDIR/lib/Sparkle.framework
|
# version=${1#*:} # cut until first colon
|
||||||
cp -Rf build/Release/Sparkle.framework $DEPLOYDIR/lib/
|
#
|
||||||
install_name_tool -id $DEPLOYDIR/lib/Sparkle.framework/Versions/A/Sparkle $DEPLOYDIR/lib/Sparkle.framework/Sparkle
|
# echo "Building Sparkle" $version "..."
|
||||||
|
#
|
||||||
|
# # Let Sparkle use the default compiler
|
||||||
|
# unset CC
|
||||||
|
# unset CXX
|
||||||
|
#
|
||||||
|
# cd $BASEDIR/src
|
||||||
|
# rm -rf Sparkle-$version
|
||||||
|
# if [ ! -f Sparkle-$version.zip ]; then
|
||||||
|
# curl -o Sparkle-$version.zip https://nodeload.github.com/$github/Sparkle/zip/$version
|
||||||
|
# fi
|
||||||
|
# unzip -q Sparkle-$version.zip
|
||||||
|
# cd Sparkle-$version
|
||||||
|
# patch -p1 < $OPENSCADDIR/patches/sparkle.patch
|
||||||
|
# xcodebuild clean
|
||||||
|
# xcodebuild -arch x86_64
|
||||||
|
# rm -rf $DEPLOYDIR/lib/Sparkle.framework
|
||||||
|
# cp -Rf build/Release/Sparkle.framework $DEPLOYDIR/lib/
|
||||||
|
# Install_name_tool -id $DEPLOYDIR/lib/Sparkle.framework/Versions/A/Sparkle $DEPLOYDIR/lib/Sparkle.framework/Sparkle
|
||||||
}
|
}
|
||||||
|
|
||||||
check_freetype()
|
check_freetype()
|
||||||
|
|
@ -815,7 +719,7 @@ build_harfbuzz()
|
||||||
# disable doc directories as they make problems on Mac OS Build
|
# disable doc directories as they make problems on Mac OS Build
|
||||||
sed -e "s/SUBDIRS = src util test docs/SUBDIRS = src util test/g" Makefile.am > Makefile.am.bak && mv Makefile.am.bak Makefile.am
|
sed -e "s/SUBDIRS = src util test docs/SUBDIRS = src util test/g" Makefile.am > Makefile.am.bak && mv Makefile.am.bak Makefile.am
|
||||||
sed -e "s/^docs.*$//" configure.ac > configure.ac.bak && mv configure.ac.bak configure.ac
|
sed -e "s/^docs.*$//" configure.ac > configure.ac.bak && mv configure.ac.bak configure.ac
|
||||||
PKG_CONFIG_LIBDIR="$DEPLOYDIR/lib/pkgconfig" ./autogen.sh --prefix="$DEPLOYDIR" --with-freetype=yes --with-gobject=no --with-cairo=no --with-icu=no CFLAGS=-mmacosx-version-min=$MAC_OSX_VERSION_MIN CXXFLAGS=-mmacosx-version-min=$MAC_OSX_VERSION_MIN LDFLAGS=-mmacosx-version-min=$MAC_OSX_VERSION_MIN $extra_config_flags
|
PKG_CONFIG_LIBDIR="$DEPLOYDIR/lib/pkgconfig" ./autogen.sh --prefix="$DEPLOYDIR" --with-freetype=yes --with-gobject=no --with-cairo=no --with-icu=no CFLAGS=-mmacosx-version-min=$MAC_OSX_VERSION_MIN CXXFLAGS="$CXXFLAGS -mmacosx-version-min=$MAC_OSX_VERSION_MIN" LDFLAGS="$CXXFLAGS -mmacosx-version-min=$MAC_OSX_VERSION_MIN" $extra_config_flags
|
||||||
make -j$NUMCPU
|
make -j$NUMCPU
|
||||||
make install
|
make install
|
||||||
}
|
}
|
||||||
|
|
@ -826,10 +730,10 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then
|
||||||
fi
|
fi
|
||||||
OPENSCAD_SCRIPTDIR=$PWD/scripts
|
OPENSCAD_SCRIPTDIR=$PWD/scripts
|
||||||
|
|
||||||
while getopts '6lcdf' c
|
while getopts '3lcdf' c
|
||||||
do
|
do
|
||||||
case $c in
|
case $c in
|
||||||
6) OPTION_32BIT=false;;
|
3) USING_CXX11=false;;
|
||||||
l) OPTION_LLVM=true;;
|
l) OPTION_LLVM=true;;
|
||||||
c) OPTION_CLANG=true;;
|
c) OPTION_CLANG=true;;
|
||||||
d) OPTION_DEPLOY=true;;
|
d) OPTION_DEPLOY=true;;
|
||||||
|
|
@ -841,7 +745,9 @@ done
|
||||||
OPTION_PACKAGES="${@:$OPTIND}"
|
OPTION_PACKAGES="${@:$OPTIND}"
|
||||||
|
|
||||||
OSX_VERSION=`sw_vers -productVersion | cut -d. -f2`
|
OSX_VERSION=`sw_vers -productVersion | cut -d. -f2`
|
||||||
if (( $OSX_VERSION >= 10 )); then
|
if (( $OSX_VERSION >= 11 )); then
|
||||||
|
echo "Detected El Capitan (10.11) or later"
|
||||||
|
elif (( $OSX_VERSION >= 10 )); then
|
||||||
echo "Detected Yosemite (10.10) or later"
|
echo "Detected Yosemite (10.10) or later"
|
||||||
elif (( $OSX_VERSION >= 9 )); then
|
elif (( $OSX_VERSION >= 9 )); then
|
||||||
echo "Detected Mavericks (10.9)"
|
echo "Detected Mavericks (10.9)"
|
||||||
|
|
@ -885,6 +791,14 @@ elif $USING_CLANG; then
|
||||||
export CXX=clang++
|
export CXX=clang++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $USING_CXX11; then
|
||||||
|
export CXXSTDFLAGS="-std=c++11 -stdlib=libc++"
|
||||||
|
export LDSTDFLAGS="-stdlib=libc++"
|
||||||
|
else
|
||||||
|
export CXXSTDFLAGS="-std=c++03 -stdlib=libstdc++"
|
||||||
|
export LDSTDFLAGS="-stdlib=libstdc++"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Building for $MAC_OSX_VERSION_MIN or later"
|
echo "Building for $MAC_OSX_VERSION_MIN or later"
|
||||||
|
|
||||||
if [ ! $NUMCPU ]; then
|
if [ ! $NUMCPU ]; then
|
||||||
|
|
@ -896,12 +810,6 @@ if $OPTION_DEPLOY; then
|
||||||
echo "Building deployment version of libraries"
|
echo "Building deployment version of libraries"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $OPTION_32BIT; then
|
|
||||||
echo "Building combined 32/64-bit binaries"
|
|
||||||
else
|
|
||||||
echo "Building 64-bit binaries"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( $OPTION_FORCE )); then
|
if (( $OPTION_FORCE )); then
|
||||||
echo "Forcing rebuild"
|
echo "Forcing rebuild"
|
||||||
fi
|
fi
|
||||||
|
|
@ -917,6 +825,7 @@ fi
|
||||||
|
|
||||||
# Build specified (or all) packages
|
# Build specified (or all) packages
|
||||||
ALL_PACKAGES=$(all_packages)
|
ALL_PACKAGES=$(all_packages)
|
||||||
|
echo $ALL_PACKAGES
|
||||||
if [ -z "$OPTION_PACKAGES" ]; then
|
if [ -z "$OPTION_PACKAGES" ]; then
|
||||||
OPTION_PACKAGES=$ALL_PACKAGES
|
OPTION_PACKAGES=$ALL_PACKAGES
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import re
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
|
cxxlib = None
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print >> sys.stderr, "Usage: " + sys.argv[0] + " <executable>"
|
print >> sys.stderr, "Usage: " + sys.argv[0] + " <executable>"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
@ -29,6 +31,11 @@ def usage():
|
||||||
def lookup_library(file):
|
def lookup_library(file):
|
||||||
found = None
|
found = None
|
||||||
if not re.match("/", file):
|
if not re.match("/", file):
|
||||||
|
if re.search("@rpath", file):
|
||||||
|
file = re.sub("^@rpath", lc_rpath, file)
|
||||||
|
if os.path.exists(file): found = file
|
||||||
|
if DEBUG: print "Lib in @rpath found: " + str(file)
|
||||||
|
if (not found):
|
||||||
if re.search("@executable_path", file):
|
if re.search("@executable_path", file):
|
||||||
abs = re.sub("^@executable_path", executable_path, file)
|
abs = re.sub("^@executable_path", executable_path, file)
|
||||||
if os.path.exists(abs): found = abs
|
if os.path.exists(abs): found = abs
|
||||||
|
|
@ -62,11 +69,16 @@ def find_dependencies(file):
|
||||||
return None
|
return None
|
||||||
deps = output.split('\n')
|
deps = output.split('\n')
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
#print dep
|
# print dep
|
||||||
# Fail if anything is linked with libc++, as that's not backwards compatible
|
# Fail if libstc++ and libc++ was mixed
|
||||||
# with Mac OS X 10.6
|
global cxxlib
|
||||||
if re.search("libc\+\+", dep):
|
match = re.search("lib(std)?c\+\+", dep)
|
||||||
print "Error: clang's libc++ is used by " + file
|
if match:
|
||||||
|
if not cxxlib:
|
||||||
|
cxxlib = match.group(0)
|
||||||
|
else:
|
||||||
|
if cxxlib != match.group(0):
|
||||||
|
print "Error: Mixing libc++ and libstdc++"
|
||||||
return None
|
return None
|
||||||
dep = re.sub(".*:$", "", dep) # Take away header line
|
dep = re.sub(".*:$", "", dep) # Take away header line
|
||||||
dep = re.sub("^\t", "", dep) # Remove initial tabs
|
dep = re.sub("^\t", "", dep) # Remove initial tabs
|
||||||
|
|
@ -110,6 +122,18 @@ if __name__ == '__main__':
|
||||||
executable = sys.argv[1]
|
executable = sys.argv[1]
|
||||||
if DEBUG: print "Processing " + executable
|
if DEBUG: print "Processing " + executable
|
||||||
executable_path = os.path.dirname(executable)
|
executable_path = os.path.dirname(executable)
|
||||||
|
|
||||||
|
# Find the Runpath search path (LC_RPATH)
|
||||||
|
p = subprocess.Popen(["otool", "-l", executable], stdout=subprocess.PIPE)
|
||||||
|
output = p.communicate()[0]
|
||||||
|
if p.returncode != 0:
|
||||||
|
print 'Error otool -l failed on main executable'
|
||||||
|
sys.exit(1)
|
||||||
|
# Check deployment target
|
||||||
|
m = re.search("LC_RPATH\n(.*)\n\s+path ([^ ]+)", output, re.MULTILINE)
|
||||||
|
lc_rpath = m.group(2)
|
||||||
|
if DEBUG: print 'Runpath search path: ' + lc_rpath
|
||||||
|
|
||||||
# processed is a dict {libname : [parents]} - each parent is dependant on libname
|
# processed is a dict {libname : [parents]} - each parent is dependant on libname
|
||||||
processed = {}
|
processed = {}
|
||||||
pending = [executable]
|
pending = [executable]
|
||||||
|
|
@ -118,17 +142,18 @@ if __name__ == '__main__':
|
||||||
dep = pending.pop()
|
dep = pending.pop()
|
||||||
if DEBUG: print "Evaluating " + dep
|
if DEBUG: print "Evaluating " + dep
|
||||||
deps = find_dependencies(dep)
|
deps = find_dependencies(dep)
|
||||||
|
# if DEBUG: print "Deps: " + ' '.join(deps)
|
||||||
assert(deps)
|
assert(deps)
|
||||||
for d in deps:
|
for d in deps:
|
||||||
absfile = lookup_library(d)
|
absfile = lookup_library(d)
|
||||||
if not re.match(executable_path, absfile):
|
|
||||||
print "Error: External dependency " + d
|
|
||||||
sys.exit(1)
|
|
||||||
if absfile == None:
|
if absfile == None:
|
||||||
print "Not found: " + d
|
print "Not found: " + d
|
||||||
print " ..required by " + str(processed[dep])
|
print " ..required by " + str(processed[dep])
|
||||||
error = True
|
error = True
|
||||||
continue
|
continue
|
||||||
|
if not re.match(executable_path, absfile):
|
||||||
|
print "Error: External dependency " + d
|
||||||
|
sys.exit(1)
|
||||||
if absfile in processed:
|
if absfile in processed:
|
||||||
processed[absfile].append(dep)
|
processed[absfile].append(dep)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,21 @@
|
||||||
#
|
#
|
||||||
# Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X
|
# Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X
|
||||||
#
|
#
|
||||||
# Also note the 64 bit is built on the branch of mxe by Tony Theodore
|
# Notes:
|
||||||
# which hasnt been merged to official mxe as of writing
|
#
|
||||||
|
# Originally this was based on Tony Theodore's branch of MXE, which is now
|
||||||
|
# integrated into official MXE.
|
||||||
|
#
|
||||||
|
# Targets:
|
||||||
|
#
|
||||||
|
# MXE allows 4 separate targets with the MXE_TARGETS environment variable.
|
||||||
|
# As of 2015 shared are not guaranteed to work.
|
||||||
|
#
|
||||||
|
# 64 bit static linked libraries MXE_TARGETS=x86_64-w64-mingw32.static
|
||||||
|
# 32 bit static linked libraries MXE_TARGETS=i686-w64-mingw32.static
|
||||||
|
# 64 bit shared libraries MXE_TARGETS=x86_64-w64-mingw32.shared
|
||||||
|
# 32 bit shared libraries MXE_TARGETS=i686-w64-mingw32.shared
|
||||||
|
#
|
||||||
|
|
||||||
OPENSCADDIR=$PWD
|
OPENSCADDIR=$PWD
|
||||||
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
|
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
|
||||||
|
|
|
||||||
|
|
@ -72,16 +72,17 @@ elif [[ $OSTYPE == "linux-gnu" ]]; then
|
||||||
echo "Detected build-machine ARCH: $ARCH"
|
echo "Detected build-machine ARCH: $ARCH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "`echo $* | grep mingw32`" ]; then
|
if [ "`echo $* | grep mingw`" ]; then
|
||||||
OS=UNIX_CROSS_WIN
|
OS=UNIX_CROSS_WIN
|
||||||
ARCH=32
|
ARCH=32
|
||||||
echo Mingw-cross build using ARCH=32
|
MXELIBTYPE=static
|
||||||
fi
|
if [ "`echo $* | grep mingw64`" ]; then
|
||||||
|
|
||||||
if [ "`echo $* | grep mingw64`" ]; then
|
|
||||||
OS=UNIX_CROSS_WIN
|
|
||||||
ARCH=64
|
ARCH=64
|
||||||
echo Mingw-cross build using ARCH=64
|
fi
|
||||||
|
if [ "`echo $* | grep shared`" ]; then
|
||||||
|
MXELIBTYPE=shared
|
||||||
|
fi
|
||||||
|
echo Mingw-cross build using ARCH=$ARCH MXELIBTYPE=$MXELIBTYPE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "`echo $* | grep snapshot`" ]; then
|
if [ "`echo $* | grep snapshot`" ]; then
|
||||||
|
|
@ -188,7 +189,7 @@ case $OS in
|
||||||
TARGET=release
|
TARGET=release
|
||||||
;;
|
;;
|
||||||
UNIX_CROSS_WIN)
|
UNIX_CROSS_WIN)
|
||||||
. ./scripts/setenv-mingw-xbuild.sh $ARCH
|
. ./scripts/setenv-mingw-xbuild.sh $ARCH $MXELIBTYPE
|
||||||
TARGET=release
|
TARGET=release
|
||||||
ZIP="zip"
|
ZIP="zip"
|
||||||
ZIPARGS="-r -q"
|
ZIPARGS="-r -q"
|
||||||
|
|
@ -198,7 +199,12 @@ esac
|
||||||
|
|
||||||
case $OS in
|
case $OS in
|
||||||
UNIX_CROSS_WIN)
|
UNIX_CROSS_WIN)
|
||||||
cd $DEPLOYDIR && qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+="$CONFIG" CONFIG+=mingw-cross-env CONFIG-=debug ../openscad.pro
|
cd $DEPLOYDIR
|
||||||
|
MINGWCONFIG=mingw-cross-env
|
||||||
|
if [ $MXELIBTYPE = "shared" ]; then
|
||||||
|
MINGWCONFIG=mingw-cross-env-shared
|
||||||
|
fi
|
||||||
|
qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+="$CONFIG" CONFIG+=$MINGWCONFIG CONFIG-=debug ../openscad.pro
|
||||||
cd $OPENSCADDIR
|
cd $OPENSCADDIR
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
@ -425,9 +431,78 @@ case $OS in
|
||||||
INSTFILE=$DEPLOYDIR/OpenSCAD-$VERSION-x86-$ARCH-Installer.exe
|
INSTFILE=$DEPLOYDIR/OpenSCAD-$VERSION-x86-$ARCH-Installer.exe
|
||||||
|
|
||||||
#package
|
#package
|
||||||
|
if [ $MXELIBTYPE = "shared" ]; then
|
||||||
|
flprefix=$DEPLOYDIR/mingw-cross-env/bin
|
||||||
|
echo Copying dlls for shared library build
|
||||||
|
echo from $flprefix
|
||||||
|
echo to $DEPLOYDIR/$TARGET
|
||||||
|
flist=
|
||||||
|
# fl="$fl opengl.dll" # use Windows version?
|
||||||
|
# fl="$fl libmpfr.dll" # does not exist
|
||||||
|
fl="$fl libgmp-10.dll"
|
||||||
|
fl="$fl libgmpxx-4.dll"
|
||||||
|
fl="$fl libboost_filesystem-mt.dll"
|
||||||
|
fl="$fl libboost_program_options-mt.dll"
|
||||||
|
fl="$fl libboost_regex-mt.dll"
|
||||||
|
fl="$fl libboost_chrono-mt.dll"
|
||||||
|
fl="$fl libboost_system-mt.dll"
|
||||||
|
fl="$fl libboost_thread_win32-mt.dll"
|
||||||
|
fl="$fl libCGAL.dll"
|
||||||
|
fl="$fl libCGAL_Core.dll"
|
||||||
|
fl="$fl GLEW.dll"
|
||||||
|
fl="$fl libglib-2.0-0.dll"
|
||||||
|
fl="$fl libopencsg-1.dll"
|
||||||
|
fl="$fl libharfbuzz-0.dll"
|
||||||
|
# fl="$fl libharfbuzz-gobject-0.dll" # ????
|
||||||
|
fl="$fl libfontconfig-1.dll"
|
||||||
|
fl="$fl libexpat-1.dll"
|
||||||
|
fl="$fl libbz2.dll"
|
||||||
|
fl="$fl libintl-8.dll"
|
||||||
|
fl="$fl libiconv-2.dll"
|
||||||
|
fl="$fl libfreetype-6.dll"
|
||||||
|
fl="$fl libpcre16-0.dll"
|
||||||
|
fl="$fl zlib1.dll"
|
||||||
|
fl="$fl libpng16-16.dll"
|
||||||
|
fl="$fl icudt54.dll"
|
||||||
|
fl="$fl icudt.dll"
|
||||||
|
fl="$fl icuin.dll"
|
||||||
|
fl="$fl libstdc++-6.dll"
|
||||||
|
fl="$fl ../qt5/lib/qscintilla2.dll"
|
||||||
|
fl="$fl ../qt5/bin/Qt5PrintSupport.dll"
|
||||||
|
fl="$fl ../qt5/bin/Qt5Core.dll"
|
||||||
|
fl="$fl ../qt5/bin/Qt5Gui.dll"
|
||||||
|
fl="$fl ../qt5/bin/Qt5OpenGL.dll"
|
||||||
|
# fl="$fl ../qt5/bin/QtSvg4.dll" # why is this here?
|
||||||
|
fl="$fl ../qt5/bin/Qt5Widgets.dll"
|
||||||
|
fl="$fl ../qt5/bin/Qt5PrintSupport.dll"
|
||||||
|
fl="$fl ../qt5/bin/Qt5PrintSupport.dll"
|
||||||
|
for dllfile in $fl; do
|
||||||
|
if [ -e $flprefix/$dllfile ]; then
|
||||||
|
echo $flprefix/$dllfile
|
||||||
|
cp $flprefix/$dllfile $DEPLOYDIR/$TARGET/
|
||||||
|
else
|
||||||
|
echo cannot find $flprefix/$dllfile
|
||||||
|
echo stopping build.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Copying main binary .exe, .com, and dlls"
|
||||||
|
echo "from $DEPLOYDIR/$TARGET"
|
||||||
|
echo "to $DEPLOYDIR/openscad-$VERSION"
|
||||||
|
TMPTAR=$DEPLOYDIR/tmpmingw.$ARCH.$MXELIBTYPE.tar
|
||||||
|
cd $DEPLOYDIR
|
||||||
|
cd $TARGET
|
||||||
|
tar cvf $TMPTAR --exclude=winconsole.o .
|
||||||
|
cd $DEPLOYDIR
|
||||||
|
cd ./openscad-$VERSION
|
||||||
|
tar xvf $TMPTAR
|
||||||
|
cd $DEPLOYDIR
|
||||||
|
rm -f $TMPTAR
|
||||||
|
|
||||||
|
|
||||||
echo "Creating binary zip package"
|
echo "Creating binary zip package"
|
||||||
cp $TARGET/openscad.exe openscad-$VERSION
|
|
||||||
cp $TARGET/openscad.com openscad-$VERSION
|
|
||||||
rm -f OpenSCAD-$VERSION.x86-$ARCH.zip
|
rm -f OpenSCAD-$VERSION.x86-$ARCH.zip
|
||||||
"$ZIP" $ZIPARGS $BINFILE openscad-$VERSION
|
"$ZIP" $ZIPARGS $BINFILE openscad-$VERSION
|
||||||
cd $OPENSCADDIR
|
cd $OPENSCADDIR
|
||||||
|
|
@ -443,8 +518,8 @@ case $OS in
|
||||||
cd $DEPLOYDIR/openscad-$VERSION
|
cd $DEPLOYDIR/openscad-$VERSION
|
||||||
NSISDEBUG=-V2
|
NSISDEBUG=-V2
|
||||||
# NSISDEBUG= # leave blank for full log
|
# NSISDEBUG= # leave blank for full log
|
||||||
echo $MAKENSIS $NSISDEBUG installer.nsi
|
echo $MAKENSIS $NSISDEBUG "-DVERSION=$VERSION" installer.nsi
|
||||||
$MAKENSIS $NSISDEBUG installer.nsi
|
$MAKENSIS $NSISDEBUG "-DVERSION=$VERSION" installer.nsi
|
||||||
cp $DEPLOYDIR/openscad-$VERSION/openscad_setup.exe $INSTFILE
|
cp $DEPLOYDIR/openscad-$VERSION/openscad_setup.exe $INSTFILE
|
||||||
cd $OPENSCADDIR
|
cd $OPENSCADDIR
|
||||||
|
|
||||||
|
|
@ -528,7 +603,7 @@ if [ $BUILD_TESTS ]; then
|
||||||
# while copying.
|
# while copying.
|
||||||
rm -f ./ostests.tar
|
rm -f ./ostests.tar
|
||||||
for subdir in tests testdata libraries examples doc; do
|
for subdir in tests testdata libraries examples doc; do
|
||||||
tar prvf ./ostests.tar --exclude=.git* --exclude=*/mingw64/* --exclude=*/mingw32/* --exclude=*.cc.obj --exclude=*.a $subdir
|
tar prvf ./ostests.tar --exclude=.git* --exclude=*/mingw* --exclude=*.cc.obj --exclude=*.a $subdir
|
||||||
done
|
done
|
||||||
cd $DEPLOYDIR
|
cd $DEPLOYDIR
|
||||||
tar prvf $OPENSCADDIR/ostests.tar --exclude=.git* --exclude=*/mingw* --exclude=*.cc.obj --exclude=*.a $TESTBINDIR
|
tar prvf $OPENSCADDIR/ostests.tar --exclude=.git* --exclude=*/mingw* --exclude=*.cc.obj --exclude=*.a $TESTBINDIR
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@
|
||||||
# Usage:
|
# Usage:
|
||||||
#
|
#
|
||||||
# source ./scripts/setenv-mingw-xbuild.sh # 32 bit build
|
# source ./scripts/setenv-mingw-xbuild.sh # 32 bit build
|
||||||
|
# source ./scripts/setenv-mingw-xbuild.sh shared # 32 bit build, shared libs
|
||||||
# source ./scripts/setenv-mingw-xbuild.sh 64 # 64 bit build
|
# source ./scripts/setenv-mingw-xbuild.sh 64 # 64 bit build
|
||||||
|
# source ./scripts/setenv-mingw-xbuild.sh 64 shared # 64 bit build, shared libs
|
||||||
# source ./scripts/setenv-mingw-xbuild.sh clean # Clean up exported variables
|
# source ./scripts/setenv-mingw-xbuild.sh clean # Clean up exported variables
|
||||||
# source ./scripts/setenv-mingw-xbuild.sh qt5 # use qt5 (experimental)
|
# source ./scripts/setenv-mingw-xbuild.sh qt5 # use qt5 (experimental)
|
||||||
#
|
#
|
||||||
|
|
@ -22,8 +24,14 @@ if [ ! $BASEDIR ]; then
|
||||||
BASEDIR=$HOME/openscad_deps
|
BASEDIR=$HOME/openscad_deps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEPLOYDIR64=$OPENSCADDIR/mingw64
|
MXELIBTYPE=static
|
||||||
DEPLOYDIR32=$OPENSCADDIR/mingw32
|
if [ "`echo $* | grep shared `" ]; then
|
||||||
|
MXELIBTYPE=shared
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
DEPLOYDIR64=$OPENSCADDIR/mingw64.$MXELIBTYPE
|
||||||
|
DEPLOYDIR32=$OPENSCADDIR/mingw32.$MXELIBTYPE
|
||||||
|
|
||||||
if [ ! $DEPLOYDIR ]; then
|
if [ ! $DEPLOYDIR ]; then
|
||||||
if [ "`echo $* | grep 64 `" ]; then
|
if [ "`echo $* | grep 64 `" ]; then
|
||||||
|
|
@ -39,6 +47,11 @@ if [ ! $MXEDIR ]; then
|
||||||
else
|
else
|
||||||
MXEDIR=$BASEDIR/mxe
|
MXEDIR=$BASEDIR/mxe
|
||||||
fi
|
fi
|
||||||
|
if [ ! -e $MXEDIR ]; then
|
||||||
|
if [ -e /opt/mxe ]; then
|
||||||
|
MXEDIR=/opt/mxe
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! $MXEQTSUBDIR ]; then
|
if [ ! $MXEQTSUBDIR ]; then
|
||||||
|
|
@ -56,9 +69,9 @@ if [ ! -e $DEPLOYDIR ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "`echo $* | grep 64 `" ]; then
|
if [ "`echo $* | grep 64 `" ]; then
|
||||||
MXETARGETDIR=$MXEDIR/usr/x86_64-w64-mingw32.static
|
MXETARGETDIR=$MXEDIR/usr/x86_64-w64-mingw32.$MXELIBTYPE
|
||||||
else
|
else
|
||||||
MXETARGETDIR=$MXEDIR/usr/i686-w64-mingw32.static
|
MXETARGETDIR=$MXEDIR/usr/i686-w64-mingw32.$MXELIBTYPE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! $MINGWX_SAVED_ORIGINAL_PATH ]; then
|
if [ ! $MINGWX_SAVED_ORIGINAL_PATH ]; then
|
||||||
|
|
@ -91,6 +104,7 @@ export OPENSCAD_LIBRARIES
|
||||||
export BASEDIR
|
export BASEDIR
|
||||||
export MXEDIR
|
export MXEDIR
|
||||||
export MXETARGETDIR
|
export MXETARGETDIR
|
||||||
|
export MXELIBTYPE
|
||||||
export DEPLOYDIR
|
export DEPLOYDIR
|
||||||
export PATH
|
export PATH
|
||||||
export MINGWX_SAVED_ORIGINAL_PATH
|
export MINGWX_SAVED_ORIGINAL_PATH
|
||||||
|
|
@ -100,6 +114,7 @@ echo OPENSCAD_LIBRARIES: $OPENSCAD_LIBRARIES
|
||||||
echo BASEDIR: $BASEDIR
|
echo BASEDIR: $BASEDIR
|
||||||
echo MXEDIR: $MXEDIR
|
echo MXEDIR: $MXEDIR
|
||||||
echo MXETARGETDIR: $MXETARGETDIR
|
echo MXETARGETDIR: $MXETARGETDIR
|
||||||
|
echo MXELIBTYPE: $MXELIBTYPE
|
||||||
echo DEPLOYDIR: $DEPLOYDIR
|
echo DEPLOYDIR: $DEPLOYDIR
|
||||||
echo MXEQTSUBDIR: $MXEQTSUBDIR
|
echo MXEQTSUBDIR: $MXEQTSUBDIR
|
||||||
if [ "`echo $* | grep clean`" ]; then
|
if [ "`echo $* | grep clean`" ]; then
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@ updatepot()
|
||||||
| awk '{ printf "#: examples/examples.json:%d\nmsgid %s\nmsgstr \"\"\n\n", $1, $2 }' \
|
| awk '{ printf "#: examples/examples.json:%d\nmsgid %s\nmsgstr \"\"\n\n", $1, $2 }' \
|
||||||
> ./locale/json-strings.pot
|
> ./locale/json-strings.pot
|
||||||
|
|
||||||
|
# extract strings from appdata file
|
||||||
|
itstool -o ./locale/appdata-strings.pot ./openscad.appdata.xml.in --its=./contrib/appdata.its
|
||||||
|
|
||||||
VER=`date +"%Y.%m.%d"`
|
VER=`date +"%Y.%m.%d"`
|
||||||
OPTS=
|
OPTS=
|
||||||
OPTS=$OPTS' --package-name=OpenSCAD'
|
OPTS=$OPTS' --package-name=OpenSCAD'
|
||||||
|
|
@ -41,7 +44,7 @@ updatepot()
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd="${GETTEXT_PATH}msgcat -o ./locale/openscad.pot ./locale/openscad-tmp.pot ./locale/json-strings.pot"
|
cmd="${GETTEXT_PATH}msgcat -o ./locale/openscad.pot ./locale/openscad-tmp.pot ./locale/json-strings.pot ./locale/appdata-strings.pot"
|
||||||
echo $cmd
|
echo $cmd
|
||||||
$cmd
|
$cmd
|
||||||
if [ ! $? = 0 ]; then
|
if [ ! $? = 0 ]; then
|
||||||
|
|
@ -50,7 +53,7 @@ updatepot()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -e s/"CHARSET"/"UTF-8"/g ./locale/openscad.pot > ./locale/openscad.pot.new && mv ./locale/openscad.pot.new ./locale/openscad.pot
|
sed -e s/"CHARSET"/"UTF-8"/g ./locale/openscad.pot > ./locale/openscad.pot.new && mv ./locale/openscad.pot.new ./locale/openscad.pot
|
||||||
rm -f ./locale/json-strings.pot ./locale/openscad-tmp.pot
|
rm -f ./locale/json-strings.pot ./locale/openscad-tmp.pot ./locale/appdata-strings.pot
|
||||||
}
|
}
|
||||||
|
|
||||||
updatepo()
|
updatepo()
|
||||||
|
|
@ -80,6 +83,26 @@ updatemo()
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if which itstool > /dev/null 2>&1; then
|
||||||
|
# ugly workaround for bug https://bugs.freedesktop.org/show_bug.cgi?id=90937
|
||||||
|
for LANGCODE in `cat locale/LINGUAS | grep -v "#"`; do
|
||||||
|
ln -s openscad.mo ./locale/$LANGCODE/LC_MESSAGES/$LANGCODE.mo
|
||||||
|
done
|
||||||
|
|
||||||
|
# generate translated appdata file
|
||||||
|
itstool -j ./openscad.appdata.xml.in -o ./openscad.appdata.xml ./locale/*/LC_MESSAGES/[a-z][a-z].mo
|
||||||
|
|
||||||
|
# clean the mess
|
||||||
|
for LANGCODE in `cat locale/LINGUAS | grep -v "#"`; do
|
||||||
|
unlink ./locale/$LANGCODE/LC_MESSAGES/$LANGCODE.mo
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if [ x"$(uname -s)" = x"Linux" ]; then
|
||||||
|
echo "itstool missing, won't apply translations to openscad.appdata.xml"
|
||||||
|
fi
|
||||||
|
cp -f ./openscad.appdata.xml.in ./openscad.appdata.xml
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
GETTEXT_PATH=""
|
GETTEXT_PATH=""
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
qmake CONFIG+=experimental CONFIG+=nogui
|
||||||
|
make
|
||||||
|
|
||||||
cd tests
|
cd tests
|
||||||
cmake .
|
cmake .
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,22 @@ check_env()
|
||||||
detect_glu()
|
detect_glu()
|
||||||
{
|
{
|
||||||
detect_glu_result=
|
detect_glu_result=
|
||||||
if [ -e $DEPLOYDIR/include/GL/glu.h ]; then detect_glu_result=1; fi
|
if [ -e $DEPLOYDIR/include/GL/glu.h ]; then
|
||||||
if [ -e /usr/include/GL/glu.h ]; then detect_glu_result=1; fi
|
detect_glu_include=$DEPLOYDIR/include
|
||||||
if [ -e /usr/local/include/GL/glu.h ]; then detect_glu_result=1; fi
|
detect_glu_result=1;
|
||||||
if [ -e /usr/pkg/X11R7/include/GL/glu.h ]; then detect_glu_result=1; fi
|
fi
|
||||||
|
if [ -e /usr/include/GL/glu.h ]; then
|
||||||
|
detect_glu_include=/usr/include
|
||||||
|
detect_glu_result=1;
|
||||||
|
fi
|
||||||
|
if [ -e /usr/local/include/GL/glu.h ]; then
|
||||||
|
detect_glu_include=/usr/local/include
|
||||||
|
detect_glu_result=1;
|
||||||
|
fi
|
||||||
|
if [ -e /usr/pkg/X11R7/include/GL/glu.h ]; then
|
||||||
|
detect_glu_include=/usr/pkg/X11R7/include
|
||||||
|
detect_glu_result=1;
|
||||||
|
fi
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,7 +190,11 @@ build_qt5scintilla2()
|
||||||
tar xzf QScintilla-gpl-$version.tar.gz
|
tar xzf QScintilla-gpl-$version.tar.gz
|
||||||
cd QScintilla-gpl-$version/Qt4Qt5/
|
cd QScintilla-gpl-$version/Qt4Qt5/
|
||||||
qmake CONFIG+=staticlib
|
qmake CONFIG+=staticlib
|
||||||
make -j"$NUMCPU" install
|
tmpinstalldir=$DEPLOYDIR/tmp/qsci$version
|
||||||
|
INSTALL_ROOT=$tmpinstalldir make -j"$NUMCPU" install
|
||||||
|
cp -av $tmpinstalldir/usr/share $DEPLOYDIR/
|
||||||
|
cp -av $tmpinstalldir/usr/include $DEPLOYDIR/
|
||||||
|
cp -av $tmpinstalldir/usr/lib $DEPLOYDIR/
|
||||||
}
|
}
|
||||||
|
|
||||||
build_bison()
|
build_bison()
|
||||||
|
|
@ -400,8 +416,10 @@ build_cgal()
|
||||||
|
|
||||||
# older cmakes have buggy FindBoost that can result in
|
# older cmakes have buggy FindBoost that can result in
|
||||||
# finding the system libraries but OPENSCAD_LIBRARIES include paths
|
# finding the system libraries but OPENSCAD_LIBRARIES include paths
|
||||||
FINDBOOST_CMAKE=$OPENSCAD_SCRIPTDIR/../tests/FindBoost.cmake
|
# NB! This was removed 2015-12-02 - if this problem resurfaces, fix it only for the relevant platforms as this
|
||||||
cp $FINDBOOST_CMAKE ./cmake/modules/
|
# messes up more recent installations of cmake and CGAL.
|
||||||
|
# FINDBOOST_CMAKE=$OPENSCAD_SCRIPTDIR/../tests/FindBoost.cmake
|
||||||
|
# cp $FINDBOOST_CMAKE ./cmake/modules/
|
||||||
|
|
||||||
mkdir bin
|
mkdir bin
|
||||||
cd bin
|
cd bin
|
||||||
|
|
@ -505,10 +523,20 @@ build_opencsg()
|
||||||
cp opencsg.pro opencsg.pro.bak
|
cp opencsg.pro opencsg.pro.bak
|
||||||
cat opencsg.pro.bak | sed s/example// > opencsg.pro
|
cat opencsg.pro.bak | sed s/example// > opencsg.pro
|
||||||
|
|
||||||
|
detect_glu
|
||||||
|
GLU_INCLUDE=$detect_glu_include
|
||||||
|
if [ ! $detect_glu_result ]; then
|
||||||
|
build_glu 9.0.0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "`command -v qmake-qt4`" ]; then
|
if [ "`command -v qmake-qt4`" ]; then
|
||||||
OPENCSG_QMAKE=qmake-qt4
|
OPENCSG_QMAKE=qmake-qt4
|
||||||
elif [ "`command -v qmake4`" ]; then
|
elif [ "`command -v qmake4`" ]; then
|
||||||
OPENCSG_QMAKE=qmake4
|
OPENCSG_QMAKE=qmake4
|
||||||
|
elif [ "`command -v qmake-qt5`" ]; then
|
||||||
|
OPENCSG_QMAKE=qmake-qt5
|
||||||
|
elif [ "`command -v qmake5`" ]; then
|
||||||
|
OPENCSG_QMAKE=qmake5
|
||||||
elif [ "`command -v qmake`" ]; then
|
elif [ "`command -v qmake`" ]; then
|
||||||
OPENCSG_QMAKE=qmake
|
OPENCSG_QMAKE=qmake
|
||||||
else
|
else
|
||||||
|
|
@ -518,15 +546,18 @@ build_opencsg()
|
||||||
cp src/Makefile src/Makefile.bak
|
cp src/Makefile src/Makefile.bak
|
||||||
|
|
||||||
cat Makefile.bak | sed s/example// |sed s/glew// > Makefile
|
cat Makefile.bak | sed s/example// |sed s/glew// > Makefile
|
||||||
cat src/Makefile.bak | sed s@^INCPATH.*@INCPATH\ =\ -I$BASEDIR/include\ -I../include\ -I..\ -I.@ > src/Makefile
|
cat src/Makefile.bak | sed s@^INCPATH.*@INCPATH\ =\ -I$BASEDIR/include\ -I../include\ -I..\ -I$GLU_INCLUDE -I.@ > src/Makefile
|
||||||
cp src/Makefile src/Makefile.bak2
|
cp src/Makefile src/Makefile.bak2
|
||||||
cat src/Makefile.bak2 | sed s@^LIBS.*@LIBS\ =\ -L$BASEDIR/lib\ -L/usr/X11R6/lib\ -lGLU\ -lGL@ > src/Makefile
|
cat src/Makefile.bak2 | sed s@^LIBS.*@LIBS\ =\ -L$BASEDIR/lib\ -L/usr/X11R6/lib\ -lGLU\ -lGL@ > src/Makefile
|
||||||
tmp=$version
|
tmp=$version
|
||||||
detect_glu
|
|
||||||
if [ ! $detect_glu_result ]; then build_glu 9.0.0 ; fi
|
|
||||||
version=$tmp
|
version=$tmp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! $OPENCSG_QMAKE = "make" ]; then
|
||||||
|
OPENCSG_QMAKE=$OPENCSG_QMAKE' "QMAKE_CXXFLAGS+=-I'$GLU_INCLUDE'"'
|
||||||
|
fi
|
||||||
|
echo OPENCSG_QMAKE: $OPENCSG_QMAKE
|
||||||
|
|
||||||
cd $BASEDIR/src/OpenCSG-$version/src
|
cd $BASEDIR/src/OpenCSG-$version/src
|
||||||
$OPENCSG_QMAKE
|
$OPENCSG_QMAKE
|
||||||
|
|
||||||
|
|
@ -776,6 +807,11 @@ if [ $1 ]; then
|
||||||
build_gettext 0.18.3.1
|
build_gettext 0.18.3.1
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
if [ $1 = "harfbuzz" ]; then
|
||||||
|
# debian 7 lacks only harfbuzz
|
||||||
|
build_harfbuzz 0.9.23 --with-glib=yes
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
if [ $1 = "glib2" ]; then
|
if [ $1 = "glib2" ]; then
|
||||||
# such a huge build, put here by itself
|
# such a huge build, put here by itself
|
||||||
build_pkgconfig 0.28
|
build_pkgconfig 0.28
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,24 @@
|
||||||
# this assumes you have sudo installed and running, or are running as root.
|
# this assumes you have sudo installed and running, or are running as root.
|
||||||
#
|
#
|
||||||
|
|
||||||
get_fedora_deps()
|
get_fedora_deps_yum()
|
||||||
{
|
{
|
||||||
yum -y install qt5-qtbase-devel bison flex eigen3-devel harfbuzz-devel \
|
yum -y install qt5-qtbase-devel bison flex eigen3-devel harfbuzz-devel \
|
||||||
fontconfig-devel freetype-devel \
|
fontconfig-devel freetype-devel \
|
||||||
boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc gcc-c++ pkgconfig \
|
boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc gcc-c++ pkgconfig \
|
||||||
opencsg-devel git libXmu-devel curl imagemagick ImageMagick glib2-devel make \
|
opencsg-devel git libXmu-devel curl imagemagick ImageMagick glib2-devel make \
|
||||||
xorg-x11-server-Xvfb gettext
|
xorg-x11-server-Xvfb gettext qscintilla-devel qscintilla-qt5-devel \
|
||||||
|
mesa-dri-drivers
|
||||||
|
}
|
||||||
|
|
||||||
|
get_fedora_deps_dnf()
|
||||||
|
{
|
||||||
|
dnf -y install qt5-qtbase-devel bison flex eigen3-devel harfbuzz-devel \
|
||||||
|
fontconfig-devel freetype-devel \
|
||||||
|
boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc gcc-c++ pkgconfig \
|
||||||
|
opencsg-devel git libXmu-devel curl ImageMagick glib2-devel make \
|
||||||
|
xorg-x11-server-Xvfb gettext qscintilla-devel qscintilla-qt5-devel \
|
||||||
|
mesa-dri-drivers
|
||||||
}
|
}
|
||||||
|
|
||||||
get_qomo_deps()
|
get_qomo_deps()
|
||||||
|
|
@ -43,8 +54,13 @@ get_netbsd_deps()
|
||||||
get_opensuse_deps()
|
get_opensuse_deps()
|
||||||
{
|
{
|
||||||
zypper install libeigen3-devel mpfr-devel gmp-devel boost-devel \
|
zypper install libeigen3-devel mpfr-devel gmp-devel boost-devel \
|
||||||
libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel curl \
|
libqt4-devel glew-devel cmake git bison flex cgal-devel curl \
|
||||||
glib2-devel gettext
|
glib2-devel gettext freetype-devel harfbuzz-devel libqscintilla-devel \
|
||||||
|
xvfb-run imagemagick opencsg-devel
|
||||||
|
echo if you are missing opencsg, please add the -graphics- repository
|
||||||
|
echo find your version from cat /etc/issue, then replace it below, then run
|
||||||
|
echo " zypper ar -f http://download.opensuse.org/repositories/graphics/openSUSE_13.2 graphics"
|
||||||
|
echo " zypper install opencsg-devel"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_mageia_deps()
|
get_mageia_deps()
|
||||||
|
|
@ -58,12 +74,78 @@ get_mageia_deps()
|
||||||
get_debian_deps()
|
get_debian_deps()
|
||||||
{
|
{
|
||||||
apt-get -y install \
|
apt-get -y install \
|
||||||
build-essential curl libffi-dev qtbase5-dev libqt5scintilla2-dev \
|
build-essential curl libffi-dev \
|
||||||
libxmu-dev cmake bison flex git-core libboost-all-dev \
|
libxmu-dev cmake bison flex git-core libboost-all-dev \
|
||||||
libXi-dev libmpfr-dev libboost-dev libglew-dev \
|
libXi-dev libmpfr-dev libboost-dev libglew-dev \
|
||||||
libeigen3-dev libcgal-dev libopencsg-dev libgmp3-dev libgmp-dev \
|
libeigen3-dev libcgal-dev libopencsg-dev libgmp3-dev libgmp-dev \
|
||||||
imagemagick libfontconfig-dev libfreetype6-dev \
|
imagemagick libfontconfig-dev libfreetype6-dev \
|
||||||
libharfbuzz-dev gtk-doc-tools libglib2.0-dev gettext
|
gtk-doc-tools libglib2.0-dev gettext xvfb pkg-config ragel
|
||||||
|
}
|
||||||
|
|
||||||
|
get_debian_7_deps()
|
||||||
|
{
|
||||||
|
get_debian_deps
|
||||||
|
apt-get -y install libqt4-dev libqscintilla2-dev
|
||||||
|
echo "debian 7 detected"
|
||||||
|
echo "please build harfbuzz & see the README on building dependencies"
|
||||||
|
echo ". ./scripts/setenv-unibuild.sh"
|
||||||
|
echo "./scripts/uni-build-dependencies.sh harfbuzz"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_qt4or5_deps_debian()
|
||||||
|
{
|
||||||
|
# debian 8 can have both qt4 and qt5 installed... or neither. figure out which
|
||||||
|
# and cater to it.
|
||||||
|
useqt=5
|
||||||
|
|
||||||
|
if [ "`dpkg --list | grep qt5-default`" ]; then
|
||||||
|
useqt=5
|
||||||
|
elif [ "`dpkg --list | grep qt4-default`" ]; then
|
||||||
|
useqt=4
|
||||||
|
elif [ "`echo QT_SELECT | grep ^4`" ]; then
|
||||||
|
useqt=4
|
||||||
|
elif [ "`echo QT_SELECT | grep qt4`" ]; then
|
||||||
|
useqt=4
|
||||||
|
elif [ "`echo QT_SELECT | grep ^5`" ]; then
|
||||||
|
useqt=5
|
||||||
|
elif [ "`echo QT_SELECT | grep qt5`" ]; then
|
||||||
|
useqt=5
|
||||||
|
elif [ ! "`command -v qtchooser`" ]; then
|
||||||
|
useqt=5
|
||||||
|
elif [ "`qtchooser -l | grep qt5`" ]; then
|
||||||
|
useqt=5
|
||||||
|
elif [ ! "`qtchooser -l | grep qt4`" ]; then
|
||||||
|
useqt=5
|
||||||
|
elif [ ! "`command -v qmake`" ]; then
|
||||||
|
useqt=5
|
||||||
|
elif [ "`qmake --version | grep -i qt.version.4`" ]; then
|
||||||
|
useqt=4
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $useqt = 5 ]; then
|
||||||
|
apt-get -y install qtbase5-dev libqt5scintilla2-dev libqt5opengl5-dev qt5-qmake
|
||||||
|
else
|
||||||
|
apt-get -y install libqt4-dev libqscintilla2-dev libqt4-opengl-dev
|
||||||
|
fi
|
||||||
|
if [ ! "`command -v qmake`" ]; then
|
||||||
|
apt-get -y install qt$useqt-default
|
||||||
|
echo "installed qt$useqt-default to enable qmake"
|
||||||
|
elif [ ! "`qmake --version | grep qmake.version`" ]; then
|
||||||
|
apt-get -y install qt$useqt-default
|
||||||
|
echo "installed qt$useqt-default to enable qmake"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_debian_8_deps()
|
||||||
|
{
|
||||||
|
apt-get -y install libharfbuzz-dev
|
||||||
|
get_debian_deps
|
||||||
|
get_qt4or5_deps_debian
|
||||||
|
}
|
||||||
|
|
||||||
|
get_ubuntu_14_deps()
|
||||||
|
{
|
||||||
|
get_debian_8_deps
|
||||||
}
|
}
|
||||||
|
|
||||||
unknown()
|
unknown()
|
||||||
|
|
@ -73,18 +155,32 @@ unknown()
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -e /etc/issue ]; then
|
if [ -e /etc/issue ]; then
|
||||||
if [ "`grep -i ubuntu /etc/issue`" ]; then
|
if [ "`grep -i ubuntu.1[4-9] /etc/issue`" ]; then
|
||||||
|
get_ubuntu_14_deps
|
||||||
|
elif [ "`grep -i ubuntu /etc/issue`" ]; then
|
||||||
get_debian_deps
|
get_debian_deps
|
||||||
|
elif [ "`grep -i debian.GNU.Linux.7 /etc/issue`" ]; then
|
||||||
|
get_debian_7_deps
|
||||||
elif [ "`grep -i debian /etc/issue`" ]; then
|
elif [ "`grep -i debian /etc/issue`" ]; then
|
||||||
get_debian_deps
|
get_debian_8_deps
|
||||||
elif [ "`grep -i raspbian /etc/issue`" ]; then
|
elif [ "`grep -i raspbian /etc/issue`" ]; then
|
||||||
get_debian_deps
|
get_debian_deps
|
||||||
|
elif [ "`grep -i linux.mint.2 /etc/issue`" ]; then
|
||||||
|
get_ubuntu_14_deps
|
||||||
|
elif [ "`grep -i linux.mint.1[789] /etc/issue`" ]; then
|
||||||
|
get_ubuntu_14_deps
|
||||||
elif [ "`grep -i mint /etc/issue`" ]; then
|
elif [ "`grep -i mint /etc/issue`" ]; then
|
||||||
get_debian_deps
|
get_debian_7_deps
|
||||||
elif [ "`grep -i suse /etc/issue`" ]; then
|
elif [ "`grep -i suse /etc/issue`" ]; then
|
||||||
get_opensuse_deps
|
get_opensuse_deps
|
||||||
|
elif [ "`grep -i fedora.release.2[2-9] /etc/issue`" ]; then
|
||||||
|
get_fedora_deps_dnf
|
||||||
|
elif [ "`grep -i fedora.release.[3-9][0-9] /etc/issue`" ]; then
|
||||||
|
get_fedora_deps_dnf
|
||||||
|
elif [ "`grep -i fedora.release.2[0-1] /etc/issue`" ]; then
|
||||||
|
get_fedora_deps_yum
|
||||||
elif [ "`grep -i fedora /etc/issue`" ]; then
|
elif [ "`grep -i fedora /etc/issue`" ]; then
|
||||||
get_fedora_deps
|
get_fedora_deps_yum
|
||||||
elif [ "`grep -i red.hat /etc/issue`" ]; then
|
elif [ "`grep -i red.hat /etc/issue`" ]; then
|
||||||
get_fedora_deps
|
get_fedora_deps
|
||||||
elif [ "`grep -i mageia /etc/issue`" ]; then
|
elif [ "`grep -i mageia /etc/issue`" ]; then
|
||||||
|
|
|
||||||
11
setenv_mac-c++11.sh
Normal file
11
setenv_mac-c++11.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
export OPENSCAD_LIBRARIES=$PWD/../libraries/install-c++11
|
||||||
|
export DYLD_LIBRARY_PATH=$OPENSCAD_LIBRARIES/lib
|
||||||
|
export DYLD_FRAMEWORK_PATH=$OPENSCAD_LIBRARIES/lib
|
||||||
|
|
||||||
|
# Our own Qt
|
||||||
|
export PATH=$OPENSCAD_LIBRARIES/bin:$PATH
|
||||||
|
unset QMAKESPEC
|
||||||
|
|
||||||
|
# ccache:
|
||||||
|
export PATH=/opt/local/libexec/ccache:$PATH
|
||||||
|
export CCACHE_BASEDIR=$PWD/..
|
||||||
|
|
@ -11,8 +11,6 @@ public:
|
||||||
AboutDialog(QWidget *) {
|
AboutDialog(QWidget *) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
this->setWindowTitle( QString(_("About OpenSCAD")) + " " + openscad_shortversionnumber.c_str());
|
this->setWindowTitle( QString(_("About OpenSCAD")) + " " + openscad_shortversionnumber.c_str());
|
||||||
QUrl flattr_qurl(":icons/flattr.png" );
|
|
||||||
this->aboutText->loadResource( QTextDocument::ImageResource, flattr_qurl );
|
|
||||||
QString tmp = this->aboutText->toHtml();
|
QString tmp = this->aboutText->toHtml();
|
||||||
tmp.replace("__VERSION__", openscad_detailedversionnumber.c_str());
|
tmp.replace("__VERSION__", openscad_detailedversionnumber.c_str());
|
||||||
this->aboutText->setHtml(tmp);
|
this->aboutText->setHtml(tmp);
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,29 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||||
|
|
||||||
|
<style type=text/css>
|
||||||
|
body {
|
||||||
|
font: 13pt Arial,sans-serif;
|
||||||
|
}
|
||||||
|
.flattr-link {
|
||||||
|
color: white;
|
||||||
|
background: #88B058;
|
||||||
|
font: bold 14px Helvetica,sans-serif;
|
||||||
|
}
|
||||||
|
.donate-link {
|
||||||
|
color: white;
|
||||||
|
background: dodgerblue;
|
||||||
|
font: bold 14px Helvetica,sans-serif;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
<body style="font-family:'Arial'; font-size:13pt;">
|
<p align="right">
|
||||||
|
<a class="flattr-link" href="https://flattr.com/submit/auto?user_id=openscad&url=http://openscad.org&title=OpenSCAD&language=&tags=github&category=software"> Flattr this! </a>
|
||||||
<p>
|
<a class="donate-link" href="http://www.openscad.org/community.html"> Donate </a>
|
||||||
<a align=right href="https://flattr.com/submit/auto?user_id=openscad&url=http://openscad.org&title=OpenSCAD&language=&tags=github&category=software"><img align=right src=":icons/flattr.png" /></a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include <AppleEvents.h>
|
#include "AppleEvents.h"
|
||||||
#include <MacTypes.h>
|
#include <MacTypes.h>
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
@ -12,7 +12,7 @@ OSErr eventHandler(const AppleEvent *, AppleEvent *, SRefCon )
|
||||||
{
|
{
|
||||||
// FIXME: Ugly hack; just using the first MainWindow we can find
|
// FIXME: Ugly hack; just using the first MainWindow we can find
|
||||||
MainWindow *mainwin = NULL;
|
MainWindow *mainwin = NULL;
|
||||||
foreach (QWidget *w, QApplication::topLevelWidgets()) {
|
for (auto &w : QApplication::topLevelWidgets()) {
|
||||||
mainwin = qobject_cast<MainWindow*>(w);
|
mainwin = qobject_cast<MainWindow*>(w);
|
||||||
if (mainwin) break;
|
if (mainwin) break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ void CGALRenderer::draw(bool showfaces, bool showedges) const
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
for (size_t j=0; j < this->polyset->polygons[i].size(); j++) {
|
for (size_t j=0; j < this->polyset->polygons[i].size(); j++) {
|
||||||
const Vector3d &p = this->polyset->polygons[i][j];
|
const Vector3d &p = this->polyset->polygons[i][j];
|
||||||
glVertex3d(p[0], p[1], -0.1);
|
glVertex3d(p[0], p[1], 0);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ PolySet *CGAL_Nef_polyhedron::convertToPolyset() const
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CGAL_Nef_polyhedron::resize(Vector3d newsize,
|
void CGAL_Nef_polyhedron::resize(const Vector3d &newsize,
|
||||||
const Eigen::Matrix<bool,3,1> &autosize)
|
const Eigen::Matrix<bool,3,1> &autosize)
|
||||||
{
|
{
|
||||||
// Based on resize() in Giles Bathgate's RapCAD (but not exactly)
|
// Based on resize() in Giles Bathgate's RapCAD (but not exactly)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public:
|
||||||
// FIXME: Deprecated by CGALUtils::createPolySetFromNefPolyhedron3
|
// FIXME: Deprecated by CGALUtils::createPolySetFromNefPolyhedron3
|
||||||
// class PolySet *convertToPolyset() const;
|
// class PolySet *convertToPolyset() const;
|
||||||
void transform( const Transform3d &matrix );
|
void transform( const Transform3d &matrix );
|
||||||
void resize(Vector3d newsize, const Eigen::Matrix<bool,3,1> &autosize);
|
void resize(const Vector3d &newsize, const Eigen::Matrix<bool,3,1> &autosize);
|
||||||
|
|
||||||
shared_ptr<CGAL_Nef_polyhedron3> p3;
|
shared_ptr<CGAL_Nef_polyhedron3> p3;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,251 +0,0 @@
|
||||||
#include "CSGTermEvaluator.h"
|
|
||||||
#include "visitor.h"
|
|
||||||
#include "state.h"
|
|
||||||
#include "csgterm.h"
|
|
||||||
#include "module.h"
|
|
||||||
#include "csgnode.h"
|
|
||||||
#include "transformnode.h"
|
|
||||||
#include "colornode.h"
|
|
||||||
#include "rendernode.h"
|
|
||||||
#include "cgaladvnode.h"
|
|
||||||
#include "printutils.h"
|
|
||||||
#include "GeometryEvaluator.h"
|
|
||||||
#include "polyset.h"
|
|
||||||
#include "polyset-utils.h"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <map>
|
|
||||||
#include <list>
|
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class CSGTermEvaluator
|
|
||||||
|
|
||||||
A visitor responsible for creating a tree of CSGTerm nodes used for rendering
|
|
||||||
with OpenCSG.
|
|
||||||
*/
|
|
||||||
|
|
||||||
shared_ptr<CSGTerm> CSGTermEvaluator::evaluateCSGTerm(const AbstractNode &node,
|
|
||||||
std::vector<shared_ptr<CSGTerm> > &highlights,
|
|
||||||
std::vector<shared_ptr<CSGTerm> > &background)
|
|
||||||
{
|
|
||||||
Traverser evaluate(*this, node, Traverser::PRE_AND_POSTFIX);
|
|
||||||
evaluate.execute();
|
|
||||||
highlights = this->highlights;
|
|
||||||
background = this->background;
|
|
||||||
return this->stored_term[node.index()];
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSGTermEvaluator::applyToChildren(const AbstractNode &node, CSGTermEvaluator::CsgOp op)
|
|
||||||
{
|
|
||||||
shared_ptr<CSGTerm> t1;
|
|
||||||
BOOST_FOREACH(const AbstractNode *chnode, this->visitedchildren[node.index()]) {
|
|
||||||
shared_ptr<CSGTerm> t2(this->stored_term[chnode->index()]);
|
|
||||||
this->stored_term.erase(chnode->index());
|
|
||||||
if (t2 && !t1) {
|
|
||||||
t1 = t2;
|
|
||||||
} else if (t2 && t1) {
|
|
||||||
if (op == CSGT_UNION) {
|
|
||||||
t1 = CSGTerm::createCSGTerm(CSGTerm::TYPE_UNION, t1, t2);
|
|
||||||
} else if (op == CSGT_DIFFERENCE) {
|
|
||||||
t1 = CSGTerm::createCSGTerm(CSGTerm::TYPE_DIFFERENCE, t1, t2);
|
|
||||||
} else if (op == CSGT_INTERSECTION) {
|
|
||||||
t1 = CSGTerm::createCSGTerm(CSGTerm::TYPE_INTERSECTION, t1, t2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (t1 && node.modinst->isHighlight()) {
|
|
||||||
t1->flag = CSGTerm::FLAG_HIGHLIGHT;
|
|
||||||
this->highlights.push_back(t1);
|
|
||||||
}
|
|
||||||
if (t1 && node.modinst->isBackground()) {
|
|
||||||
this->background.push_back(t1);
|
|
||||||
t1.reset(); // don't propagate background tagged nodes
|
|
||||||
}
|
|
||||||
this->stored_term[node.index()] = t1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Response CSGTermEvaluator::visit(State &state, const AbstractNode &node)
|
|
||||||
{
|
|
||||||
if (state.isPostfix()) {
|
|
||||||
applyToChildren(node, CSGT_UNION);
|
|
||||||
addToParent(state, node);
|
|
||||||
}
|
|
||||||
return ContinueTraversal;
|
|
||||||
}
|
|
||||||
|
|
||||||
Response CSGTermEvaluator::visit(State &state, const AbstractIntersectionNode &node)
|
|
||||||
{
|
|
||||||
if (state.isPostfix()) {
|
|
||||||
applyToChildren(node, CSGT_INTERSECTION);
|
|
||||||
addToParent(state, node);
|
|
||||||
}
|
|
||||||
return ContinueTraversal;
|
|
||||||
}
|
|
||||||
|
|
||||||
static shared_ptr<CSGTerm> evaluate_csg_term_from_geometry(const State &state,
|
|
||||||
std::vector<shared_ptr<CSGTerm> > &highlights,
|
|
||||||
std::vector<shared_ptr<CSGTerm> > &background,
|
|
||||||
const shared_ptr<const Geometry> &geom,
|
|
||||||
const ModuleInstantiation *modinst,
|
|
||||||
const AbstractNode &node)
|
|
||||||
{
|
|
||||||
std::stringstream stream;
|
|
||||||
stream << node.name() << node.index();
|
|
||||||
|
|
||||||
// We cannot render Polygon2d directly, so we preprocess (tessellate) it here
|
|
||||||
shared_ptr<const Geometry> g = geom;
|
|
||||||
if (!g->isEmpty()) {
|
|
||||||
shared_ptr<const Polygon2d> p2d = dynamic_pointer_cast<const Polygon2d>(geom);
|
|
||||||
if (p2d) {
|
|
||||||
g.reset(p2d->tessellate());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// We cannot render concave polygons, so tessellate any 3D PolySets
|
|
||||||
shared_ptr<const PolySet> ps = dynamic_pointer_cast<const PolySet>(geom);
|
|
||||||
// Since is_convex() doesn't handle non-planar faces, we need to tessellate
|
|
||||||
// also in the indeterminate state so we cannot just use a boolean comparison. See #1061
|
|
||||||
bool convex = ps->convexValue();
|
|
||||||
if (ps && !convex) {
|
|
||||||
assert(ps->getDimension() == 3);
|
|
||||||
PolySet *ps_tri = new PolySet(3, ps->convexValue());
|
|
||||||
ps_tri->setConvexity(ps->getConvexity());
|
|
||||||
PolysetUtils::tessellate_faces(*ps, *ps_tri);
|
|
||||||
g.reset(ps_tri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<CSGTerm> t(new CSGTerm(g, state.matrix(), state.color(), stream.str()));
|
|
||||||
if (modinst->isHighlight()) {
|
|
||||||
t->flag = CSGTerm::FLAG_HIGHLIGHT;
|
|
||||||
highlights.push_back(t);
|
|
||||||
}
|
|
||||||
if (modinst->isBackground()) {
|
|
||||||
background.push_back(t);
|
|
||||||
t.reset();
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
Response CSGTermEvaluator::visit(State &state, const AbstractPolyNode &node)
|
|
||||||
{
|
|
||||||
if (state.isPostfix()) {
|
|
||||||
shared_ptr<CSGTerm> t1;
|
|
||||||
if (this->geomevaluator) {
|
|
||||||
shared_ptr<const Geometry> geom = this->geomevaluator->evaluateGeometry(node, false);
|
|
||||||
if (geom) {
|
|
||||||
t1 = evaluate_csg_term_from_geometry(state, this->highlights, this->background,
|
|
||||||
geom, node.modinst, node);
|
|
||||||
}
|
|
||||||
node.progress_report();
|
|
||||||
}
|
|
||||||
this->stored_term[node.index()] = t1;
|
|
||||||
addToParent(state, node);
|
|
||||||
}
|
|
||||||
return ContinueTraversal;
|
|
||||||
}
|
|
||||||
|
|
||||||
Response CSGTermEvaluator::visit(State &state, const CsgNode &node)
|
|
||||||
{
|
|
||||||
if (state.isPostfix()) {
|
|
||||||
CsgOp op = CSGT_UNION;
|
|
||||||
switch (node.type) {
|
|
||||||
case OPENSCAD_UNION:
|
|
||||||
op = CSGT_UNION;
|
|
||||||
break;
|
|
||||||
case OPENSCAD_DIFFERENCE:
|
|
||||||
op = CSGT_DIFFERENCE;
|
|
||||||
break;
|
|
||||||
case OPENSCAD_INTERSECTION:
|
|
||||||
op = CSGT_INTERSECTION;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
applyToChildren(node, op);
|
|
||||||
addToParent(state, node);
|
|
||||||
}
|
|
||||||
return ContinueTraversal;
|
|
||||||
}
|
|
||||||
|
|
||||||
Response CSGTermEvaluator::visit(State &state, const TransformNode &node)
|
|
||||||
{
|
|
||||||
if (state.isPrefix()) {
|
|
||||||
state.setMatrix(state.matrix() * node.matrix);
|
|
||||||
}
|
|
||||||
if (state.isPostfix()) {
|
|
||||||
applyToChildren(node, CSGT_UNION);
|
|
||||||
addToParent(state, node);
|
|
||||||
}
|
|
||||||
return ContinueTraversal;
|
|
||||||
}
|
|
||||||
|
|
||||||
Response CSGTermEvaluator::visit(State &state, const ColorNode &node)
|
|
||||||
{
|
|
||||||
if (state.isPrefix()) {
|
|
||||||
if (!state.color().isValid()) state.setColor(node.color);
|
|
||||||
}
|
|
||||||
if (state.isPostfix()) {
|
|
||||||
applyToChildren(node, CSGT_UNION);
|
|
||||||
addToParent(state, node);
|
|
||||||
}
|
|
||||||
return ContinueTraversal;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: If we've got CGAL support, render this node as a CGAL union into a PolySet
|
|
||||||
Response CSGTermEvaluator::visit(State &state, const RenderNode &node)
|
|
||||||
{
|
|
||||||
if (state.isPostfix()) {
|
|
||||||
shared_ptr<CSGTerm> t1;
|
|
||||||
shared_ptr<const Geometry> geom;
|
|
||||||
if (this->geomevaluator) {
|
|
||||||
geom = this->geomevaluator->evaluateGeometry(node, false);
|
|
||||||
if (geom) {
|
|
||||||
t1 = evaluate_csg_term_from_geometry(state, this->highlights, this->background,
|
|
||||||
geom, node.modinst, node);
|
|
||||||
}
|
|
||||||
node.progress_report();
|
|
||||||
}
|
|
||||||
this->stored_term[node.index()] = t1;
|
|
||||||
addToParent(state, node);
|
|
||||||
}
|
|
||||||
return ContinueTraversal;
|
|
||||||
}
|
|
||||||
|
|
||||||
Response CSGTermEvaluator::visit(State &state, const CgaladvNode &node)
|
|
||||||
{
|
|
||||||
if (state.isPostfix()) {
|
|
||||||
shared_ptr<CSGTerm> t1;
|
|
||||||
// FIXME: Calling evaluator directly since we're not a PolyNode. Generalize this.
|
|
||||||
shared_ptr<const Geometry> geom;
|
|
||||||
if (this->geomevaluator) {
|
|
||||||
geom = this->geomevaluator->evaluateGeometry(node, false);
|
|
||||||
if (geom) {
|
|
||||||
t1 = evaluate_csg_term_from_geometry(state, this->highlights, this->background,
|
|
||||||
geom, node.modinst, node);
|
|
||||||
}
|
|
||||||
node.progress_report();
|
|
||||||
}
|
|
||||||
this->stored_term[node.index()] = t1;
|
|
||||||
addToParent(state, node);
|
|
||||||
}
|
|
||||||
return ContinueTraversal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Adds ourself to out parent's list of traversed children.
|
|
||||||
Call this for _every_ node which affects output during traversal.
|
|
||||||
Usually, this should be called from the postfix stage, but for some nodes, we defer traversal letting other components (e.g. CGAL) render the subgraph, and we'll then call this from prefix and prune further traversal.
|
|
||||||
*/
|
|
||||||
void CSGTermEvaluator::addToParent(const State &state, const AbstractNode &node)
|
|
||||||
{
|
|
||||||
this->visitedchildren.erase(node.index());
|
|
||||||
if (state.parent()) {
|
|
||||||
this->visitedchildren[state.parent()->index()].push_back(&node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <list>
|
|
||||||
#include <vector>
|
|
||||||
#include <cstddef>
|
|
||||||
#include "visitor.h"
|
|
||||||
#include "memory.h"
|
|
||||||
|
|
||||||
class CSGTermEvaluator : public Visitor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CSGTermEvaluator(const class Tree &tree, class GeometryEvaluator *geomevaluator = NULL)
|
|
||||||
: tree(tree), geomevaluator(geomevaluator) {
|
|
||||||
}
|
|
||||||
virtual ~CSGTermEvaluator() {}
|
|
||||||
|
|
||||||
virtual Response visit(State &state, const class AbstractNode &node);
|
|
||||||
virtual Response visit(State &state, const class AbstractIntersectionNode &node);
|
|
||||||
virtual Response visit(State &state, const class AbstractPolyNode &node);
|
|
||||||
virtual Response visit(State &state, const class CsgNode &node);
|
|
||||||
virtual Response visit(State &state, const class TransformNode &node);
|
|
||||||
virtual Response visit(State &state, const class ColorNode &node);
|
|
||||||
virtual Response visit(State &state, const class RenderNode &node);
|
|
||||||
virtual Response visit(State &state, const class CgaladvNode &node);
|
|
||||||
|
|
||||||
shared_ptr<class CSGTerm> evaluateCSGTerm(const AbstractNode &node,
|
|
||||||
std::vector<shared_ptr<CSGTerm> > &highlights,
|
|
||||||
std::vector<shared_ptr<CSGTerm> > &background);
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum CsgOp {CSGT_UNION, CSGT_INTERSECTION, CSGT_DIFFERENCE, CSGT_MINKOWSKI};
|
|
||||||
void addToParent(const State &state, const AbstractNode &node);
|
|
||||||
void applyToChildren(const AbstractNode &node, CSGTermEvaluator::CsgOp op);
|
|
||||||
|
|
||||||
const AbstractNode *root;
|
|
||||||
typedef std::list<const AbstractNode *> ChildList;
|
|
||||||
std::map<int, ChildList> visitedchildren;
|
|
||||||
|
|
||||||
public:
|
|
||||||
std::map<int, shared_ptr<CSGTerm> > stored_term; // The term evaluated from each node index
|
|
||||||
|
|
||||||
std::vector<shared_ptr<CSGTerm> > highlights;
|
|
||||||
std::vector<shared_ptr<CSGTerm> > background;
|
|
||||||
const Tree &tree;
|
|
||||||
class GeometryEvaluator *geomevaluator;
|
|
||||||
};
|
|
||||||
294
src/CSGTreeEvaluator.cc
Normal file
294
src/CSGTreeEvaluator.cc
Normal file
|
|
@ -0,0 +1,294 @@
|
||||||
|
#include "CSGTreeEvaluator.h"
|
||||||
|
#include "visitor.h"
|
||||||
|
#include "state.h"
|
||||||
|
#include "csgops.h"
|
||||||
|
#include "module.h"
|
||||||
|
#include "csgnode.h"
|
||||||
|
#include "transformnode.h"
|
||||||
|
#include "colornode.h"
|
||||||
|
#include "rendernode.h"
|
||||||
|
#include "cgaladvnode.h"
|
||||||
|
#include "printutils.h"
|
||||||
|
#include "GeometryEvaluator.h"
|
||||||
|
#include "polyset.h"
|
||||||
|
#include "polyset-utils.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <list>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class CSGTreeEvaluator
|
||||||
|
|
||||||
|
A visitor responsible for creating a binary tree of CSGNode nodes used for rendering
|
||||||
|
with OpenCSG.
|
||||||
|
*/
|
||||||
|
|
||||||
|
shared_ptr<CSGNode> CSGTreeEvaluator::buildCSGTree(const AbstractNode &node)
|
||||||
|
{
|
||||||
|
Traverser evaluate(*this, node, Traverser::PRE_AND_POSTFIX);
|
||||||
|
evaluate.execute();
|
||||||
|
|
||||||
|
shared_ptr<CSGNode> t(this->stored_term[node.index()]);
|
||||||
|
if (t) {
|
||||||
|
if (t->isHighlight()) this->highlightNodes.push_back(t);
|
||||||
|
if (t->isBackground()) {
|
||||||
|
this->backgroundNodes.push_back(t);
|
||||||
|
t.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->rootNode = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSGTreeEvaluator::applyBackgroundAndHighlight(State &state, const AbstractNode &node)
|
||||||
|
{
|
||||||
|
for(const auto &chnode : this->visitedchildren[node.index()]) {
|
||||||
|
shared_ptr<CSGNode> t(this->stored_term[chnode->index()]);
|
||||||
|
this->stored_term.erase(chnode->index());
|
||||||
|
if (t) {
|
||||||
|
if (t->isBackground()) this->backgroundNodes.push_back(t);
|
||||||
|
if (t->isHighlight()) this->highlightNodes.push_back(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSGTreeEvaluator::applyToChildren(State &state, const AbstractNode &node, OpenSCADOperator op)
|
||||||
|
{
|
||||||
|
shared_ptr<CSGNode> t1;
|
||||||
|
const ModuleInstantiation *t1_modinst;
|
||||||
|
for(const auto &chnode : this->visitedchildren[node.index()]) {
|
||||||
|
shared_ptr<CSGNode> t2(this->stored_term[chnode->index()]);
|
||||||
|
const ModuleInstantiation *t2_modinst = chnode->modinst;
|
||||||
|
this->stored_term.erase(chnode->index());
|
||||||
|
if (t2 && !t1) {
|
||||||
|
t1 = t2;
|
||||||
|
t1_modinst = t2_modinst;
|
||||||
|
} else if (t2 && t1) {
|
||||||
|
|
||||||
|
shared_ptr<CSGNode> t;
|
||||||
|
// Handle background
|
||||||
|
if (t1->isBackground() &&
|
||||||
|
// For difference, we inherit the flag from the positive object
|
||||||
|
(t2->isBackground() || op == OPENSCAD_DIFFERENCE)) {
|
||||||
|
t = CSGOperation::createCSGNode(op, t1, t2);
|
||||||
|
t->setBackground(true);
|
||||||
|
}
|
||||||
|
// Background objects are simply moved to backgroundNodes
|
||||||
|
else if (t2->isBackground()) {
|
||||||
|
t = t1;
|
||||||
|
this->backgroundNodes.push_back(t2);
|
||||||
|
}
|
||||||
|
else if (t1->isBackground()) {
|
||||||
|
t = t2;
|
||||||
|
this->backgroundNodes.push_back(t1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
t = CSGOperation::createCSGNode(op, t1, t2);
|
||||||
|
}
|
||||||
|
// Handle highlight
|
||||||
|
switch (op) {
|
||||||
|
case OPENSCAD_DIFFERENCE:
|
||||||
|
if (t != t1 && t1->isHighlight()) {
|
||||||
|
t->setHighlight(true);
|
||||||
|
}
|
||||||
|
else if (t != t2 && t2->isHighlight()) {
|
||||||
|
this->highlightNodes.push_back(t2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OPENSCAD_INTERSECTION:
|
||||||
|
if (t != t1 && t != t2 &&
|
||||||
|
t1->isHighlight() && t2->isHighlight()) {
|
||||||
|
t->setHighlight(true);
|
||||||
|
}
|
||||||
|
else if (t != t1 && t1->isHighlight()) {
|
||||||
|
this->highlightNodes.push_back(t1);
|
||||||
|
}
|
||||||
|
else if (t != t2 && t2->isHighlight()) {
|
||||||
|
this->highlightNodes.push_back(t2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OPENSCAD_UNION:
|
||||||
|
if (t != t1 && t != t2 &&
|
||||||
|
t1->isHighlight() && t2->isHighlight()) {
|
||||||
|
t->setHighlight(true);
|
||||||
|
}
|
||||||
|
else if (t != t1 && t1->isHighlight()) {
|
||||||
|
this->highlightNodes.push_back(t1);
|
||||||
|
t = t2;
|
||||||
|
}
|
||||||
|
else if (t != t2 && t2->isHighlight()) {
|
||||||
|
this->highlightNodes.push_back(t2);
|
||||||
|
t = t1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
t1 = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (t1) {
|
||||||
|
if (node.modinst->isBackground()) t1->setBackground(true);
|
||||||
|
if (node.modinst->isHighlight()) t1->setHighlight(true);
|
||||||
|
}
|
||||||
|
this->stored_term[node.index()] = t1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response CSGTreeEvaluator::visit(State &state, const AbstractNode &node)
|
||||||
|
{
|
||||||
|
if (state.isPostfix()) {
|
||||||
|
applyToChildren(state, node, OPENSCAD_UNION);
|
||||||
|
addToParent(state, node);
|
||||||
|
}
|
||||||
|
return ContinueTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response CSGTreeEvaluator::visit(State &state, const AbstractIntersectionNode &node)
|
||||||
|
{
|
||||||
|
if (state.isPostfix()) {
|
||||||
|
applyToChildren(state, node, OPENSCAD_INTERSECTION);
|
||||||
|
addToParent(state, node);
|
||||||
|
}
|
||||||
|
return ContinueTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<CSGNode> CSGTreeEvaluator::evaluateCSGNodeFromGeometry(
|
||||||
|
State &state, const shared_ptr<const Geometry> &geom,
|
||||||
|
const ModuleInstantiation *modinst, const AbstractNode &node)
|
||||||
|
{
|
||||||
|
std::stringstream stream;
|
||||||
|
stream << node.name() << node.index();
|
||||||
|
|
||||||
|
// We cannot render Polygon2d directly, so we preprocess (tessellate) it here
|
||||||
|
shared_ptr<const Geometry> g = geom;
|
||||||
|
if (!g->isEmpty()) {
|
||||||
|
shared_ptr<const Polygon2d> p2d = dynamic_pointer_cast<const Polygon2d>(geom);
|
||||||
|
if (p2d) {
|
||||||
|
g.reset(p2d->tessellate());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// We cannot render concave polygons, so tessellate any 3D PolySets
|
||||||
|
shared_ptr<const PolySet> ps = dynamic_pointer_cast<const PolySet>(geom);
|
||||||
|
// Since is_convex() doesn't handle non-planar faces, we need to tessellate
|
||||||
|
// also in the indeterminate state so we cannot just use a boolean comparison. See #1061
|
||||||
|
bool convex = ps->convexValue();
|
||||||
|
if (ps && !convex) {
|
||||||
|
assert(ps->getDimension() == 3);
|
||||||
|
PolySet *ps_tri = new PolySet(3, ps->convexValue());
|
||||||
|
ps_tri->setConvexity(ps->getConvexity());
|
||||||
|
PolysetUtils::tessellate_faces(*ps, *ps_tri);
|
||||||
|
g.reset(ps_tri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<CSGNode> t(new CSGLeaf(g, state.matrix(), state.color(), stream.str()));
|
||||||
|
if (modinst->isHighlight()) t->setHighlight(true);
|
||||||
|
else if (modinst->isBackground()) t->setBackground(true);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response CSGTreeEvaluator::visit(State &state, const AbstractPolyNode &node)
|
||||||
|
{
|
||||||
|
if (state.isPostfix()) {
|
||||||
|
shared_ptr<CSGNode> t1;
|
||||||
|
if (this->geomevaluator) {
|
||||||
|
shared_ptr<const Geometry> geom = this->geomevaluator->evaluateGeometry(node, false);
|
||||||
|
if (geom) {
|
||||||
|
t1 = evaluateCSGNodeFromGeometry(state, geom, node.modinst, node);
|
||||||
|
}
|
||||||
|
node.progress_report();
|
||||||
|
}
|
||||||
|
this->stored_term[node.index()] = t1;
|
||||||
|
addToParent(state, node);
|
||||||
|
}
|
||||||
|
return ContinueTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response CSGTreeEvaluator::visit(State &state, const CsgOpNode &node)
|
||||||
|
{
|
||||||
|
if (state.isPostfix()) {
|
||||||
|
applyToChildren(state, node, node.type);
|
||||||
|
addToParent(state, node);
|
||||||
|
}
|
||||||
|
return ContinueTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response CSGTreeEvaluator::visit(State &state, const TransformNode &node)
|
||||||
|
{
|
||||||
|
if (state.isPrefix()) {
|
||||||
|
state.setMatrix(state.matrix() * node.matrix);
|
||||||
|
}
|
||||||
|
if (state.isPostfix()) {
|
||||||
|
applyToChildren(state, node, OPENSCAD_UNION);
|
||||||
|
addToParent(state, node);
|
||||||
|
}
|
||||||
|
return ContinueTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response CSGTreeEvaluator::visit(State &state, const ColorNode &node)
|
||||||
|
{
|
||||||
|
if (state.isPrefix()) {
|
||||||
|
if (!state.color().isValid()) state.setColor(node.color);
|
||||||
|
}
|
||||||
|
if (state.isPostfix()) {
|
||||||
|
applyToChildren(state, node, OPENSCAD_UNION);
|
||||||
|
addToParent(state, node);
|
||||||
|
}
|
||||||
|
return ContinueTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: If we've got CGAL support, render this node as a CGAL union into a PolySet
|
||||||
|
Response CSGTreeEvaluator::visit(State &state, const RenderNode &node)
|
||||||
|
{
|
||||||
|
if (state.isPostfix()) {
|
||||||
|
shared_ptr<CSGNode> t1;
|
||||||
|
shared_ptr<const Geometry> geom;
|
||||||
|
if (this->geomevaluator) {
|
||||||
|
geom = this->geomevaluator->evaluateGeometry(node, false);
|
||||||
|
if (geom) {
|
||||||
|
t1 = evaluateCSGNodeFromGeometry(state, geom, node.modinst, node);
|
||||||
|
}
|
||||||
|
node.progress_report();
|
||||||
|
}
|
||||||
|
this->stored_term[node.index()] = t1;
|
||||||
|
addToParent(state, node);
|
||||||
|
}
|
||||||
|
return ContinueTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response CSGTreeEvaluator::visit(State &state, const CgaladvNode &node)
|
||||||
|
{
|
||||||
|
if (state.isPostfix()) {
|
||||||
|
shared_ptr<CSGNode> t1;
|
||||||
|
// FIXME: Calling evaluator directly since we're not a PolyNode. Generalize this.
|
||||||
|
shared_ptr<const Geometry> geom;
|
||||||
|
if (this->geomevaluator) {
|
||||||
|
geom = this->geomevaluator->evaluateGeometry(node, false);
|
||||||
|
if (geom) {
|
||||||
|
t1 = evaluateCSGNodeFromGeometry(state, geom, node.modinst, node);
|
||||||
|
}
|
||||||
|
node.progress_report();
|
||||||
|
}
|
||||||
|
this->stored_term[node.index()] = t1;
|
||||||
|
applyBackgroundAndHighlight(state, node);
|
||||||
|
addToParent(state, node);
|
||||||
|
}
|
||||||
|
return ContinueTraversal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Adds ourself to out parent's list of traversed children.
|
||||||
|
Call this for _every_ node which affects output during traversal.
|
||||||
|
Usually, this should be called from the postfix stage, but for some nodes, we defer traversal letting other components (e.g. CGAL) render the subgraph, and we'll then call this from prefix and prune further traversal.
|
||||||
|
*/
|
||||||
|
void CSGTreeEvaluator::addToParent(const State &state, const AbstractNode &node)
|
||||||
|
{
|
||||||
|
this->visitedchildren.erase(node.index());
|
||||||
|
if (state.parent()) {
|
||||||
|
this->visitedchildren[state.parent()->index()].push_back(&node);
|
||||||
|
}
|
||||||
|
}
|
||||||
60
src/CSGTreeEvaluator.h
Normal file
60
src/CSGTreeEvaluator.h
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstddef>
|
||||||
|
#include "visitor.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "csgnode.h"
|
||||||
|
|
||||||
|
class CSGTreeEvaluator : public Visitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSGTreeEvaluator(const class Tree &tree, class GeometryEvaluator *geomevaluator = NULL)
|
||||||
|
: tree(tree), geomevaluator(geomevaluator) {
|
||||||
|
}
|
||||||
|
virtual ~CSGTreeEvaluator() {}
|
||||||
|
|
||||||
|
virtual Response visit(State &state, const class AbstractNode &node);
|
||||||
|
virtual Response visit(State &state, const class AbstractIntersectionNode &node);
|
||||||
|
virtual Response visit(State &state, const class AbstractPolyNode &node);
|
||||||
|
virtual Response visit(State &state, const class CsgOpNode &node);
|
||||||
|
virtual Response visit(State &state, const class TransformNode &node);
|
||||||
|
virtual Response visit(State &state, const class ColorNode &node);
|
||||||
|
virtual Response visit(State &state, const class RenderNode &node);
|
||||||
|
virtual Response visit(State &state, const class CgaladvNode &node);
|
||||||
|
|
||||||
|
shared_ptr<class CSGNode> buildCSGTree(const AbstractNode &node);
|
||||||
|
|
||||||
|
const shared_ptr<CSGNode> &getRootNode() const {
|
||||||
|
return this->rootNode;
|
||||||
|
}
|
||||||
|
const std::vector<shared_ptr<CSGNode>> &getHighlightNodes() const {
|
||||||
|
return this->highlightNodes;
|
||||||
|
}
|
||||||
|
const std::vector<shared_ptr<CSGNode>> &getBackgroundNodes() const {
|
||||||
|
return this->backgroundNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void addToParent(const State &state, const AbstractNode &node);
|
||||||
|
void applyToChildren(State &state, const AbstractNode &node, OpenSCADOperator op);
|
||||||
|
shared_ptr<CSGNode> evaluateCSGNodeFromGeometry(State &state,
|
||||||
|
const shared_ptr<const class Geometry> &geom,
|
||||||
|
const class ModuleInstantiation *modinst,
|
||||||
|
const AbstractNode &node);
|
||||||
|
void applyBackgroundAndHighlight(State &state, const AbstractNode &node);
|
||||||
|
|
||||||
|
const AbstractNode *root;
|
||||||
|
typedef std::list<const AbstractNode *> ChildList;
|
||||||
|
std::map<int, ChildList> visitedchildren;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const Tree &tree;
|
||||||
|
class GeometryEvaluator *geomevaluator;
|
||||||
|
shared_ptr<CSGNode> rootNode;
|
||||||
|
std::vector<shared_ptr<CSGNode>> highlightNodes;
|
||||||
|
std::vector<shared_ptr<CSGNode>> backgroundNodes;
|
||||||
|
std::map<int, shared_ptr<CSGNode>> stored_term; // The term evaluated from each node index
|
||||||
|
};
|
||||||
235
src/CSGTreeNormalizer.cc
Normal file
235
src/CSGTreeNormalizer.cc
Normal file
|
|
@ -0,0 +1,235 @@
|
||||||
|
#include "CSGTreeNormalizer.h"
|
||||||
|
#include "csgnode.h"
|
||||||
|
#include "printutils.h"
|
||||||
|
|
||||||
|
// Helper function to debug normalization bugs
|
||||||
|
#if 0
|
||||||
|
static bool validate_tree(const shared_ptr<CSGNode> &node)
|
||||||
|
{
|
||||||
|
if (node->getType() == OPENSCAD_PRIMITIVE) return true;
|
||||||
|
if (!node->left() || !node->right()) return false;
|
||||||
|
if (!validate_tree(node->left())) return false;
|
||||||
|
if (!validate_tree(node->right())) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*!
|
||||||
|
NB! for e.g. empty intersections, this can normalize a tree to nothing and return NULL.
|
||||||
|
*/
|
||||||
|
shared_ptr<CSGNode> CSGTreeNormalizer::normalize(const shared_ptr<CSGNode> &root)
|
||||||
|
{
|
||||||
|
this->aborted = false;
|
||||||
|
shared_ptr<CSGNode> temp = root;
|
||||||
|
while (1) {
|
||||||
|
this->rootnode = temp;
|
||||||
|
this->nodecount = 0;
|
||||||
|
shared_ptr<CSGNode> n = normalizePass(temp);
|
||||||
|
if (!n) return n; // If normalized to nothing
|
||||||
|
if (temp == n) break;
|
||||||
|
temp = n;
|
||||||
|
|
||||||
|
if (this->nodecount > this->limit) {
|
||||||
|
PRINTB("WARNING: Normalized tree is growing past %d elements. Aborting normalization.\n", this->limit);
|
||||||
|
// Clean up any partially evaluated nodes
|
||||||
|
shared_ptr<CSGNode> newroot = root, tmproot;
|
||||||
|
while (newroot && newroot != tmproot) {
|
||||||
|
tmproot = newroot;
|
||||||
|
newroot = collapse_null_terms(tmproot);
|
||||||
|
}
|
||||||
|
newroot = cleanup_term(newroot);
|
||||||
|
return newroot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->rootnode.reset();
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
After aborting, a subtree might have become invalidated (NULL child node)
|
||||||
|
since terms can be instantiated multiple times.
|
||||||
|
This will search for NULL children an recursively repair the corresponding
|
||||||
|
subtree.
|
||||||
|
*/
|
||||||
|
shared_ptr<CSGNode> CSGTreeNormalizer::cleanup_term(shared_ptr<CSGNode> &t)
|
||||||
|
{
|
||||||
|
if (shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(t)) {
|
||||||
|
if (op->left()) op->left() = cleanup_term(op->left());
|
||||||
|
if (op->right()) op->right() = cleanup_term(op->right());
|
||||||
|
return collapse_null_terms(op);
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isUnion(shared_ptr<CSGNode> node) {
|
||||||
|
shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(node);
|
||||||
|
return op && op->getType() == OPENSCAD_UNION;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool hasRightLeaf(shared_ptr<CSGNode> node) {
|
||||||
|
shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(node);
|
||||||
|
return op && dynamic_pointer_cast<CSGLeaf>(op->right());
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool hasLeftUnion(shared_ptr<CSGNode> node) {
|
||||||
|
shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(node);
|
||||||
|
return op && isUnion(op->left());
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<CSGNode> CSGTreeNormalizer::normalizePass(shared_ptr<CSGNode> node)
|
||||||
|
{
|
||||||
|
// This function implements the CSG normalization
|
||||||
|
// Reference:
|
||||||
|
// Goldfeather, J., Molnar, S., Turk, G., and Fuchs, H. Near
|
||||||
|
// Realtime CSG Rendering Using Tree Normalization and Geometric
|
||||||
|
// Pruning. IEEE Computer Graphics and Applications, 9(3):20-28,
|
||||||
|
// 1989.
|
||||||
|
// http://www.cc.gatech.edu/~turk/my_papers/pxpl_csg.pdf
|
||||||
|
|
||||||
|
if (dynamic_pointer_cast<CSGLeaf>(node)) return node;
|
||||||
|
|
||||||
|
do {
|
||||||
|
while (node && match_and_replace(node)) { }
|
||||||
|
this->nodecount++;
|
||||||
|
if (nodecount > this->limit) {
|
||||||
|
PRINTB("WARNING: Normalized tree is growing past %d elements. Aborting normalization.\n", this->limit);
|
||||||
|
this->aborted = true;
|
||||||
|
return shared_ptr<CSGNode>();
|
||||||
|
}
|
||||||
|
if (!node) return node;
|
||||||
|
if (shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(node)) {
|
||||||
|
op->left() = normalizePass(op->left());
|
||||||
|
}
|
||||||
|
} while (!this->aborted && !isUnion(node) &&
|
||||||
|
(!hasRightLeaf(node) ||
|
||||||
|
hasLeftUnion(node)));
|
||||||
|
if (!this->aborted) {
|
||||||
|
shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(node);
|
||||||
|
assert(op);
|
||||||
|
op->right() = normalizePass(op->right());
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: Do we need to take into account any transformation of item here?
|
||||||
|
shared_ptr<CSGNode> t = collapse_null_terms(node);
|
||||||
|
|
||||||
|
if (this->aborted) {
|
||||||
|
if (t) t = cleanup_term(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<CSGNode> CSGTreeNormalizer::collapse_null_terms(const shared_ptr<CSGNode> &node)
|
||||||
|
{
|
||||||
|
shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(node);
|
||||||
|
if (op) {
|
||||||
|
if (!op->right()) {
|
||||||
|
if (op->getType() == OPENSCAD_UNION || op->getType() == OPENSCAD_DIFFERENCE) return op->left();
|
||||||
|
else return op->right();
|
||||||
|
}
|
||||||
|
if (!op->left()) {
|
||||||
|
if (op->getType() == OPENSCAD_UNION) return op->right();
|
||||||
|
else return op->left();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSGTreeNormalizer::match_and_replace(shared_ptr<CSGNode> &node)
|
||||||
|
{
|
||||||
|
shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(node);
|
||||||
|
if (!op) return false;
|
||||||
|
if (op->getType() == OPENSCAD_UNION) return false;
|
||||||
|
|
||||||
|
// Part A: The 'x . (y . z)' expressions
|
||||||
|
|
||||||
|
shared_ptr<CSGOperation> rightop = dynamic_pointer_cast<CSGOperation>(op->right());
|
||||||
|
if (rightop) {
|
||||||
|
shared_ptr<CSGNode> x = op->left();
|
||||||
|
shared_ptr<CSGNode> y = rightop->left();
|
||||||
|
shared_ptr<CSGNode> z = rightop->right();
|
||||||
|
|
||||||
|
// 1. x - (y + z) -> (x - y) - z
|
||||||
|
if (op->getType() == OPENSCAD_DIFFERENCE && rightop->getType() == OPENSCAD_UNION) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE, x, y),
|
||||||
|
z);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 2. x * (y + z) -> (x * y) + (x * z)
|
||||||
|
else if (op->getType() == OPENSCAD_INTERSECTION && rightop->getType() == OPENSCAD_UNION) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_UNION,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_INTERSECTION, x, y),
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_INTERSECTION, x, z));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 3. x - (y * z) -> (x - y) + (x - z)
|
||||||
|
else if (op->getType() == OPENSCAD_DIFFERENCE && rightop->getType() == OPENSCAD_INTERSECTION) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_UNION,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE, x, y),
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE, x, z));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 4. x * (y * z) -> (x * y) * z
|
||||||
|
else if (op->getType() == OPENSCAD_INTERSECTION && rightop->getType() == OPENSCAD_INTERSECTION) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_INTERSECTION,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_INTERSECTION, x, y),
|
||||||
|
z);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 5. x - (y - z) -> (x - y) + (x * z)
|
||||||
|
else if (op->getType() == OPENSCAD_DIFFERENCE && rightop->getType() == OPENSCAD_DIFFERENCE) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_UNION,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE, x, y),
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_INTERSECTION, x, z));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 6. x * (y - z) -> (x * y) - z
|
||||||
|
else if (op->getType() == OPENSCAD_INTERSECTION && rightop->getType() == OPENSCAD_DIFFERENCE) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_INTERSECTION, x, y),
|
||||||
|
z);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_ptr<CSGOperation> leftop = dynamic_pointer_cast<CSGOperation>(op->left());
|
||||||
|
if (leftop) {
|
||||||
|
// Part B: The '(x . y) . z' expressions
|
||||||
|
shared_ptr<CSGNode> x = leftop->left();
|
||||||
|
shared_ptr<CSGNode> y = leftop->right();
|
||||||
|
shared_ptr<CSGNode> z = op->right();
|
||||||
|
|
||||||
|
// 7. (x - y) * z -> (x * z) - y
|
||||||
|
if (leftop->getType() == OPENSCAD_DIFFERENCE && op->getType() == OPENSCAD_INTERSECTION) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_INTERSECTION, x, z),
|
||||||
|
y);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 8. (x + y) - z -> (x - z) + (y - z)
|
||||||
|
else if (leftop->getType() == OPENSCAD_UNION && op->getType() == OPENSCAD_DIFFERENCE) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_UNION,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE, x, z),
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_DIFFERENCE, y, z));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 9. (x + y) * z -> (x * z) + (y * z)
|
||||||
|
else if (leftop->getType() == OPENSCAD_UNION && op->getType() == OPENSCAD_INTERSECTION) {
|
||||||
|
node = CSGOperation::createCSGNode(OPENSCAD_UNION,
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_INTERSECTION, x, z),
|
||||||
|
CSGOperation::createCSGNode(OPENSCAD_INTERSECTION, y, z));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counts all non-leaf nodes
|
||||||
|
unsigned int CSGTreeNormalizer::count(const shared_ptr<CSGNode> &node) const
|
||||||
|
{
|
||||||
|
if (shared_ptr<CSGOperation> op = dynamic_pointer_cast<CSGOperation>(node)) {
|
||||||
|
return 1 + count(op->left()) + count(op->right());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
24
src/CSGTreeNormalizer.h
Normal file
24
src/CSGTreeNormalizer.h
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "memory.h"
|
||||||
|
|
||||||
|
class CSGTreeNormalizer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSGTreeNormalizer(size_t limit) : limit(limit) {}
|
||||||
|
~CSGTreeNormalizer() {}
|
||||||
|
|
||||||
|
shared_ptr<class CSGNode> normalize(const shared_ptr<CSGNode> &term);
|
||||||
|
|
||||||
|
private:
|
||||||
|
shared_ptr<CSGNode> normalizePass(shared_ptr<CSGNode> term) ;
|
||||||
|
bool match_and_replace(shared_ptr<class CSGNode> &term);
|
||||||
|
shared_ptr<CSGNode> collapse_null_terms(const shared_ptr<CSGNode> &term);
|
||||||
|
shared_ptr<CSGNode> cleanup_term(shared_ptr<CSGNode> &t);
|
||||||
|
unsigned int count(const shared_ptr<CSGNode> &term) const;
|
||||||
|
|
||||||
|
bool aborted;
|
||||||
|
size_t limit;
|
||||||
|
size_t nodecount;
|
||||||
|
shared_ptr<class CSGNode> rootnode;
|
||||||
|
};
|
||||||
|
|
@ -6,15 +6,17 @@ Camera::Camera(enum CameraType camtype) :
|
||||||
type(camtype), projection(Camera::PERSPECTIVE), fov(22.5), viewall(false)
|
type(camtype), projection(Camera::PERSPECTIVE), fov(22.5), viewall(false)
|
||||||
{
|
{
|
||||||
PRINTD("Camera()");
|
PRINTD("Camera()");
|
||||||
if (this->type == Camera::GIMBAL) {
|
|
||||||
|
// gimbal cam values
|
||||||
object_trans << 0,0,0;
|
object_trans << 0,0,0;
|
||||||
object_rot << 35,0,25;
|
object_rot << 35,0,25;
|
||||||
viewer_distance = 500;
|
viewer_distance = 500;
|
||||||
} else if (this->type == Camera::VECTOR) {
|
|
||||||
|
// vector cam values
|
||||||
center << 0,0,0;
|
center << 0,0,0;
|
||||||
Eigen::Vector3d cameradir(1, 1, -0.5);
|
Eigen::Vector3d cameradir(1, 1, -0.5);
|
||||||
eye = center - 500 * cameradir;
|
eye = center - 500 * cameradir;
|
||||||
}
|
|
||||||
pixel_width = RenderSettings::inst()->img_width;
|
pixel_width = RenderSettings::inst()->img_width;
|
||||||
pixel_height = RenderSettings::inst()->img_height;
|
pixel_height = RenderSettings::inst()->img_height;
|
||||||
autocenter = false;
|
autocenter = false;
|
||||||
|
|
|
||||||
|
|
@ -1,77 +1,62 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "OffscreenView.h"
|
#include "csgnode.h"
|
||||||
#include "csgterm.h"
|
|
||||||
#include "Tree.h"
|
#include "Tree.h"
|
||||||
#include "GeometryEvaluator.h"
|
#include "GeometryEvaluator.h"
|
||||||
#include "CSGTermEvaluator.h"
|
#include "CSGTreeEvaluator.h"
|
||||||
#include "csgtermnormalizer.h"
|
#include "CSGTreeNormalizer.h"
|
||||||
#include "rendersettings.h"
|
#include "rendersettings.h"
|
||||||
#include "printutils.h"
|
#include "printutils.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Small helper class for compiling and normalizing node trees into CSG products
|
||||||
|
*/
|
||||||
class CsgInfo
|
class CsgInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CsgInfo() : glview(NULL), root_chain(NULL), highlights_chain(NULL), background_chain(NULL), progress_function(NULL)
|
CsgInfo() {}
|
||||||
{
|
shared_ptr<class CSGProducts> root_products;
|
||||||
normalizelimit = RenderSettings::inst()->openCSGTermLimit;
|
shared_ptr<CSGProducts> highlights_products;
|
||||||
}
|
shared_ptr<CSGProducts> background_products;
|
||||||
OffscreenView *glview;
|
|
||||||
shared_ptr<CSGTerm> root_norm_term; // Normalized CSG products
|
|
||||||
class CSGChain *root_chain;
|
|
||||||
std::vector<shared_ptr<CSGTerm> > highlight_terms;
|
|
||||||
CSGChain *highlights_chain;
|
|
||||||
std::vector<shared_ptr<CSGTerm> > background_terms;
|
|
||||||
CSGChain *background_chain;
|
|
||||||
int normalizelimit;
|
|
||||||
|
|
||||||
void (*progress_function)();
|
bool compile_products(const Tree &tree) {
|
||||||
void call_progress_function()
|
|
||||||
{
|
|
||||||
if (progress_function) progress_function();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool compile_chains( const Tree &tree )
|
|
||||||
{
|
|
||||||
const AbstractNode *root_node = tree.root();
|
const AbstractNode *root_node = tree.root();
|
||||||
GeometryEvaluator geomevaluator(tree);
|
GeometryEvaluator geomevaluator(tree);
|
||||||
CSGTermEvaluator evaluator(tree, &geomevaluator);
|
CSGTreeEvaluator evaluator(tree, &geomevaluator);
|
||||||
boost::shared_ptr<CSGTerm> root_raw_term = evaluator.evaluateCSGTerm( *root_node, this->highlight_terms, this->background_terms );
|
shared_ptr<CSGNode> csgRoot = evaluator.buildCSGTree(*root_node);
|
||||||
|
std::vector<shared_ptr<CSGNode> > highlightNodes = evaluator.getHighlightNodes();
|
||||||
|
std::vector<shared_ptr<CSGNode> > backgroundNodes = evaluator.getBackgroundNodes();
|
||||||
|
|
||||||
PRINT("Compiling design (CSG Products normalization)...");
|
PRINT("Compiling design (CSG Products normalization)...");
|
||||||
call_progress_function();
|
CSGTreeNormalizer normalizer(RenderSettings::inst()->openCSGTermLimit);
|
||||||
CSGTermNormalizer normalizer( normalizelimit );
|
if (csgRoot) {
|
||||||
if (root_raw_term) {
|
shared_ptr<CSGNode> normalizedRoot = normalizer.normalize(csgRoot);
|
||||||
this->root_norm_term = normalizer.normalize(root_raw_term);
|
if (normalizedRoot) {
|
||||||
if (this->root_norm_term) {
|
this->root_products.reset(new CSGProducts());
|
||||||
this->root_chain = new CSGChain();
|
this->root_products->import(normalizedRoot);
|
||||||
this->root_chain->import(this->root_norm_term);
|
PRINTB("Normalized CSG tree has %d elements", int(this->root_products->size()));
|
||||||
PRINTB("Normalized CSG tree has %d elements", int(this->root_chain->objects.size()));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->root_chain = NULL;
|
this->root_products.reset();
|
||||||
PRINT("WARNING: CSG normalization resulted in an empty tree");
|
PRINT("WARNING: CSG normalization resulted in an empty tree");
|
||||||
call_progress_function();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->highlight_terms.size() > 0) {
|
if (highlightNodes.size() > 0) {
|
||||||
PRINTB("Compiling highlights (%i CSG Trees)...", this->highlight_terms.size() );
|
PRINTB("Compiling highlights (%i CSG Trees)...", highlightNodes.size() );
|
||||||
call_progress_function();
|
this->highlights_products.reset(new CSGProducts());
|
||||||
this->highlights_chain = new CSGChain();
|
for (unsigned int i = 0; i < highlightNodes.size(); i++) {
|
||||||
for (unsigned int i = 0; i < this->highlight_terms.size(); i++) {
|
highlightNodes[i] = normalizer.normalize(highlightNodes[i]);
|
||||||
this->highlight_terms[i] = normalizer.normalize(this->highlight_terms[i]);
|
this->highlights_products->import(highlightNodes[i]);
|
||||||
this->highlights_chain->import(this->highlight_terms[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->background_terms.size() > 0) {
|
if (backgroundNodes.size() > 0) {
|
||||||
PRINTB("Compiling background (%i CSG Trees)...", this->background_terms.size());
|
PRINTB("Compiling background (%i CSG Trees)...", backgroundNodes.size());
|
||||||
call_progress_function();
|
this->background_products.reset(new CSGProducts());
|
||||||
this->background_chain = new CSGChain();
|
for (unsigned int i = 0; i < backgroundNodes.size(); i++) {
|
||||||
for (unsigned int i = 0; i < this->background_terms.size(); i++) {
|
backgroundNodes[i] = normalizer.normalize(backgroundNodes[i]);
|
||||||
this->background_terms[i] = normalizer.normalize(this->background_terms[i]);
|
this->background_products->import(backgroundNodes[i]);
|
||||||
this->background_chain->import(this->background_terms[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@
|
||||||
#include "Polygon2d.h"
|
#include "Polygon2d.h"
|
||||||
#include "DrawingCallback.h"
|
#include "DrawingCallback.h"
|
||||||
|
|
||||||
DrawingCallback::DrawingCallback(unsigned long fn) : fn(fn),
|
DrawingCallback::DrawingCallback(unsigned long fn) :
|
||||||
pen(Vector2d(0, 0)), offset(Vector2d(0, 0)), advance(Vector2d(0, 0))
|
pen(Vector2d(0, 0)), offset(Vector2d(0, 0)), advance(Vector2d(0, 0)), fn(fn)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,12 +74,12 @@ void DrawingCallback::add_glyph_advance(double advance_x, double advance_y)
|
||||||
advance += Vector2d(advance_x, advance_y);
|
advance += Vector2d(advance_x, advance_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingCallback::add_vertex(Vector2d v)
|
void DrawingCallback::add_vertex(const Vector2d &v)
|
||||||
{
|
{
|
||||||
this->outline.vertices.push_back(v + offset + advance);
|
this->outline.vertices.push_back(v + offset + advance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingCallback::move_to(Vector2d to)
|
void DrawingCallback::move_to(const Vector2d &to)
|
||||||
{
|
{
|
||||||
if (this->outline.vertices.size() > 0) {
|
if (this->outline.vertices.size() > 0) {
|
||||||
this->polygon->addOutline(this->outline);
|
this->polygon->addOutline(this->outline);
|
||||||
|
|
@ -89,14 +89,14 @@ void DrawingCallback::move_to(Vector2d to)
|
||||||
pen = to;
|
pen = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingCallback::line_to(Vector2d to)
|
void DrawingCallback::line_to(const Vector2d &to)
|
||||||
{
|
{
|
||||||
add_vertex(to);
|
add_vertex(to);
|
||||||
pen = to;
|
pen = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quadric Bezier curve
|
// Quadric Bezier curve
|
||||||
void DrawingCallback::curve_to(Vector2d c1, Vector2d to)
|
void DrawingCallback::curve_to(const Vector2d &c1, const Vector2d &to)
|
||||||
{
|
{
|
||||||
for (unsigned long idx = 1;idx <= fn;idx++) {
|
for (unsigned long idx = 1;idx <= fn;idx++) {
|
||||||
const double a = idx * (1.0 / (double)fn);
|
const double a = idx * (1.0 / (double)fn);
|
||||||
|
|
@ -108,7 +108,7 @@ void DrawingCallback::curve_to(Vector2d c1, Vector2d to)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cubic Bezier curve
|
// Cubic Bezier curve
|
||||||
void DrawingCallback::curve_to(Vector2d c1, Vector2d c2, Vector2d to)
|
void DrawingCallback::curve_to(const Vector2d &c1, const Vector2d &c2, const Vector2d &to)
|
||||||
{
|
{
|
||||||
for (unsigned long idx = 1;idx <= fn;idx++) {
|
for (unsigned long idx = 1;idx <= fn;idx++) {
|
||||||
const double a = idx * (1.0 / (double)fn);
|
const double a = idx * (1.0 / (double)fn);
|
||||||
|
|
|
||||||
|
|
@ -41,19 +41,19 @@ public:
|
||||||
void add_glyph_advance(double advance_x, double advance_y);
|
void add_glyph_advance(double advance_x, double advance_y);
|
||||||
std::vector<const Geometry *> get_result();
|
std::vector<const Geometry *> get_result();
|
||||||
|
|
||||||
void move_to(Vector2d to);
|
void move_to(const Vector2d &to);
|
||||||
void line_to(Vector2d to);
|
void line_to(const Vector2d &to);
|
||||||
void curve_to(Vector2d c1, Vector2d to);
|
void curve_to(const Vector2d &c1, const Vector2d &to);
|
||||||
void curve_to(Vector2d c1, Vector2d c2, Vector2d to);
|
void curve_to(const Vector2d &c1, const Vector2d &c2, const Vector2d &to);
|
||||||
private:
|
private:
|
||||||
unsigned long fn;
|
|
||||||
Vector2d pen;
|
Vector2d pen;
|
||||||
Vector2d offset;
|
Vector2d offset;
|
||||||
Vector2d advance;
|
Vector2d advance;
|
||||||
|
unsigned long fn;
|
||||||
|
|
||||||
Outline2d outline;
|
Outline2d outline;
|
||||||
class Polygon2d *polygon;
|
class Polygon2d *polygon;
|
||||||
std::vector<const class Geometry *> polygons;
|
std::vector<const class Geometry *> polygons;
|
||||||
|
|
||||||
void add_vertex(Vector2d v);
|
void add_vertex(const Vector2d &v);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QFileOpenEvent>
|
#include <QFileOpenEvent>
|
||||||
#include "MainWindow.h"
|
#include "OpenSCADApp.h"
|
||||||
#include "launchingscreen.h"
|
#include "launchingscreen.h"
|
||||||
|
|
||||||
class EventFilter : public QObject
|
class EventFilter : public QObject
|
||||||
|
|
@ -24,7 +24,7 @@ protected:
|
||||||
Q_ARG(QString, filename));
|
Q_ARG(QString, filename));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MainWindow::requestOpenFile(filename);
|
scadApp->requestOpenFile(filename);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@
|
||||||
|
|
||||||
#include FT_OUTLINE_H
|
#include FT_OUTLINE_H
|
||||||
|
|
||||||
|
#define SCRIPT_UNTAG(tag) ((uint8_t)((tag)>>24)) % ((uint8_t)((tag)>>16)) % ((uint8_t)((tag)>>8)) % ((uint8_t)(tag))
|
||||||
|
|
||||||
static inline Vector2d get_scaled_vector(const FT_Vector *ft_vector, double scale) {
|
static inline Vector2d get_scaled_vector(const FT_Vector *ft_vector, double scale) {
|
||||||
return Vector2d(ft_vector->x / scale, ft_vector->y / scale);
|
return Vector2d(ft_vector->x / scale, ft_vector->y / scale);
|
||||||
}
|
}
|
||||||
|
|
@ -122,6 +124,75 @@ double FreetypeRenderer::calc_y_offset(std::string valign, double ascend, double
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hb_direction_t FreetypeRenderer::get_direction(const FreetypeRenderer::Params ¶ms, const hb_script_t script) const
|
||||||
|
{
|
||||||
|
hb_direction_t param_direction = hb_direction_from_string(params.direction.c_str(), -1);
|
||||||
|
if (param_direction != HB_DIRECTION_INVALID) {
|
||||||
|
return param_direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_direction_t direction = hb_script_get_horizontal_direction(script);
|
||||||
|
PRINTDB("Detected direction '%s' for %s", hb_direction_to_string(direction) % params.text.c_str());
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FreetypeRenderer::is_ignored_script(const hb_script_t script) const
|
||||||
|
{
|
||||||
|
switch (script) {
|
||||||
|
case HB_SCRIPT_COMMON:
|
||||||
|
case HB_SCRIPT_INHERITED:
|
||||||
|
case HB_SCRIPT_UNKNOWN:
|
||||||
|
case HB_SCRIPT_INVALID:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_script_t FreetypeRenderer::get_script(const FreetypeRenderer::Params ¶ms, hb_glyph_info_t *glyph_info, unsigned int glyph_count) const
|
||||||
|
{
|
||||||
|
hb_script_t param_script = hb_script_from_string(params.script.c_str(), -1);
|
||||||
|
if (param_script != HB_SCRIPT_INVALID) {
|
||||||
|
return param_script;
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_script_t script = HB_SCRIPT_INVALID;
|
||||||
|
for (unsigned int idx = 0;idx < glyph_count;idx++) {
|
||||||
|
hb_codepoint_t cp = glyph_info[idx].codepoint;
|
||||||
|
hb_script_t s = hb_unicode_script(hb_unicode_funcs_get_default(), cp);
|
||||||
|
if (!is_ignored_script(s)) {
|
||||||
|
if (script == HB_SCRIPT_INVALID) {
|
||||||
|
script = s;
|
||||||
|
} else if ((script != s) && (script != HB_SCRIPT_UNKNOWN)) {
|
||||||
|
script = HB_SCRIPT_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PRINTDB("Detected script '%c%c%c%c' for %s", SCRIPT_UNTAG(script) % params.text.c_str());
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreetypeRenderer::detect_properties(FreetypeRenderer::Params ¶ms) const
|
||||||
|
{
|
||||||
|
hb_buffer_t *hb_buf = hb_buffer_create();
|
||||||
|
hb_buffer_add_utf8(hb_buf, params.text.c_str(), strlen(params.text.c_str()), 0, strlen(params.text.c_str()));
|
||||||
|
|
||||||
|
unsigned int glyph_count;
|
||||||
|
hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(hb_buf, &glyph_count);
|
||||||
|
|
||||||
|
hb_script_t script = get_script(params, glyph_info, glyph_count);
|
||||||
|
hb_buffer_destroy(hb_buf);
|
||||||
|
|
||||||
|
if (!is_ignored_script(script)) {
|
||||||
|
char script_buf[5] = { 0, };
|
||||||
|
hb_tag_to_string(hb_script_to_iso15924_tag(script), script_buf);
|
||||||
|
params.set_script(script_buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
hb_direction_t direction = get_direction(params, script);
|
||||||
|
params.set_direction(hb_direction_to_string(direction));
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<const Geometry *> FreetypeRenderer::render(const FreetypeRenderer::Params ¶ms) const
|
std::vector<const Geometry *> FreetypeRenderer::render(const FreetypeRenderer::Params ¶ms) const
|
||||||
{
|
{
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ public:
|
||||||
<< ", font = \"" << params.font
|
<< ", font = \"" << params.font
|
||||||
<< "\", direction = \"" << params.direction
|
<< "\", direction = \"" << params.direction
|
||||||
<< "\", language = \"" << params.language
|
<< "\", language = \"" << params.language
|
||||||
<< "\", script = \"" << params.script
|
<< (params.script.empty() ? "" : "\", script = \"") << params.script
|
||||||
<< "\", halign = \"" << params.halign
|
<< "\", halign = \"" << params.halign
|
||||||
<< "\", valign = \"" << params.valign
|
<< "\", valign = \"" << params.valign
|
||||||
<< "\", $fn = " << params.fn
|
<< "\", $fn = " << params.fn
|
||||||
|
|
@ -102,6 +102,7 @@ public:
|
||||||
FreetypeRenderer();
|
FreetypeRenderer();
|
||||||
virtual ~FreetypeRenderer();
|
virtual ~FreetypeRenderer();
|
||||||
|
|
||||||
|
void detect_properties(FreetypeRenderer::Params ¶ms) const;
|
||||||
std::vector<const class Geometry *> render(const FreetypeRenderer::Params ¶ms) const;
|
std::vector<const class Geometry *> render(const FreetypeRenderer::Params ¶ms) const;
|
||||||
private:
|
private:
|
||||||
const static double scale;
|
const static double scale;
|
||||||
|
|
@ -136,6 +137,10 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool is_ignored_script(const hb_script_t script) const;
|
||||||
|
hb_script_t get_script(const FreetypeRenderer::Params ¶ms, hb_glyph_info_t *glyph_info, unsigned int glyph_count) const;
|
||||||
|
hb_direction_t get_direction(const FreetypeRenderer::Params ¶ms, const hb_script_t script) const;
|
||||||
|
|
||||||
double calc_x_offset(std::string halign, double width) const;
|
double calc_x_offset(std::string halign, double width) const;
|
||||||
double calc_y_offset(std::string valign, double ascend, double descend) const;
|
double calc_y_offset(std::string valign, double ascend, double descend) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "colormap.h"
|
#include "colormap.h"
|
||||||
#include "rendersettings.h"
|
#include "rendersettings.h"
|
||||||
#include "mathc99.h"
|
|
||||||
#include "printutils.h"
|
#include "printutils.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <GL/wglew.h>
|
#include <GL/wglew.h>
|
||||||
|
|
@ -105,7 +105,7 @@ void GLView::setupCamera()
|
||||||
double height = dist * tan(cam.fov/2*M_PI/180);
|
double height = dist * tan(cam.fov/2*M_PI/180);
|
||||||
glOrtho(-height*aspectratio, height*aspectratio,
|
glOrtho(-height*aspectratio, height*aspectratio,
|
||||||
-height, height,
|
-height, height,
|
||||||
-far_far_away, +far_far_away);
|
-100*dist, +100*dist);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +130,7 @@ void GLView::setupCamera()
|
||||||
double height = dist * tan(cam.fov/2*M_PI/180);
|
double height = dist * tan(cam.fov/2*M_PI/180);
|
||||||
glOrtho(-height*aspectratio, height*aspectratio,
|
glOrtho(-height*aspectratio, height*aspectratio,
|
||||||
-height, height,
|
-height, height,
|
||||||
-far_far_away, +far_far_away);
|
-100*dist, +100*dist);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -158,20 +158,20 @@ void GLView::paintGL()
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
Color4f bgcol = ColorMap::getColor(*this->colorscheme, BACKGROUND_COLOR);
|
Color4f bgcol = ColorMap::getColor(*this->colorscheme, BACKGROUND_COLOR);
|
||||||
Color4f bgcontrast = ColorMap::getContrastColor(bgcol);
|
Color4f axescolor = ColorMap::getColor(*this->colorscheme, AXES_COLOR);
|
||||||
glClearColor(bgcol[0], bgcol[1], bgcol[2], 1.0);
|
glClearColor(bgcol[0], bgcol[1], bgcol[2], 1.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
setupCamera();
|
setupCamera();
|
||||||
if (this->cam.type) {
|
if (this->cam.type == Camera::GIMBAL) {
|
||||||
// Only for GIMBAL cam
|
// Only for GIMBAL cam
|
||||||
// The crosshair should be fixed at the center of the viewport...
|
// The crosshair should be fixed at the center of the viewport...
|
||||||
if (showcrosshairs) GLView::showCrosshairs();
|
if (showcrosshairs) GLView::showCrosshairs();
|
||||||
glTranslated(cam.object_trans.x(), cam.object_trans.y(), cam.object_trans.z());
|
glTranslated(cam.object_trans.x(), cam.object_trans.y(), cam.object_trans.z());
|
||||||
// ...the axis lines need to follow the object translation.
|
// ...the axis lines need to follow the object translation.
|
||||||
if (showaxes) GLView::showAxes(bgcontrast);
|
if (showaxes) GLView::showAxes(axescolor);
|
||||||
// mark the scale along the axis lines
|
// mark the scale along the axis lines
|
||||||
if (showaxes && showscale) GLView::showScalemarkers(bgcontrast);
|
if (showaxes && showscale) GLView::showScalemarkers(axescolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
|
|
@ -191,7 +191,7 @@ void GLView::paintGL()
|
||||||
|
|
||||||
// Only for GIMBAL
|
// Only for GIMBAL
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
if (showaxes) GLView::showSmallaxes(bgcontrast);
|
if (showaxes) GLView::showSmallaxes(axescolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_OPENCSG
|
#ifdef ENABLE_OPENCSG
|
||||||
|
|
@ -216,7 +216,7 @@ void GLView::enable_opencsg_shaders()
|
||||||
else if (GLEW_EXT_framebuffer_object && GLEW_EXT_packed_depth_stencil) {
|
else if (GLEW_EXT_framebuffer_object && GLEW_EXT_packed_depth_stencil) {
|
||||||
this->is_opencsg_capable = true;
|
this->is_opencsg_capable = true;
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
else if (WGLEW_ARB_pbuffer && WGLEW_ARB_pixel_format) this->is_opencsg_capable = true;
|
else if (WGLEW_ARB_pbuffer && WGLEW_ARB_pixel_format) this->is_opencsg_capable = true;
|
||||||
#elif !defined(__APPLE__)
|
#elif !defined(__APPLE__)
|
||||||
else if (GLXEW_SGIX_pbuffer && GLXEW_SGIX_fbconfig) this->is_opencsg_capable = true;
|
else if (GLXEW_SGIX_pbuffer && GLXEW_SGIX_fbconfig) this->is_opencsg_capable = true;
|
||||||
|
|
@ -272,7 +272,7 @@ void GLView::enable_opencsg_shaders()
|
||||||
" vec3 normal, lightDir;\n"
|
" vec3 normal, lightDir;\n"
|
||||||
" normal = normalize(gl_NormalMatrix * gl_Normal);\n"
|
" normal = normalize(gl_NormalMatrix * gl_Normal);\n"
|
||||||
" lightDir = normalize(vec3(gl_LightSource[0].position));\n"
|
" lightDir = normalize(vec3(gl_LightSource[0].position));\n"
|
||||||
" shading = abs(dot(normal, lightDir));\n"
|
" shading = 0.2 + abs(dot(normal, lightDir));\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -419,15 +419,15 @@ void GLView::showSmallaxes(const Color4f &col)
|
||||||
|
|
||||||
GLdouble xlabel_x, xlabel_y, xlabel_z;
|
GLdouble xlabel_x, xlabel_y, xlabel_z;
|
||||||
gluProject(12*dpi, 0, 0, mat_model, mat_proj, viewport, &xlabel_x, &xlabel_y, &xlabel_z);
|
gluProject(12*dpi, 0, 0, mat_model, mat_proj, viewport, &xlabel_x, &xlabel_y, &xlabel_z);
|
||||||
xlabel_x = round(xlabel_x); xlabel_y = round(xlabel_y);
|
xlabel_x = std::round(xlabel_x); xlabel_y = std::round(xlabel_y);
|
||||||
|
|
||||||
GLdouble ylabel_x, ylabel_y, ylabel_z;
|
GLdouble ylabel_x, ylabel_y, ylabel_z;
|
||||||
gluProject(0, 12*dpi, 0, mat_model, mat_proj, viewport, &ylabel_x, &ylabel_y, &ylabel_z);
|
gluProject(0, 12*dpi, 0, mat_model, mat_proj, viewport, &ylabel_x, &ylabel_y, &ylabel_z);
|
||||||
ylabel_x = round(ylabel_x); ylabel_y = round(ylabel_y);
|
ylabel_x = std::round(ylabel_x); ylabel_y = std::round(ylabel_y);
|
||||||
|
|
||||||
GLdouble zlabel_x, zlabel_y, zlabel_z;
|
GLdouble zlabel_x, zlabel_y, zlabel_z;
|
||||||
gluProject(0, 0, 12*dpi, mat_model, mat_proj, viewport, &zlabel_x, &zlabel_y, &zlabel_z);
|
gluProject(0, 0, 12*dpi, mat_model, mat_proj, viewport, &zlabel_x, &zlabel_y, &zlabel_z);
|
||||||
zlabel_x = round(zlabel_x); zlabel_y = round(zlabel_y);
|
zlabel_x = std::round(zlabel_x); zlabel_y = std::round(zlabel_y);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,6 @@ Some actions (showCrossHairs) only work properly on Gimbal Camera.
|
||||||
#include <Eigen/Core>
|
#include <Eigen/Core>
|
||||||
#include <Eigen/Geometry>
|
#include <Eigen/Geometry>
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifndef _MSC_VER
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
#include "system-gl.h"
|
#include "system-gl.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
class Geometry
|
class Geometry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::pair<const class AbstractNode *, shared_ptr<const Geometry> > ChildItem;
|
typedef std::pair<const class AbstractNode *, shared_ptr<const Geometry>> GeometryItem;
|
||||||
typedef std::list<ChildItem> ChildList;
|
typedef std::list<GeometryItem> Geometries;
|
||||||
|
|
||||||
Geometry() : convexity(1) {}
|
Geometry() : convexity(1) {}
|
||||||
virtual ~Geometry() {}
|
virtual ~Geometry() {}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue