sdis_radiative_env_c.h (1659B)
1 /* Copyright (C) 2016-2025 |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 SDIS_RADIATIVE_ENV_C_H 17 #define SDIS_RADIATIVE_ENV_C_H 18 19 #include "sdis.h" 20 #include <rsys/ref_count.h> 21 22 struct sdis_radiative_env { 23 struct sdis_radiative_env_shader shader; 24 struct sdis_data* data; 25 26 ref_T ref; 27 struct sdis_device* dev; 28 }; 29 30 static INLINE double 31 radiative_env_get_temperature 32 (const struct sdis_radiative_env* radenv, 33 const struct sdis_radiative_ray* ray) 34 { 35 ASSERT(ray && d3_is_normalized(ray->dir)); 36 return radenv && radenv->shader.temperature 37 ? radenv->shader.temperature(ray, radenv->data) 38 : SDIS_TEMPERATURE_NONE; 39 } 40 41 static INLINE double 42 radiative_env_get_reference_temperature 43 (const struct sdis_radiative_env* radenv, 44 const struct sdis_radiative_ray* ray) 45 { 46 ASSERT(ray && d3_is_normalized(ray->dir)); 47 return radenv && radenv->shader.reference_temperature 48 ? radenv->shader.reference_temperature(ray, radenv->data) 49 : SDIS_TEMPERATURE_NONE; 50 } 51 52 #endif /* SDIS_RADIATIVE_ENV_C_H */