ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapooc.h
Revision: 1.2
Committed: Wed Apr 8 15:14:21 2020 UTC (4 years, 1 month ago) by rschregle
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R3, HEAD
Changes since 1.1: +12 -10 lines
Log Message:
Fixed est00pid bug in single photon lookups that returned junk when none found, added code to detect and handle (ignore).

File Contents

# User Rev Content
1 rschregle 1.1 /*
2     ==================================================================
3     Photon map interface to out-of-core octree
4    
5     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
6     (c) Lucerne University of Applied Sciences and Arts,
7     supported by the Swiss National Science Foundation (SNSF, #147053)
8     ==================================================================
9    
10 rschregle 1.2 $Id: pmapooc.h,v 1.1 2016/05/18 08:22:45 rschregle Exp $
11 rschregle 1.1 */
12    
13    
14    
15     #ifndef PMAPOOC_H
16     #define PMAPOOC_H
17    
18     #include "oocnn.h"
19    
20    
21    
22     /* Suffixes for octree filenames */
23     /* #define PMAP_OOC_NODESUFFIX ".node"
24     #define PMAP_OOC_HEAPSUFFIX ".heap" */
25     #define PMAP_OOC_LEAFSUFFIX ".leaf"
26    
27     /* Out-of-core octree constants */
28     #define PMAP_OOC_NUMBLK 32 /* Num blocks for external sort */
29     #define PMAP_OOC_BLKSIZE 1e8 /* Block size for external sort */
30     #define PMAP_OOC_LEAFMAX (OOC_OCTCNT_MAX) /* Max photons per leaf */
31     #define PMAP_OOC_MAXDEPTH (OOC_MORTON_BITS) /* Max octree depth */
32    
33    
34    
35     typedef OOC_SearchQueueNode PhotonSearchQueueNode;
36     typedef OOC_SearchQueue PhotonSearchQueue;
37     typedef OOC_Octree PhotonStorage;
38     typedef unsigned PhotonIdx;
39    
40     /* Forward declarations to break dependency loop with pmapdata.h */
41     struct PhotonMap;
42    
43    
44    
45     void OOC_BuildPhotonMap (struct PhotonMap *pmap, unsigned numProc);
46     /* Build out-of-core octree pmap -> store from photons in unsorted
47     * heapfile pmap -> heap and generate nodes and leaf file with prefix
48     * pmap -> fileName. Photon map construction may be parallelised if
49     * numProc > 1, if supported. The heap is destroyed on return. */
50    
51     int OOC_SavePhotons (const struct PhotonMap *pmap, FILE *out);
52     /* Save photons in out-of-core octree to file. Return -1 on error,
53     * else 0 */
54    
55     int OOC_LoadPhotons (struct PhotonMap *pmap, FILE *in);
56     /* Load photons in out-of-core octree from file. Return -1 on error,
57     * else 0 */
58    
59     void OOC_InitFindPhotons (struct PhotonMap *pmap);
60     /* Initialise NN search queue prior to calling kdT_FindPhotons() */
61    
62 rschregle 1.2 int OOC_FindPhotons (struct PhotonMap* pmap, const FVECT pos,
63     const FVECT norm);
64 rschregle 1.1 /* Locate pmap -> squeue.len nearest photons to pos with similar normal
65     * (NULL for volume photons) and return in search queue pmap -> squeue,
66 rschregle 1.2 * starting with the further photon at pmap -> squeue.node. Return -1
67     * if none found, else 0. */
68 rschregle 1.1
69 rschregle 1.2 int OOC_Find1Photon (struct PhotonMap* pmap, const FVECT pos,
70     const FVECT norm, Photon *photon);
71     /* Locate single nearest photon to pos with similar normal. Return -1
72     * if none found, else 0. */
73 rschregle 1.1
74     int OOC_GetPhoton (struct PhotonMap *pmap, PhotonIdx idx,
75     Photon *photon);
76 rschregle 1.2 /* Retrieve photon referenced by idx from leaf file and return -1 on
77     * error, else 0. */
78 rschregle 1.1
79     Photon *OOC_GetNearestPhoton (const PhotonSearchQueue *squeue,
80     PhotonIdx idx);
81 rschregle 1.2 /* Retrieve photon from NN search queue after OOC_FindPhotons() */
82 rschregle 1.1
83     PhotonIdx OOC_FirstPhoton (const struct PhotonMap* pmap);
84     /* Return index to first photon in octree */
85     #endif