fart/main/fart.cc
Josh Holtrop f03b19a022 added messages to main/Scene, util/Matrix constructor sets matrix to identity
git-svn-id: svn://anubis/fart/trunk@37 7f9b0f55-74a9-4bce-be96-3c2cd072584d
2009-01-23 14:57:47 +00:00

82 lines
2.3 KiB
C++

#include <iostream>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <string>
#include <map>
#include "Scene.h"
using namespace std;
void usage(const char * progname)
{
cout << "Usage: " << progname << " [options] <scene-file>" << endl;
cout << " Options:" << endl;
cout << " -o|--output-file <output-file-name>" << endl;
cout << " -w|--width <image-width>" << endl;
cout << " -h|--height <image-height>" << endl;
cout << " -m|--multisample <level>" << endl;
cout << " -f|--field-of-view <vertical-fov>" << endl;
cout << " -v|--verbose" << endl;
exit(42);
}
int main(int argc, char * argv[])
{
int opt;
int option_index;
map<string, const char *> scene_options;
static const struct option long_options[] = {
{ "help", no_argument, NULL, 256 },
{ "output-file", required_argument, NULL, 'o' },
{ "width", required_argument, NULL, 'w' },
{ "height", required_argument, NULL, 'h' },
{ "multisample", required_argument, NULL, 'm' },
{ "field-of-view", required_argument, NULL, 'f' },
{ "verbose", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
while ((opt = getopt_long(argc, argv, "o:w:h:m:f:v",
long_options, &option_index)) != -1)
{
switch (opt)
{
case 256:
usage(argv[0]);
break;
case 'o':
scene_options["output-file"] = optarg;
break;
case 'w':
scene_options["width"] = optarg;
break;
case 'h':
scene_options["height"] = optarg;
break;
case 'm':
scene_options["multisample"] = optarg;
break;
case 'f':
scene_options["field-of-view"] = optarg;
break;
case 'v':
scene_options["verbose"] = optarg;
break;
default:
usage(argv[0]);
}
}
if (optind >= argc)
{
usage(argv[0]);
}
Scene scene(scene_options, argv[optind]);
scene.render();
}