Loading...
Searching...
No Matches
lightSamplers.h
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6#ifndef PXR_IMAGING_PLUGIN_HD_EMBREE_LIGHT_SAMPLERS_H
7#define PXR_IMAGING_PLUGIN_HD_EMBREE_LIGHT_SAMPLERS_H
8
9#include "pxr/pxr.h"
10#include "pxr/base/gf/vec3f.h"
11
12#include "pxr/imaging/plugin/hdEmbree/light.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
20public:
21 struct LightSample {
22 GfVec3f Li;
23 GfVec3f wI;
24 float dist;
25 float invPdfW;
26 };
27
28 static LightSample GetLightSample(
29 HdEmbree_LightData const& lightData,
30 GfVec3f const& hitPosition,
31 GfVec3f const& normal,
32 float u1,
33 float u2);
34
35 // callables to be used with std::visit
36 LightSample operator()(HdEmbree_UnknownLight const& rect);
37 LightSample operator()(HdEmbree_Rect const& rect);
38 LightSample operator()(HdEmbree_Sphere const& sphere);
39 LightSample operator()(HdEmbree_Disk const& disk);
40 LightSample operator()(HdEmbree_Cylinder const& cylinder);
41
42private:
43 HdEmbreeLightSampler(HdEmbree_LightData const& lightData,
44 GfVec3f const& hitPosition,
45 GfVec3f const& normal,
46 float u1,
47 float u2) :
48 _lightData(lightData),
49 _hitPosition(hitPosition),
50 _normal(normal),
51 _u1(u1),
52 _u2(u2)
53 {}
54
55 HdEmbree_LightData const& _lightData;
56 GfVec3f const& _hitPosition;
57 GfVec3f const& _normal;
58 float _u1;
59 float _u2;
60};
61
62PXR_NAMESPACE_CLOSE_SCOPE
63
64#endif // PXR_IMAGING_PLUGIN_HD_EMBREE_LIGHT_SAMPLERS_H
Basic type for a vector of 3 float components.
Definition: vec3f.h:46
Utility class to help sample Embree lights for direct lighting.
Definition: lightSamplers.h:19