| 1 |
/* RCSid $Id: pmapmat.h,v 2.8 2015/08/18 18:45:55 greg Exp $ */ |
| 2 |
/* |
| 3 |
================================================================== |
| 4 |
Photon map support routines for scattering by materials. |
| 5 |
|
| 6 |
Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) |
| 7 |
(c) Fraunhofer Institute for Solar Energy Systems, |
| 8 |
(c) Lucerne University of Applied Sciences and Arts, |
| 9 |
supported by the Swiss National Science Foundation (SNSF, #147053) |
| 10 |
================================================================== |
| 11 |
|
| 12 |
*/ |
| 13 |
|
| 14 |
|
| 15 |
#ifndef PMAPMAT_H |
| 16 |
#define PMAPMAT_H |
| 17 |
|
| 18 |
#include "pmap.h" |
| 19 |
|
| 20 |
/* |
| 21 |
Check for paths already accounted for in photon map to avoid |
| 22 |
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 |
/* |
| 32 |
#define ambRayInPmap(r) ((r) -> crtype & AMBIENT && \ |
| 33 |
((photonMapping && \ |
| 34 |
(ambounce < 0 || (r) -> rlvl > 1)) || \ |
| 35 |
causticPhotonMapping || contribPhotonMapping)) |
| 36 |
*/ |
| 37 |
#define ambRayInPmap(r) 0 |
| 38 |
#define shadowRayInPmap(r) ((r) -> crtype & SHADOW && \ |
| 39 |
(ambounce < 0 || ((r) -> crtype & AMBIENT ? \ |
| 40 |
photonMapping : causticPhotonMapping))) |
| 41 |
|
| 42 |
/* Check if scattered ray spawns a caustic photon */ |
| 43 |
#define PMAP_CAUSTICRAY(r) ((r) -> rtype & SPECULAR) |
| 44 |
|
| 45 |
|
| 46 |
/* Scattered photon ray types for photonRay() */ |
| 47 |
#define PMAP_DIFFREFL (REFLECTED | AMBIENT) |
| 48 |
#define PMAP_DIFFTRANS (REFLECTED | AMBIENT | TRANS) |
| 49 |
#define PMAP_SPECREFL (REFLECTED | SPECULAR) |
| 50 |
#define PMAP_SPECTRANS (REFLECTED | SPECULAR | TRANS) |
| 51 |
#define PMAP_REFRACT (REFRACTED | SPECULAR) |
| 52 |
#define PMAP_XFER (TRANS) |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
/* Dispatch table for photon scattering functions */ |
| 57 |
extern int (*photonScatter []) (OBJREC*, RAY*); |
| 58 |
|
| 59 |
/* List of antimatter sensor modifier names */ |
| 60 |
extern char *photonSensorList [MAXSET + 1]; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
/* Spawn a new photon ray from a previous one; this is effectively a |
| 65 |
* customised rayorigin(). */ |
| 66 |
void photonRay (const RAY *rayIn, RAY *rayOut, int rayOutType, |
| 67 |
COLOR fluxAtten); |
| 68 |
|
| 69 |
/* Init photonScatter[] dispatch table with material specific scattering |
| 70 |
routines */ |
| 71 |
void initPhotonScatterFuncs (); |
| 72 |
|
| 73 |
/* Find antimatter geometry declared as photon sensors */ |
| 74 |
void getPhotonSensors (char **sensorList); |
| 75 |
|
| 76 |
#endif |