commit 4a4f136c620e500add4de047afc2c9d1233ceecb
parent c32d4b820c39773314cff2d347fa9d80836b72ed
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 1 Feb 2017 17:49:02 +0100
Add the 'dump obj' option '-O'
When defined, the geometry of the submitted YAML solar factory will be
outputted wrt the Alias Wavefront obj file format.
Diffstat:
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/doc/cli b/doc/cli
@@ -3,6 +3,7 @@ solstice
-d <date-list>:<pos-on-earth>
-D <sun-dir-list>
-h # Short help and exit
+ -O # Switch in dump mode
-o OUTPUT # defaulting to stdout if not defined
-q # don't print a message if no INPUT is submitted
-n INTEGER # Realisations count
diff --git a/src/solstice_args.c b/src/solstice_args.c
@@ -303,7 +303,7 @@ solstice_args_init(struct solstice_args* args, const int argc, char** argv)
*args = SOLSTICE_ARGS_DEFAULT;
optind = 0;
- while((opt = getopt(argc, argv, "D:Hhn:o:qR:r:t:")) != -1) {
+ while((opt = getopt(argc, argv, "D:Hhn:O:o:qR:r:t:")) != -1) {
switch(opt) {
case 'D':
res = parse_sun_dir_list(optarg, args);
@@ -318,6 +318,7 @@ solstice_args_init(struct solstice_args* args, const int argc, char** argv)
res = cstr_to_ulong(optarg, &args->nrealisations);
if(res == RES_OK && !args->nrealisations) res = RES_BAD_ARG;
break;
+ case 'O': args->dump_obj = 1; break;
case 'o': args->output_filename = optarg; break;
case 'q': args->quiet = 1; break;
case 'R': args->receivers_filename = optarg; break;
@@ -343,6 +344,13 @@ solstice_args_init(struct solstice_args* args, const int argc, char** argv)
goto error;
}
+ if(args->dump_obj && args->rendering) {
+ fprintf(stderr,
+ "The '-O' and '-r' options cannot be defined simultaneously.\n");
+ res = RES_BAD_ARG;
+ goto error;
+ }
+
if(optind < argc) {
args->input_filename = argv[optind];
}
diff --git a/src/solstice_args.h.in b/src/solstice_args.h.in
@@ -47,6 +47,7 @@ struct solstice_args {
unsigned long height;
} img;
+ int dump_obj;
int rendering;
int output_hits; /* Output the per receiver hits */
int quiet;
@@ -78,6 +79,7 @@ static const struct solstice_args SOLSTICE_ARGS_NULL = SOLSTICE_ARGS_NULL__;
@SOLSTICE_ARGS_DEFAULT_IMG_HEIGHT@ \
}, \
\
+ 0, /* Dump */ \
0, /* Rendering */ \
0, /* Output hits */ \
0, /* Quiet */ \
diff --git a/src/solstice_entity.c b/src/solstice_entity.c
@@ -344,9 +344,6 @@ solstice_setup_entities(struct solstice* solstice)
res_T res = RES_OK;
ASSERT(solstice);
- /* Release possible previous roots (incomplete, TODO) */
- /*score_scene_clear(solstice->score);*/
-
/* (re) create the list of roots from entities */
solparser_entity_iterator_begin(solstice->parser, &it);
solparser_entity_iterator_end(solstice->parser, &it_end);