diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-09-12 05:17:17 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-09-12 05:17:17 (GMT) |
commit | 6af6c311a12a0211545e29666c92f1806ca0c7e8 (patch) | |
tree | 5af3769a2bbd2cdc44508152cc1d2c72b2331e77 /src/openscad.cc | |
parent | b53dde04e2a13c066cfa0c552fe5bd0cdd1b8dbd (diff) |
cmdline throwntogether, integrate w chrysn tests, update resize tests
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 e657cb0..56b8acf 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; @@ -199,7 +219,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") @@ -231,6 +253,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? @@ -513,6 +536,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); } |