solstice_args.h.in (6879B)
1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) 2 * Copyright (C) 2016-2018 CNRS 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 16 17 #ifndef SOLSTICE_ARGS_H 18 #define SOLSTICE_ARGS_H 19 20 #include "score.h" 21 22 #include <solstice/ssol.h> 23 #include <rsys/math.h> 24 #include <time.h> 25 26 struct solstice_args_location { 27 double longiture; 28 double latitude; 29 }; 30 31 #define SOLSTICE_ARGS_LOCATION_NONE { 0, 0 } 32 33 enum solstice_args_sun_dir_type { 34 SOLSTICE_ARGS_SPHERICAL, 35 SOLSTICE_ARGS_LOCATION_TIME 36 }; 37 38 enum solstice_args_sun_direction_algorithm { 39 SOLSTICE_ARGS_SUN_DIRECTION_ALGORITHM_meeus, 40 SOLSTICE_ARGS_SUN_DIRECTION_ALGORITHM_psa 41 }; 42 43 struct solstice_args_spherical { 44 double azimuth; 45 double elevation; 46 }; 47 48 struct solstice_args_location_time { 49 struct tm time; 50 double latitude, longitude; 51 }; 52 53 struct solstice_args_sun_dir { 54 enum solstice_args_sun_dir_type type; 55 struct solstice_args_location_time location_time; 56 struct solstice_args_spherical spherical; 57 }; 58 59 enum solstice_args_dump_format { 60 SOLSTICE_ARGS_DUMP_OBJ, 61 SOLSTICE_ARGS_DUMP_NONE 62 }; 63 64 enum solstice_args_dump_split_mode { 65 SOLSTICE_ARGS_DUMP_SPLIT_GEOMETRY, 66 SOLSTICE_ARGS_DUMP_SPLIT_NONE, 67 SOLSTICE_ARGS_DUMP_SPLIT_OBJECT 68 }; 69 70 enum solstice_args_render_mode { 71 SOLSTICE_ARGS_RENDER_DRAFT, 72 SOLSTICE_ARGS_RENDER_PATH_TRACING 73 }; 74 75 struct solstice_args { 76 const char* output_filename; 77 const char* input_filename; /* May be NULL <=> read data from stdin */ 78 const char* receivers_filename; 79 double dni; 80 unsigned long nexperiments; /* #experiments */ 81 unsigned nthreads; /* #threads */ 82 enum solstice_args_sun_direction_algorithm sun_algorithm; 83 84 /* List of sun directions */ 85 struct solstice_args_sun_dir* sun_dirs; 86 size_t nsun_dirs; 87 88 struct { 89 double pos[3]; 90 double tgt[3]; 91 double up[3]; 92 double fov_x; /* In degrees */ 93 int auto_look_at; 94 } camera; 95 96 struct { 97 unsigned long width; 98 unsigned long height; 99 unsigned spp; /* Samples per pixel */ 100 } img; 101 102 enum solstice_args_render_mode render_mode; 103 104 /* Dump geometry mode */ 105 enum solstice_args_dump_format dump_format; 106 enum solstice_args_dump_split_mode dump_split_mode; 107 108 /* Dump radiative paths options. */ 109 double sun_ray_length; /* Length of the sun rays. */ 110 double infinite_ray_length; /* Length of the rays going to infinity. */ 111 112 /* RNG options */ 113 char* rng_state_input_filename; 114 char* rng_state_output_filename; 115 116 int force_overwriting; 117 int dump_paths; /* Dump radiative paths */ 118 int rendering; 119 int quiet; 120 int quit; /* Quit the application */ 121 int verbose; 122 }; 123 124 #define SOLSTICE_ARGS_NULL__ {0} 125 static const struct solstice_args SOLSTICE_ARGS_NULL = SOLSTICE_ARGS_NULL__; 126 127 #define SOLSTICE_ARGS_DEFAULT__ { \ 128 NULL, /* output_filename */ \ 129 NULL, /* input_filename */ \ 130 NULL, /* receivers_filename */ \ 131 -1, \ 132 @SOLSTICE_ARGS_DEFAULT_NREALISATIONS@, \ 133 SSOL_NTHREADS_DEFAULT, \ 134 @SOLSTICE_ARGS_DEFAULT_SUN_DIRECTION_ALGORITHM@, \ 135 \ 136 NULL, /* sun_dirs */ \ 137 0, /* # nsun_dirs */ \ 138 \ 139 { /* Camera */ \ 140 { @SOLSTICE_ARGS_DEFAULT_CAMERA_POS@ }, \ 141 { @SOLSTICE_ARGS_DEFAULT_CAMERA_TGT@ }, \ 142 { @SOLSTICE_ARGS_DEFAULT_CAMERA_UP@ }, \ 143 @SOLSTICE_ARGS_DEFAULT_CAMERA_FOV@, \ 144 1, \ 145 }, \ 146 \ 147 { /* Image */ \ 148 @SOLSTICE_ARGS_DEFAULT_IMG_WIDTH@, \ 149 @SOLSTICE_ARGS_DEFAULT_IMG_HEIGHT@, \ 150 @SOLSTICE_ARGS_DEFAULT_IMG_SPP@ \ 151 }, \ 152 \ 153 SOLSTICE_ARGS_RENDER_DRAFT, /* Render mode */ \ 154 \ 155 SOLSTICE_ARGS_DUMP_NONE, /* Dump format */ \ 156 SOLSTICE_ARGS_DUMP_SPLIT_NONE, /* Dump split mode */ \ 157 \ 158 -1, /* Sun ray length */ \ 159 -1, /* Infinite ray length */ \ 160 \ 161 NULL, /* RNG state input filename */ \ 162 NULL, /* RNG state output filename */ \ 163 \ 164 0, /* Force overwriting */ \ 165 0, /* Dump radiative paths */ \ 166 0, /* Rendering */ \ 167 0, /* Quiet */ \ 168 0, /* Quit */ \ 169 0 /* Verbose */ \ 170 } 171 static const struct solstice_args SOLSTICE_ARGS_DEFAULT = 172 SOLSTICE_ARGS_DEFAULT__; 173 174 #endif /* SOLSTICE_ARGS_H */ 175