Skip to content

Commit 67919e7

Browse files
USD Viewer: add dome light for env map but make it invisible if there are other dome lights
1 parent e2ee8b2 commit 67919e7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Samples/USDViewer/src/USDViewer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,15 @@ void USDViewer::LoadStage()
413413
AddDirectionalLight("_HnDirectionalLight3_", 5000.f, pxr::GfRotation{pxr::GfVec3d{1, 0.0, 0.5}, -40}, 1024);
414414

415415
// Environment map
416-
if (!HasDomeLight(*m_Stage.Stage))
417416
{
417+
const bool StageHasDomeLight = HasDomeLight(*m_Stage.Stage);
418418
m_Stage.DomeLightId = SceneDelegateId.AppendChild(pxr::TfToken{"_HnDomeLight_"});
419419
pxr::UsdLuxDomeLight DomeLight = pxr::UsdLuxDomeLight::Define(m_Stage.Stage, m_Stage.DomeLightId);
420420
DomeLight.CreateTextureFileAttr().Set(pxr::SdfAssetPath{"textures/papermill.ktx"});
421+
if (StageHasDomeLight)
422+
{
423+
DomeLight.MakeInvisible();
424+
}
421425
}
422426

423427
#if 0

0 commit comments

Comments
 (0)