summaryrefslogtreecommitdiff
path: root/src/export_png.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-03-03 15:22:36 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-03-03 15:22:36 (GMT)
commit0f6b76cf2125828ce11ec9f6f47cfc26860d3571 (patch)
tree62e30a3bbcacfcf1a22134f6ffad6aaefcc295b6 /src/export_png.cc
parenteb1f73de0393bd890c9648932ae2e04de2c65ba3 (diff)
move csg chain prep code to CsgInfo.h, move defaults to rendersettings.h
Diffstat (limited to 'src/export_png.cc')
-rw-r--r--src/export_png.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/export_png.cc b/src/export_png.cc
index 3e618e5..8a6dd1d 100644
--- a/src/export_png.cc
+++ b/src/export_png.cc
@@ -4,6 +4,7 @@
#include "CsgInfo.h"
#include <stdio.h>
#include "polyset.h"
+#include "rendersettings.h"
#ifdef ENABLE_CGAL
#include "CGALRenderer.h"
@@ -12,9 +13,11 @@
void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, Camera &cam, std::ostream &output)
{
- CsgInfo csgInfo;
+ OffscreenView *glview;
+ int w = RenderSettings::inst()->img_width;
+ int h = RenderSettings::inst()->img_height;
try {
- csgInfo.glview = new OffscreenView(512,512);
+ glview = new OffscreenView( w, h );
} catch (int error) {
fprintf(stderr,"Can't create OpenGL OffscreenView. Code: %i.\n", error);
return;
@@ -44,10 +47,10 @@ void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, Camera &cam, std::ostream
//std::cerr << center << "\n";
//std::cerr << radius << "\n";
- csgInfo.glview->setCamera( cam );
- csgInfo.glview->setRenderer(&cgalRenderer);
- csgInfo.glview->paintGL();
- csgInfo.glview->save(output);
+ glview->setCamera( cam );
+ glview->setRenderer(&cgalRenderer);
+ glview->paintGL();
+ glview->save(output);
}
#ifdef ENABLE_OPENCSG
@@ -58,16 +61,16 @@ void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, Camera &cam, std::ostream
void export_png_with_opencsg(Tree &tree, Camera &cam, std::ostream &output)
{
#ifdef ENABLE_OPENCSG
- CsgInfo_OpenCSG csgInfo = CsgInfo_OpenCSG();
- AbstractNode const *root_node = tree.root();
- int result = opencsg_prep( tree, root_node, csgInfo );
- if ( result == 1 ) {
+ CsgInfo csgInfo = CsgInfo();
+ if ( !csgInfo.prep_chains( tree ) ) {
+ fprintf(stderr,"Couldn't initialize OpenCSG chains\n");
return;
- fprintf(stderr,"Couldn't init OpenCSG chainsn");
}
+ int w = RenderSettings::inst()->img_width;
+ int h = RenderSettings::inst()->img_height;
try {
- csgInfo.glview = new OffscreenView(512,512);
+ csgInfo.glview = new OffscreenView( w, h );
} catch (int error) {
fprintf(stderr,"Can't create OpenGL OffscreenView. Code: %i.\n", error);
return;
contact: Jan Huwald // Impressum