stardis-solver

Solve coupled heat transfers
git clone git://git.meso-star.fr/stardis-solver.git
Log | Files | Refs | README | LICENSE

sdis_brdf.h (1984B)


      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_BRDF_H
     17 #define SDIS_BRDF_H
     18 
     19 #include <rsys/rsys.h>
     20 
     21 enum brdf_component {
     22   BRDF_SPECULAR,
     23   BRDF_DIFFUSE,
     24   BRDF_NONE
     25 };
     26 
     27 struct brdf_sample {
     28   double dir[3];
     29   double pdf;
     30   enum brdf_component cpnt;
     31 };
     32 #define BRDF_SAMPLE_NULL__ {{0}, 0, BRDF_NONE}
     33 static const struct brdf_sample BRDF_SAMPLE_NULL = BRDF_SAMPLE_NULL__;
     34 
     35 struct brdf {
     36   double emissivity;
     37   double specular_fraction;
     38 };
     39 #define BRDF_NULL__ {0, 0}
     40 static const struct brdf BRDF_NULL = BRDF_NULL__;
     41 
     42 /* forward declarations */
     43 struct sdis_device;
     44 struct sdis_interface;
     45 struct sdis_interface_fragment;
     46 struct ssp_rng;
     47 
     48 struct brdf_setup_args {
     49    struct sdis_interface* interf;
     50    struct sdis_interface_fragment* frag;
     51    unsigned source_id;
     52 };
     53 #define BRDF_SETUP_ARGS_NULL__ {NULL, NULL, SDIS_INTERN_SOURCE_ID}
     54 static const struct brdf_setup_args BRDF_SETUP_ARGS_NULL =
     55   BRDF_SETUP_ARGS_NULL__;
     56 
     57 extern LOCAL_SYM res_T
     58 brdf_setup
     59   (struct sdis_device* dev,
     60    const struct brdf_setup_args* args,
     61    struct brdf* brdf);
     62 
     63 extern LOCAL_SYM void
     64 brdf_sample
     65   (const struct brdf* brdf,
     66    struct ssp_rng* rng,
     67    const double wi[3], /* Incident direction. Point away from the surface */
     68    const double N[3], /* Surface normal */
     69    struct brdf_sample* sample);
     70 
     71 #endif /* SDIS_BRDF_H */