Loading...
Searching...
No Matches
light.h
1//
2// Copyright 2024 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_PLUGIN_HD_EMBREE_LIGHT_H
8#define PXR_IMAGING_PLUGIN_HD_EMBREE_LIGHT_H
9
10#include "pxr/base/gf/vec3f.h"
13#include "pxr/imaging/hd/light.h"
14
15#include <embree4/rtcore_common.h>
16#include <embree4/rtcore_geometry.h>
17
18#include <limits>
19#include <variant>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
94
96
97struct HdEmbree_UnknownLight
98{};
99struct HdEmbree_Cylinder
100{
101 float radius;
102 float length;
103};
104
105struct HdEmbree_Disk
106{
107 float radius;
108};
109
110struct HdEmbree_Rect
111{
112 float width;
113 float height;
114};
115
116struct HdEmbree_Sphere
117{
118 float radius;
119};
120
121using HdEmbree_LightVariant = std::variant<
122 HdEmbree_UnknownLight,
123 HdEmbree_Cylinder,
124 HdEmbree_Disk,
125 HdEmbree_Rect,
126 HdEmbree_Sphere>;
127
128struct HdEmbree_LightTexture
129{
130 std::vector<GfVec3f> pixels;
131 int width = 0;
132 int height = 0;
133};
134
135struct HdEmbree_Shaping
136{
137 GfVec3f focusTint;
138 float focus = 0.0f;
139 float coneAngle = 180.0f;
140 float coneSoftness = 0.0f;
141};
142
143struct HdEmbree_LightData
144{
145 GfMatrix4f xformLightToWorld;
146 GfMatrix3f normalXformLightToWorld;
147 GfMatrix4f xformWorldToLight;
148 GfVec3f color;
149 HdEmbree_LightTexture texture;
150 float intensity = 1.0f;
151 float diffuse = 1.0f;
152 float exposure = 0.0f;
153 float colorTemperature = 6500.0f;
154 bool enableColorTemperature = false;
155 HdEmbree_LightVariant lightVariant;
156 bool normalize = false;
157 bool visible = true;
158 HdEmbree_Shaping shaping;
159};
160
161class HdEmbree_Light final : public HdLight
162{
163public:
164 HdEmbree_Light(SdfPath const& id, TfToken const& lightType);
165 ~HdEmbree_Light();
166
168 void Sync(HdSceneDelegate* sceneDelegate,
169 HdRenderParam* renderParam,
170 HdDirtyBits* dirtyBits) override;
171
175 HdDirtyBits GetInitialDirtyBitsMask() const override;
176
177 void Finalize(HdRenderParam *renderParam) override;
178
179 HdEmbree_LightData const& LightData() const {
180 return _lightData;
181 }
182
183private:
184 HdEmbree_LightData _lightData;
185};
186
187
188PXR_NAMESPACE_CLOSE_SCOPE
189
190#endif
Stores a 3x3 matrix of float elements.
Definition: matrix3f.h:65
Stores a 4x4 matrix of float elements.
Definition: matrix4f.h:71
Basic type for a vector of 3 float components.
Definition: vec3f.h:46
HdEmbreeRenderer implements a renderer on top of Embree's raycasting abilities.
Definition: renderer.h:53
A light model, used in conjunction with HdRenderPass.
Definition: light.h:67
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Adapter class providing data exchange with the client scene graph.
virtual HD_API void Finalize(HdRenderParam *renderParam)
Finalizes object resources.
virtual HdDirtyBits GetInitialDirtyBitsMask() const =0
Returns the minimal set of dirty bits to place in the change tracker for use in the first sync of thi...
virtual void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits)=0
Synchronizes state from the delegate to this object.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71