summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-04-11 14:48:09 -0400
committerTavian Barnes <tavianator@gmail.com>2010-04-11 14:48:09 -0400
commitbcfbbb068856db1ed2f8cec52d833828646d7e3b (patch)
tree8278d37332e4ed4210b7c4003f03a1535e38a1b5
parente66c442edb8275629d226f3c4092dfc5c93fb65d (diff)
downloaddimension-bcfbbb068856db1ed2f8cec52d833828646d7e3b.tar.xz
Add --quality option.
-rw-r--r--dimension/main.c21
1 files changed, 20 insertions, 1 deletions
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
*/