From bcfbbb068856db1ed2f8cec52d833828646d7e3b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 11 Apr 2010 14:48:09 -0400 Subject: Add --quality option. --- dimension/main.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/dimension/main.c b/dimension/main.c index e5a5c1b..2bd4e10 100644 --- a/dimension/main.c +++ b/dimension/main.c @@ -32,6 +32,7 @@ static char *output = NULL, *input = NULL; static bool free_output = false; static unsigned int width = 640, height = 480; static unsigned int nthreads = 0; +static dmnsn_quality quality = DMNSN_RENDER_FULL; static int tokenize = 0, parse = 0; static void print_usage(FILE *file, const char *arg0); @@ -44,7 +45,8 @@ main(int argc, char **argv) { /* Long-only option codes */ enum { - DMNSN_OPT_THREADS = 256 + DMNSN_OPT_THREADS = 256, + DMNSN_OPT_QUALITY }; static struct option long_options[] = { @@ -53,6 +55,7 @@ main(int argc, char **argv) { { "width", required_argument, NULL, 'w' }, { "height", required_argument, NULL, 'h' }, { "threads", required_argument, NULL, DMNSN_OPT_THREADS }, + { "quality", required_argument, NULL, DMNSN_OPT_QUALITY }, { "tokenize", no_argument, &tokenize, 1 }, { "parse", no_argument, &parse, 1 }, { 0, 0, 0, 0 } @@ -125,6 +128,19 @@ main(int argc, char **argv) { } break; } + case DMNSN_OPT_QUALITY: + { + dmnsn_assert(optarg, "NULL argument."); + + char *endptr; + quality = strtoul(optarg, &endptr, 0); + if (*endptr != '\0' || endptr == optarg) { + fprintf(stderr, "Invalid argument to --quality!\n"); + print_usage(stderr, argv[0]); + return EXIT_FAILURE; + } + break; + } default: fprintf(stderr, "Invalid command line option!\n"); @@ -218,6 +234,9 @@ main(int argc, char **argv) { if (nthreads) scene->nthreads = nthreads; + /* Set the render quality */ + scene->quality = quality; + /* * Now we render the scene */ -- cgit v1.2.3