diff options
author | Marius Kintel <marius@kintel.net> | 2013-09-13 05:06:17 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-09-13 05:06:17 (GMT) |
commit | ead8749e99238c18a3d7bb903f98bb7bca6a7685 (patch) | |
tree | baa054dc0bd236e11a0ad29c41f092193a52245d /src/openscad.cc | |
parent | 233406230281d8fefe24902fea52d916dfb3d88e (diff) | |
parent | f82ff8272b9698e7c572d6c67a5b69bf26896933 (diff) |
Merge pull request #476 from openscad/testfixes
Testfixes
Diffstat (limited to 'src/openscad.cc')
-rw-r--r-- | src/openscad.cc | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/openscad.cc b/src/openscad.cc index 2fe5cde..fb5ee44 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -37,6 +37,7 @@ #include "handle_dep.h" #include "parsersettings.h" #include "rendersettings.h" +#include "PlatformUtils.h" #include <string> #include <vector> @@ -50,6 +51,7 @@ #include "csgterm.h" #include "CSGTermEvaluator.h" +#include "CsgInfo.h" #include <QApplication> #include <QString> @@ -82,12 +84,13 @@ static void help(const char *progname) { int tab = int(strlen(progname))+8; fprintf(stderr,"Usage: %s [ -o output_file [ -d deps_file ] ]\\\n" - "%*s[ -m make_command ] [ -D var=val [..] ] [ --render ] \\\n" + "%*s[ -m make_command ] [ -D var=val [..] ] \\\n" "%*s[ --camera=translatex,y,z,rotx,y,z,dist | \\\n" "%*s --camera=eyex,y,z,centerx,y,z ] \\\n" "%*s[ --imgsize=width,height ] [ --projection=(o)rtho|(p)ersp] \\\n" + "%*s[ --render | --preview[=throwntogether] ] \\\n" "%*sfilename\n", - progname, tab, "", tab, "", tab, "", tab, "", tab, ""); + progname, tab, "", tab, "", tab, "", tab, "", tab, "", tab, ""); exit(1); } @@ -99,6 +102,23 @@ static void version() exit(1); } +static void info() +{ + std::cout << PlatformUtils::info() << "\n\n"; + + CsgInfo csgInfo = CsgInfo(); + try { + csgInfo.glview = new OffscreenView(512,512); + } catch (int error) { + fprintf(stderr,"Can't create OpenGL OffscreenView. Code: %i. Exiting.\n", error); + exit(1); + } + + std::cout << csgInfo.glview->getRendererInfo() << "\n"; + + exit(0); +} + std::string commandline_commands; std::string currentdir; QString examplesdir; @@ -203,7 +223,9 @@ int main(int argc, char **argv) desc.add_options() ("help,h", "help message") ("version,v", "print the version") + ("info", "print information about the building process") ("render", "if exporting a png image, do a full CGAL render") + ("preview", po::value<string>(), "if exporting a png image, do an OpenCSG(default) or ThrownTogether preview") ("camera", po::value<string>(), "parameters for camera when exporting png") ("imgsize", po::value<string>(), "=width,height for exporting png") ("projection", po::value<string>(), "(o)rtho or (p)erspective when exporting png") @@ -235,6 +257,7 @@ int main(int argc, char **argv) if (vm.count("help")) help(argv[0]); if (vm.count("version")) version(); + if (vm.count("info")) info(); if (vm.count("o")) { // FIXME: Allow for multiple output files? @@ -517,6 +540,8 @@ int main(int argc, char **argv) else { if (vm.count("render")) { export_png_with_cgal(&root_N, camera, fstream); + } else if (vm.count("preview") && vm["preview"].as<string>() == "throwntogether" ) { + export_png_with_throwntogether(tree, camera, fstream); } else { export_png_with_opencsg(tree, camera, fstream); } |