-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathlight.h
109 lines (88 loc) · 2.23 KB
/
light.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//
// Copyright 2024 Pixar
//
// Licensed under the terms set forth in the LICENSE.txt file available at
// https://openusd.org/license.
//
#ifndef PXR_IMAGING_PLUGIN_HD_EMBREE_LIGHT_H
#define PXR_IMAGING_PLUGIN_HD_EMBREE_LIGHT_H
#include "pxr/base/gf/vec3f.h"
#include "pxr/base/gf/matrix3f.h"
#include "pxr/base/gf/matrix4f.h"
#include "pxr/imaging/hd/light.h"
#include <embree3/rtcore_common.h>
#include <embree3/rtcore_geometry.h>
#include <limits>
#include <variant>
PXR_NAMESPACE_OPEN_SCOPE
class HdEmbreeRenderer;
struct HdEmbree_UnknownLight
{};
struct HdEmbree_Cylinder
{
float radius;
float length;
};
struct HdEmbree_Disk
{
float radius;
};
struct HdEmbree_Rect
{
float width;
float height;
};
struct HdEmbree_Sphere
{
float radius;
};
using HdEmbree_LightVariant = std::variant<
HdEmbree_UnknownLight,
HdEmbree_Cylinder,
HdEmbree_Disk,
HdEmbree_Rect,
HdEmbree_Sphere>;
struct HdEmbree_Shaping
{
GfVec3f focusTint;
float focus = 0.0f;
float coneAngle = 180.0f;
float coneSoftness = 0.0f;
};
struct HdEmbree_LightData
{
GfMatrix4f xformLightToWorld;
GfMatrix3f normalXformLightToWorld;
GfMatrix4f xformWorldToLight;
GfVec3f color;
float intensity = 1.0f;
float exposure = 0.0f;
float colorTemperature = 6500.0f;
bool enableColorTemperature = false;
HdEmbree_LightVariant lightVariant;
bool normalize = false;
bool visible = true;
HdEmbree_Shaping shaping;
};
class HdEmbree_Light final : public HdLight
{
public:
HdEmbree_Light(SdfPath const& id, TfToken const& lightType);
~HdEmbree_Light();
/// Synchronizes state from the delegate to this object.
void Sync(HdSceneDelegate* sceneDelegate,
HdRenderParam* renderParam,
HdDirtyBits* dirtyBits) override;
/// Returns the minimal set of dirty bits to place in the
/// change tracker for use in the first sync of this prim.
/// Typically this would be all dirty bits.
HdDirtyBits GetInitialDirtyBitsMask() const override;
void Finalize(HdRenderParam *renderParam) override;
HdEmbree_LightData const& LightData() const {
return _lightData;
}
private:
HdEmbree_LightData _lightData;
};
PXR_NAMESPACE_CLOSE_SCOPE
#endif