ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapooc.h
Revision: 1.3
Committed: Tue Sep 17 16:36:05 2024 UTC (7 months, 2 weeks ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +11 -3 lines
Log Message:
chore: Added extern "C" to headers to avoid C++ name mangling

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