| 1 | 
greg | 
2.1 | 
/*  | 
| 2 | 
  | 
  | 
   ================================================================== | 
| 3 | 
  | 
  | 
   Photon map support routines for scattering by materials.  | 
| 4 | 
  | 
  | 
    | 
| 5 | 
  | 
  | 
   Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) | 
| 6 | 
  | 
  | 
   (c) Fraunhofer Institute for Solar Energy Systems, | 
| 7 | 
rschregle | 
2.2 | 
   (c) Lucerne University of Applied Sciences and Arts, | 
| 8 | 
  | 
  | 
   supported by the Swiss National Science Foundation (SNSF, #147053) | 
| 9 | 
greg | 
2.1 | 
   ================================================================== | 
| 10 | 
  | 
  | 
    | 
| 11 | 
greg | 
2.5 | 
   $Id: pmapmat.h,v 2.4 2015/05/21 15:28:24 greg Exp $ | 
| 12 | 
greg | 
2.1 | 
*/ | 
| 13 | 
  | 
  | 
 | 
| 14 | 
  | 
  | 
 | 
| 15 | 
  | 
  | 
#ifndef PMAPMAT_H | 
| 16 | 
  | 
  | 
   #define PMAPMAT_H | 
| 17 | 
  | 
  | 
 | 
| 18 | 
  | 
  | 
   #include "pmap.h" | 
| 19 | 
  | 
  | 
 | 
| 20 | 
  | 
  | 
   /*  | 
| 21 | 
greg | 
2.5 | 
      Check for paths already accounted for in photon map to avoid | 
| 22 | 
greg | 
2.1 | 
      double-counting during backward raytracing. | 
| 23 | 
  | 
  | 
     | 
| 24 | 
  | 
  | 
      shadowRayInPmap():   Check for DIFFUSE -> SPECULAR -> LIGHT | 
| 25 | 
  | 
  | 
                           subpaths. These occur during the backward pass  | 
| 26 | 
  | 
  | 
                           when a shadow ray is transferred through a | 
| 27 | 
  | 
  | 
                           transparent material. These subpaths are already | 
| 28 | 
  | 
  | 
                           accounted for by caustic photons in the global, | 
| 29 | 
  | 
  | 
                           contrib, or dedicated caustic photon map. | 
| 30 | 
  | 
  | 
   */ | 
| 31 | 
  | 
  | 
   #define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \ | 
| 32 | 
greg | 
2.4 | 
                                (ambounce < 0 || causticPhotonMapping)) | 
| 33 | 
greg | 
2.1 | 
    | 
| 34 | 
  | 
  | 
   /* Check if scattered ray spawns a caustic photon */ | 
| 35 | 
  | 
  | 
   #define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR) | 
| 36 | 
  | 
  | 
 | 
| 37 | 
  | 
  | 
 | 
| 38 | 
  | 
  | 
   /* Scattered photon ray types for photonRay() */ | 
| 39 | 
  | 
  | 
   #define  PMAP_DIFFREFL        (REFLECTED | AMBIENT) | 
| 40 | 
  | 
  | 
   #define  PMAP_DIFFTRANS       (REFLECTED | AMBIENT | TRANS) | 
| 41 | 
  | 
  | 
   #define  PMAP_SPECREFL        (REFLECTED | SPECULAR) | 
| 42 | 
  | 
  | 
   #define  PMAP_SPECTRANS       (REFLECTED | SPECULAR | TRANS) | 
| 43 | 
  | 
  | 
   #define  PMAP_REFRACT         (REFRACTED | SPECULAR) | 
| 44 | 
  | 
  | 
   #define  PMAP_XFER            (TRANS) | 
| 45 | 
  | 
  | 
 | 
| 46 | 
  | 
  | 
 | 
| 47 | 
  | 
  | 
 | 
| 48 | 
  | 
  | 
   /* Dispatch table for photon scattering functions */ | 
| 49 | 
  | 
  | 
   extern int (*photonScatter []) (OBJREC*, RAY*); | 
| 50 | 
  | 
  | 
    | 
| 51 | 
  | 
  | 
   /* List of antimatter sensor modifier names */ | 
| 52 | 
  | 
  | 
   extern char *photonSensorList [MAXSET + 1]; | 
| 53 | 
  | 
  | 
 | 
| 54 | 
  | 
  | 
 | 
| 55 | 
  | 
  | 
 | 
| 56 | 
  | 
  | 
   /* Spawn a new photon ray from a previous one; this is effectively a | 
| 57 | 
  | 
  | 
    * customised rayorigin(). */ | 
| 58 | 
  | 
  | 
   void photonRay (const RAY *rayIn, RAY *rayOut, int rayOutType,  | 
| 59 | 
  | 
  | 
                   COLOR fluxAtten); | 
| 60 | 
  | 
  | 
 | 
| 61 | 
  | 
  | 
   /* Init photonScatter[] dispatch table with material specific scattering | 
| 62 | 
  | 
  | 
      routines */ | 
| 63 | 
  | 
  | 
   void initPhotonScatterFuncs (); | 
| 64 | 
  | 
  | 
 | 
| 65 | 
  | 
  | 
   /* Find antimatter geometry declared as photon sensors */    | 
| 66 | 
  | 
  | 
   void getPhotonSensors (char **sensorList); | 
| 67 | 
  | 
  | 
    | 
| 68 | 
  | 
  | 
#endif |