htrdr_args.h.in (7210B)
1 /* Copyright (C) 2018-2019, 2022-2025 Centre National de la Recherche Scientifique 2 * Copyright (C) 2020-2022 Institut Mines Télécom Albi-Carmaux 3 * Copyright (C) 2022-2025 Institut de Physique du Globe de Paris 4 * Copyright (C) 2018-2025 |Méso|Star> (contact@meso-star.com) 5 * Copyright (C) 2022-2025 Université de Reims Champagne-Ardenne 6 * Copyright (C) 2022-2025 Université de Versaille Saint-Quentin 7 * Copyright (C) 2018-2019, 2022-2025 Université Paul Sabatier 8 * 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation, either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 21 22 #ifndef HTRDR_ARGS_H 23 #define HTRDR_ARGS_H 24 25 #include "core/htrdr_ran_wlen_cie_xyz.h" 26 #include "core/htrdr_spectral.h" 27 28 #include <rsys/rsys.h> 29 30 /* Exclusive bounds of the camera field of view (degrees) */ 31 #define HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN \ 32 @HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MIN@ 33 #define HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX \ 34 @HTRDR_ARGS_CAMERA_PERSPECTIVE_FOV_EXCLUSIVE_MAX@ 35 36 enum htrdr_args_camera_type { 37 HTRDR_ARGS_CAMERA_PERSPECTIVE, 38 HTRDR_ARGS_CAMERA_ORTHOGRAPHIC, 39 HTRDR_ARGS_CAMERA_TYPES_COUNT__ 40 }; 41 42 struct htrdr_args_camera_perspective { 43 double position[3]; /* Lens position */ 44 double target[3]; /* Targeted position */ 45 double up[3]; /* Up vector of the camera */ 46 double fov_y; /* Vertical field of view of the camera, in degrees */ 47 double lens_radius; /* Radius of the lens. 0 means for pinhole */ 48 double focal_dst; /* Distance to focus on */ 49 double focal_length; /* Computed from fov_y and lens_radius. <0 => not used */ 50 }; 51 #define HTRDR_ARGS_CAMERA_PERSPECTIVE_DEFAULT__ { \ 52 {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}, /* position */ \ 53 {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}, /* target */ \ 54 {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}, /* Camera up */ \ 55 @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOV@, /* Vertical field of view */ \ 56 @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_LENS_RADIUS@, /* Radius of the lens */\ 57 @HTRDR_ARGS_DEFAULT_CAMERA_PERSPECTIVE_FOCAL_DST@, /* Distance to focus on */\ 58 -1 /* Focal length. <0 <=> not used */ \ 59 } 60 static const struct htrdr_args_camera_perspective 61 HTRDR_ARGS_CAMERA_PERSPECTIVE_DEFAULT = HTRDR_ARGS_CAMERA_PERSPECTIVE_DEFAULT__; 62 63 struct htrdr_args_camera_orthographic { 64 double position[3]; /* Lens position */ 65 double target[3]; /* Targeted position */ 66 double up[3]; /* Up vector of the camera */ 67 double height; /* Height of the image plane */ 68 }; 69 #define HTRDR_ARGS_CAMERA_ORTHOGRAPHIC_DEFAULT__ { \ 70 {@HTRDR_ARGS_DEFAULT_CAMERA_POS@}, /* position */ \ 71 {@HTRDR_ARGS_DEFAULT_CAMERA_TGT@}, /* target */ \ 72 {@HTRDR_ARGS_DEFAULT_CAMERA_UP@}, /* Camera up */ \ 73 @HTRDR_ARGS_DEFAULT_CAMERA_ORTHOGRAPHIC_HEIGHT@ /* Image plane height */ \ 74 } 75 static const struct htrdr_args_camera_orthographic 76 HTRDR_ARGS_CAMERA_ORTHOGRAPHIC_DEFAULT = HTRDR_ARGS_CAMERA_ORTHOGRAPHIC_DEFAULT__; 77 78 /* Arguments of a rectangular sensor */ 79 struct htrdr_args_rectangle { 80 double position[3]; /* Center of the renctangle */ 81 double target[3]; /* Targeted point (rectangle.normal = target - position) */ 82 double up[3]; /* Up vector of the rectangle */ 83 double size[2]; /* Plane size */ 84 }; 85 #define HTRDR_ARGS_RECTANGLE_DEFAULT__ { \ 86 {@HTRDR_ARGS_DEFAULT_RECTANGLE_POS@}, /* Rectangle center */ \ 87 {@HTRDR_ARGS_DEFAULT_RECTANGLE_TGT@}, /* Rectangle target */ \ 88 {@HTRDR_ARGS_DEFAULT_RECTANGLE_UP@}, /* Rectangle up */ \ 89 {@HTRDR_ARGS_DEFAULT_RECTANGLE_SZ@}, /* Rectangle size */ \ 90 } 91 static const struct htrdr_args_rectangle HTRDR_ARGS_RECTANGLE_DEFAULT = 92 HTRDR_ARGS_RECTANGLE_DEFAULT__; 93 94 /* Arguments of an image */ 95 struct htrdr_args_image { 96 unsigned definition[2]; /* #pixels in X and Y */ 97 unsigned spp; /* #samples per pixel */ 98 }; 99 #define HTRDR_ARGS_IMAGE_DEFAULT__ { \ 100 {@HTRDR_ARGS_DEFAULT_IMG_WIDTH@, @HTRDR_ARGS_DEFAULT_IMG_HEIGHT@}, \ 101 @HTRDR_ARGS_DEFAULT_IMG_SPP@ \ 102 } 103 static const struct htrdr_args_image HTRDR_ARGS_IMAGE_DEFAULT = 104 HTRDR_ARGS_IMAGE_DEFAULT__; 105 106 /* Arguments of a geometry */ 107 struct htrdr_args_geometry { 108 char* path_obj; /* Path toward a htrdr-obj */ 109 char* path_mats; /* Path toward a htrdr-materials */ 110 }; 111 #define HTRDR_ARGS_GEOMETRY_NULL__ {NULL, NULL} 112 static const struct htrdr_args_geometry HTRDR_ARGS_GEOMETRY_NULL = 113 HTRDR_ARGS_GEOMETRY_NULL__; 114 115 /* Arguments of the spectral domain */ 116 struct htrdr_args_spectral { 117 double wlen_range[2]; /* Spectral range of integration in nm */ 118 double ref_temperature; /* Planck reference temperature in Kelvin */ 119 enum htrdr_spectral_type spectral_type; 120 }; 121 #define HTRDR_ARGS_SPECTRAL_DEFAULT__ { \ 122 HTRDR_RAN_WLEN_CIE_XYZ_RANGE_DEFAULT__, /* Spectral range */ \ 123 -1, /* Reference temperature */ \ 124 HTRDR_SPECTRAL_SW_CIE_XYZ, /* Spectral type */ \ 125 } 126 static const struct htrdr_args_spectral HTRDR_ARGS_SPECTRAL_DEFAULT = 127 HTRDR_ARGS_SPECTRAL_DEFAULT__; 128 129 /******************************************************************************* 130 * Exported functions 131 ******************************************************************************/ 132 BEGIN_DECLS 133 134 HTRDR_API res_T 135 htrdr_args_camera_perspective_parse 136 (struct htrdr_args_camera_perspective* cam, 137 const char* str); 138 139 HTRDR_API res_T 140 htrdr_args_camera_perspective_check 141 (const struct htrdr_args_camera_perspective* cam); 142 143 HTRDR_API res_T 144 htrdr_args_camera_orthographic_parse 145 (struct htrdr_args_camera_orthographic* cam, 146 const char* str); 147 148 HTRDR_API res_T 149 htrdr_args_camera_orthographic_check 150 (const struct htrdr_args_camera_orthographic* cam); 151 152 HTRDR_API res_T 153 htrdr_args_rectangle_parse 154 (struct htrdr_args_rectangle* rect, 155 const char* str); 156 157 HTRDR_API res_T 158 htrdr_args_image_parse 159 (struct htrdr_args_image* img, 160 const char* str); 161 162 HTRDR_API res_T 163 htrdr_args_image_check 164 (const struct htrdr_args_image* img); 165 166 HTRDR_API res_T 167 htrdr_args_spectral_parse 168 (struct htrdr_args_spectral* spectral, 169 const char* str); 170 171 HTRDR_API void 172 htrdr_args_geometry_free 173 (struct htrdr_args_geometry* geom); 174 175 HTRDR_API res_T 176 htrdr_args_geometry_parse 177 (struct htrdr_args_geometry* geom, 178 const char* str); 179 180 END_DECLS 181 182 #endif /* HTRDR_ARGS_H */