ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmaprand.h
Revision: 2.7
Committed: Tue May 17 17:39:47 2016 UTC (8 years ago) by rschregle
Content type: text/plain
Branch: MAIN
Changes since 2.6: +16 -15 lines
Log Message:
Initial import of ooC photon map

File Contents

# User Rev Content
1 rschregle 2.7 /* RCSid $Id: pmaprand.h,v 2.4 2015/08/18 18:45:55 greg Exp $ */
2 greg 2.1
3     /*
4     ==================================================================
5     Random number generators for photon distribution
6    
7     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
8     (c) Fraunhofer Institute for Solar Energy Systems,
9 rschregle 2.3 (c) Lucerne University of Applied Sciences and Arts,
10     supported by the Swiss National Science Foundation (SNSF, #147053)
11 greg 2.1 ==================================================================
12    
13 rschregle 2.7 $Id: pmaprand.h,v 2.3 2015/05/08 13:20:23 rschregle Exp $
14 greg 2.1 */
15    
16    
17    
18 rschregle 2.7 #ifndef PMAPRAND_H
19     #define PMAPRAND_H
20    
21     /* According to the analytical validation, skipping numbers in the sequence
22     introduces bias in scenes with high reflectance. We therefore use
23     erand48() with separate states for photon emission, scattering, and
24     russian roulette. The pmapSeed() and pmapRandom() macros can be
25     adapted to other (better?) RNGs. */
26 greg 2.2
27 rschregle 2.7 #if defined(_WIN32) || defined(BSD)
28 greg 2.2 /* Assume no erand48(), so use standard RNG without explicit multistate
29     control; the resulting sequences will be suboptimal */
30     #include "random.h"
31 rschregle 2.7
32 greg 2.2 #define pmapSeed(seed, state) (srandom(seed))
33     #define pmapRandom(state) (frandom())
34     #else
35     #define pmapSeed(seed, state) (state [0] += seed, state [1] += seed, \
36     state [2] += seed)
37     #define pmapRandom(state) erand48(state)
38     #endif
39 greg 2.1
40 rschregle 2.7
41     extern unsigned short partState [3], emitState [3], cntState [3],
42     mediumState [3], scatterState [3], rouletteState [3],
43     randSeed;
44 greg 2.1 #endif
45 greg 2.2