mrumtl_brdf.h (1577B)
1 /* Copyright (C) 2020-2023 |Méso|Star> (contact@meso-star.com) 2 * 3 * This program is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 3 of the License, or 6 * (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 16 #ifndef MRUMTL_BRDF_H 17 #define MRUMTL_BRDF_H 18 19 #include "mrumtl.h" 20 #include <rsys/dynamic_array.h> 21 22 struct mem_allocator; 23 24 struct brdf_lambertian { 25 double reflectivity; 26 }; 27 28 struct brdf_specular { 29 double reflectivity; 30 }; 31 32 struct mrumtl_brdf { 33 double wlen[2]; /* Inclusive spectral range in nanometers */ 34 enum mrumtl_brdf_type type; 35 union { 36 struct brdf_lambertian lambertian; 37 struct brdf_specular specular; 38 } param; 39 }; 40 41 static INLINE res_T 42 brdf_init(struct mem_allocator* allocator, struct mrumtl_brdf* brdf) 43 { 44 ASSERT(brdf); 45 (void)allocator; 46 brdf->wlen[0] = 0; 47 brdf->wlen[1] = 0; 48 brdf->type = MRUMTL_BRDF_NONE__; 49 return RES_OK; 50 } 51 52 /* Generate the dynamic array of BRDF */ 53 #define DARRAY_NAME brdf 54 #define DARRAY_DATA struct mrumtl_brdf 55 #define DARRAY_FUNCTOR_INIT brdf_init 56 #include <rsys/dynamic_array.h> 57 58 #endif /* MRUMTL_BRDF_H */