| 305 | |
| 306 | |
| 307 | bool HnLight::ApproximateAreaLight(pxr::HdSceneDelegate& SceneDelegate, float MetersPerUnit) |
| 308 | { |
| 309 | bool ParamsDirty = false; |
| 310 | |
| 311 | const pxr::SdfPath& Id = GetId(); |
| 312 | |
| 313 | // Light color |
| 314 | { |
| 315 | const float3 Color = GetLightColor(SceneDelegate, Id); |
| 316 | if (Color != m_Params.Color) |
| 317 | { |
| 318 | m_Params.Color = Color; |
| 319 | ParamsDirty = true; |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | // Light intensity |
| 324 | { |
| 325 | float Intensity = GetLightIntensity(SceneDelegate, Id); |
| 326 | float ExposedPower = GetLightExposedPower(SceneDelegate, Id); |
| 327 | Intensity *= ExposedPower; |
| 328 | |
| 329 | pxr::VtValue NormalizeVal = SceneDelegate.GetLightParamValue(Id, pxr::HdLightTokens->normalize); |
| 330 | if (!NormalizeVal.GetWithDefault<bool>(false)) |
| 331 | { |
| 332 | float LightArea = GetLightArea(SceneDelegate, Id, m_TypeId, MetersPerUnit); |
| 333 | Intensity *= LightArea; |
| 334 | } |
| 335 | |
| 336 | if (Intensity != m_Params.Intensity) |
| 337 | { |
| 338 | m_Params.Intensity = Intensity; |
| 339 | ParamsDirty = true; |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | if (m_TypeId == pxr::HdPrimTypeTokens->rectLight || |
| 344 | m_TypeId == pxr::HdPrimTypeTokens->diskLight) |
| 345 | { |
| 346 | float ShapingConeAngle = GetShapingConeAngle(SceneDelegate, Id); |
| 347 | if (ShapingConeAngle != m_Params.OuterConeAngle) |
| 348 | { |
| 349 | m_Params.InnerConeAngle = 0; |
| 350 | m_Params.OuterConeAngle = ShapingConeAngle; |
| 351 | ParamsDirty = true; |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | return ParamsDirty; |
| 356 | } |
| 357 | |
| 358 | static pxr::SdfAssetPath GetTextureFile(pxr::HdSceneDelegate& SceneDelegate, const pxr::SdfPath& Id) |
| 359 | { |
nothing calls this directly
no test coverage detected