Fermat
direct_lighting_mesh.h
1 /*
2  * Fermat
3  *
4  * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the NVIDIA CORPORATION nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #pragma once
30 
31 #include <lights.h>
32 
35 
38 
42 {
43  static const uint32 INVALID_SLOT = 0xFFFFFFFF;
44  static const uint32 INVALID_SAMPLE = 0xFFFFFFFF;
45 
48  FERMAT_HOST_DEVICE
50 
53  FERMAT_HOST_DEVICE
54  DirectLightingMesh(const MeshLight _mesh_light) : mesh_light(_mesh_light) {}
55 
58  FERMAT_DEVICE
60  const RenderingContextView& renderer,
61  const EyeVertex& ev,
62  const uint32 pixel,
63  const uint32 bounce,
64  const bool is_secondary_diffuse,
65  const float cone_radius,
66  const cugar::Bbox3f scene_bbox)
67  {
68  return INVALID_SLOT;
69  }
70 
73  FERMAT_DEVICE
74  uint32 sample(
75  const uint32 nee_slot,
76  const float z[3],
77  VertexGeometryId* light_vertex,
78  VertexGeometry* light_vertex_geom,
79  float* light_pdf,
80  Edf* light_edf)
81  {
82  mesh_light.sample(z, &light_vertex->prim_id, &light_vertex->uv, light_vertex_geom, light_pdf, light_edf);
83  return INVALID_SAMPLE;
84  }
85 
88  FERMAT_DEVICE
89  void map(
90  const uint32 prev_nee_slot,
91  const uint32 triId,
92  const cugar::Vector2f uv,
93  const VertexGeometry light_vertex_geom,
94  float* light_pdf,
95  Edf* light_edf)
96  {
97  mesh_light.map(triId, uv, light_vertex_geom, light_pdf, light_edf);
98  }
99 
102  FERMAT_DEVICE
103  void update(
104  const uint32 nee_slot,
105  const uint32 nee_sample,
106  const cugar::Vector3f w,
107  const bool occluded)
108  {}
109 
110  MeshLight mesh_light;
111 };
112 
FERMAT_HOST_DEVICE DirectLightingMesh(const MeshLight _mesh_light)
Definition: direct_lighting_mesh.h:54
FERMAT_DEVICE uint32 sample(const uint32 nee_slot, const float z[3], VertexGeometryId *light_vertex, VertexGeometry *light_vertex_geom, float *light_pdf, Edf *light_edf)
Definition: direct_lighting_mesh.h:74
Definition: vertex.h:105
Definition: lights.h:299
Definition: direct_lighting_mesh.h:41
FERMAT_DEVICE uint32 preprocess_vertex(const RenderingContextView &renderer, const EyeVertex &ev, const uint32 pixel, const uint32 bounce, const bool is_secondary_diffuse, const float cone_radius, const cugar::Bbox3f scene_bbox)
Definition: direct_lighting_mesh.h:59
FERMAT_HOST_DEVICE void map(const uint32_t prim_id, const cugar::Vector2f &uv, VertexGeometry *geom, float *pdf, Edf *edf) const
Definition: lights.h:584
Definition: vertex.h:92
FERMAT_DEVICE void map(const uint32 prev_nee_slot, const uint32 triId, const cugar::Vector2f uv, const VertexGeometry light_vertex_geom, float *light_pdf, Edf *light_edf)
Definition: direct_lighting_mesh.h:89
Definition: bpt_utils.h:583
FERMAT_DEVICE void update(const uint32 nee_slot, const uint32 nee_sample, const cugar::Vector3f w, const bool occluded)
Definition: direct_lighting_mesh.h:103
FERMAT_HOST_DEVICE bool sample(const float *Z, uint32_t *prim_id, cugar::Vector2f *uv, VertexGeometry *geom, float *pdf, Edf *edf) const
Definition: lights.h:521
Definition: edf.h:49
Definition: renderer_view.h:80
FERMAT_HOST_DEVICE DirectLightingMesh()
Definition: direct_lighting_mesh.h:49