MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / GetLightColor

Function GetLightColor

Hydrogent/src/HnLight.cpp:184–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184static float3 GetLightColor(pxr::HdSceneDelegate& SceneDelegate, const pxr::SdfPath& Id)
185{
186 float3 Color{1, 1, 1};
187
188 {
189 const pxr::VtValue ColorVal = SceneDelegate.GetLightParamValue(Id, pxr::HdLightTokens->color);
190 if (ColorVal.IsHolding<pxr::GfVec3f>())
191 {
192 Color = ToFloat3(ColorVal.Get<pxr::GfVec3f>());
193 }
194 }
195
196 {
197 const pxr::VtValue EnableColorTempVal = SceneDelegate.GetLightParamValue(Id, pxr::HdLightTokens->enableColorTemperature);
198 if (EnableColorTempVal.GetWithDefault<bool>(false))
199 {
200 pxr::VtValue ColorTempVal = SceneDelegate.GetLightParamValue(Id, pxr::HdLightTokens->colorTemperature);
201 if (ColorTempVal.IsHolding<float>())
202 {
203 float ColorTemp = ColorTempVal.Get<float>();
204 float3 BlackbodyColor = BlackbodyTemperatureAsRgb(ColorTemp);
205 Color *= BlackbodyColor;
206 }
207 }
208 }
209
210 return Color;
211}
212
213static float GetLightIntensity(pxr::HdSceneDelegate& SceneDelegate, const pxr::SdfPath& Id)
214{

Callers 1

ApproximateAreaLightMethod · 0.85

Calls 3

ToFloat3Function · 0.85
GetLightParamValueMethod · 0.80

Tested by

no test coverage detected