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 LightSample operator()(HdEmbree_Dome const& dome);
42
43private:
44 HdEmbreeLightSampler(HdEmbree_LightData const& lightData,
45 GfVec3f const& hitPosition,
46 GfVec3f const& normal,
47 float u1,
48 float u2) :
49 _lightData(lightData),
50 _hitPosition(hitPosition),
51 _normal(normal),
52 _u1(u1),
53 _u2(u2)
54 {}
55
56 HdEmbree_LightData const& _lightData;
57 GfVec3f const& _hitPosition;
58 GfVec3f const& _normal;
59 float _u1;
60 float _u2;
61};
62
63PXR_NAMESPACE_CLOSE_SCOPE
64
65#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