BRL-CAD
Loading...
Searching...
No Matches
photonmap.h
Go to the documentation of this file.
1/* P H O T O N M A P . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2002-2026 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20/** @addtogroup librt */
21/** @{ */
22/** @file photonmap.h
23 * P H O T O N M A P. H
24 * @brief
25 * Declarations related to Photon Mapping
26 *
27 */
28
29#ifndef PHOTONMAP_H
30#define PHOTONMAP_H
31
32#include "common.h"
33
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <math.h>
38
39#include "vmath.h"
40#include "bn.h"
41#include "rt/db4.h"
42#include "nmg.h"
43#include "raytrace.h"
44#include "optical.h"
45#include "optical/plastic.h"
46#include "optical/light.h"
47
48
49#define PM_MAPS 4
50
51#define PM_GLOBAL 0
52#define PM_CAUSTIC 1
53#define PM_SHADOW 2 /* Current not used */
54#define PM_IMPORTANCE 3
55
56
57/**
58 * Photon Map Data Structure
59 */
60struct Photon {
61 int Axis; /**< @brief Splitting Plane */
62 point_t Pos; /**< @brief Photon Position */
63 vect_t Dir; /**< @brief Photon Direction */
64 vect_t Normal; /**< @brief Normal at Intersection */
65 vect_t Power; /**< @brief Photon Power */
66 vect_t Irrad; /**< @brief Irradiance */
67};
68
69
70struct PSN {
71 struct Photon P;
73};
74
75
76/**
77 * Photon Search Structure
78 */
80 int Max; /**< @brief Max Number of Photons */
81 int Found; /**< @brief Number of Photons Found */
82 vect_t Normal; /**< @brief Normal */
83 fastf_t RadSq; /**< @brief Search Radius Sq */
84 point_t Pos; /**< @brief Search Position */
85 struct PSN *List; /**< @brief Located Photon List */
86};
87
88
90 int Max; /**< @brief Max Number of Photons */
91 int Found; /**< @brief Number of Photons Found */
92 vect_t Normal; /**< @brief Normal */
93 fastf_t RadSq; /**< @brief Search Radius Sq */
94 point_t Pos; /**< @brief Search Position */
95 struct Photon *List; /**< @brief Located Photon List */
96};
97
98
99struct PNode {
100 struct Photon P;
101 struct PNode *L;
102 struct PNode *R;
103 int C; /**< @brief For Threading Purposes to see if it's been computed yet */
104};
105
106
107struct PhotonMap {
110 struct PNode *Root;
111};
112
113
118
119
121 int Num;
123};
124
126
127OPTICAL_EXPORT extern int PM_Activated; /**< @brief Photon Mapping Activated, 0=off, 1=on */
128OPTICAL_EXPORT extern int PM_Visualize; /**< @brief Photon Mapping Visualization of Irradiance Cache */
129
132 int cpus,
133 int width,
134 int height,
135 int Hypersample,
136 int GlobalPhotons,
137 double CausticsPercent,
138 int Rays,
139 double AngularTolerance,
140 int RandomSeed,
144 double LightIntensity,
145 char pmfile[255]);
148 point_t pos,
149 vect_t normal);
150
152
153#endif /* PHOTONMAP_H */
154
155/** @} */
156/*
157 * Local Variables:
158 * mode: C
159 * tab-width: 8
160 * indent-tabs-mode: t
161 * c-file-style: "stroustrup"
162 * End:
163 * ex: shiftwidth=4 tabstop=8
164 */
Header file for the BRL-CAD Numerical Computation Library, LIBBN.
Definition dvec.h:74
Header file for the BRL-CAD common definitions.
GED Database Format v4.
void IrradianceEstimate(struct application *ap, vect_t irrad, point_t pos, vect_t normal)
void BuildPhotonMap(struct application *ap, point_t eye_pos, int cpus, int width, int height, int Hypersample, int GlobalPhotons, double CausticsPercent, int Rays, double AngularTolerance, int RandomSeed, int ImportanceMapping, int IrradianceHypersampling, int VisualizeIrradiance, double LightIntensity, char pmfile[255])
int PM_Visualize
Photon Mapping Visualization of Irradiance Cache.
int PM_Activated
Photon Mapping Activated, 0=off, 1=on.
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition vmath.h:348
double fastf_t
fastest 64-bit (or larger) floating point type
Definition vmath.h:333
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition vmath.h:354
Declarations related to light sources.
Header file for the BRL-CAD Optical Library, LIBOPTICAL.
struct IrradNode * List
Definition photonmap.h:122
vect_t RGB
Definition photonmap.h:116
point_t Pos
Definition photonmap.h:115
int Max
Max Number of Photons.
Definition photonmap.h:90
struct Photon * List
Located Photon List.
Definition photonmap.h:95
vect_t Normal
Normal.
Definition photonmap.h:92
int Found
Number of Photons Found.
Definition photonmap.h:91
fastf_t RadSq
Search Radius Sq.
Definition photonmap.h:93
point_t Pos
Search Position.
Definition photonmap.h:94
struct Photon P
Definition photonmap.h:100
int C
For Threading Purposes to see if it's been computed yet.
Definition photonmap.h:103
struct PNode * L
Definition photonmap.h:101
struct PNode * R
Definition photonmap.h:102
struct Photon P
Definition photonmap.h:71
fastf_t Dist
Definition photonmap.h:72
int Axis
Splitting Plane.
Definition photonmap.h:61
vect_t Irrad
Irradiance.
Definition photonmap.h:66
vect_t Dir
Photon Direction.
Definition photonmap.h:63
vect_t Power
Photon Power.
Definition photonmap.h:65
vect_t Normal
Normal at Intersection.
Definition photonmap.h:64
point_t Pos
Photon Position.
Definition photonmap.h:62
int MaxPhotons
Definition photonmap.h:109
int StoredPhotons
Definition photonmap.h:108
struct PNode * Root
Definition photonmap.h:110
int Max
Max Number of Photons.
Definition photonmap.h:80
struct PSN * List
Located Photon List.
Definition photonmap.h:85
vect_t Normal
Normal.
Definition photonmap.h:82
int Found
Number of Photons Found.
Definition photonmap.h:81
fastf_t RadSq
Search Radius Sq.
Definition photonmap.h:83
point_t Pos
Search Position.
Definition photonmap.h:84
fundamental vector, matrix, quaternion math macros