diff options
-rw-r--r-- | openscad.pro | 4 | ||||
-rw-r--r-- | src/export.cc | 15 | ||||
-rw-r--r-- | src/export_png.cc | 29 |
3 files changed, 33 insertions, 15 deletions
diff --git a/openscad.pro b/openscad.pro index 6a8cfdb..51f4439 100644 --- a/openscad.pro +++ b/openscad.pro @@ -236,7 +236,8 @@ HEADERS += src/version_check.h \ src/OffscreenView.h \ src/fbo.h \ src/imageutils.h \ - src/system-gl.h + src/system-gl.h \ + src/CsgInfo.h SOURCES += src/version_check.cc \ src/ProgressWidget.cc \ @@ -286,6 +287,7 @@ SOURCES += src/version_check.cc \ \ src/builtin.cc \ src/export.cc \ + src/export_png.cc \ src/import.cc \ src/renderer.cc \ src/ThrownTogetherRenderer.cc \ diff --git a/src/export.cc b/src/export.cc index 2d5f5a4..6ec28ef 100644 --- a/src/export.cc +++ b/src/export.cc @@ -195,20 +195,7 @@ void export_dxf(CGAL_Nef_polyhedron *root_N, std::ostream &output) setlocale(LC_NUMERIC, ""); // Set default locale } -void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, std::ostream &output) -{ - output << "solid OpenSCAD_Model\n"; - output << "endsolid OpenSCAD_Model\n"; -} - -void export_png_with_opencsg(CGAL_Nef_polyhedron *root_N, std::ostream &output) -{ - output << "solid OpenSCAD_Model opencsg\n"; - output << "endsolid OpenSCAD_Model opencsg\n"; -} - - -#endif +#endif // ENABLE_CGAL #ifdef DEBUG #include <boost/foreach.hpp> diff --git a/src/export_png.cc b/src/export_png.cc new file mode 100644 index 0000000..96e30fa --- /dev/null +++ b/src/export_png.cc @@ -0,0 +1,29 @@ +#include "export.h" +#include "printutils.h" +#include "OffscreenView.h" +#include "CsgInfo.h" +#include <stdio.h> + +#ifdef ENABLE_CGAL + +void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, std::ostream &output) +{ + CsgInfo csgInfo; + try { + csgInfo.glview = new OffscreenView(512,512); + } catch (int error) { + fprintf(stderr,"Can't create OpenGL OffscreenView. Code: %i.\n", error); + } + output << "solid OpenSCAD_Model\n"; + output << "endsolid OpenSCAD_Model\n"; +} + +void export_png_with_opencsg(CGAL_Nef_polyhedron *root_N, std::ostream &output) +{ + CsgInfo csgInfo; + output << "solid OpenSCAD_Model opencsg\n"; + output << "endsolid OpenSCAD_Model opencsg\n"; +} + + +#endif // ENABLE_CGAL |