diff --git a/Scene/CSceneNode.cpp b/Scene/CSceneNode.cpp index 13b5b84e..27f5b2a1 100644 --- a/Scene/CSceneNode.cpp +++ b/Scene/CSceneNode.cpp @@ -175,31 +175,30 @@ void CSceneNode::BuildLightList(CGameArea *pArea) mLights[i] = LightEntries[i].pLight; } -void CSceneNode::LoadLights() +void CSceneNode::LoadLights(const SViewInfo& ViewInfo) { CGraphics::sNumLights = 0; - switch (CGraphics::sLightMode) + if (CGraphics::sLightMode == CGraphics::WorldLighting || ViewInfo.GameMode) { - case CGraphics::NoLighting: - // No lighting: default ambient color, no dynamic lights - CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor.ToVector4f(); - break; - - case CGraphics::BasicLighting: - // Basic lighting: default ambient color, default dynamic lights - CGraphics::SetDefaultLighting(); - CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor.ToVector4f(); - break; - - case CGraphics::WorldLighting: // World lighting: world ambient color, node dynamic lights CGraphics::sVertexBlock.COLOR0_Amb = mAmbientColor.ToVector4f(); for (u32 iLight = 0; iLight < mLightCount; iLight++) mLights[iLight]->Load(); + } - break; + else if (CGraphics::sLightMode == CGraphics::BasicLighting) + { + // Basic lighting: default ambient color, default dynamic lights + CGraphics::SetDefaultLighting(); + CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor.ToVector4f(); + } + + else if (CGraphics::sLightMode == CGraphics::NoLighting) + { + // No lighting: default ambient color, no dynamic lights + CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor.ToVector4f(); } CGraphics::UpdateLightBlock(); diff --git a/Scene/CSceneNode.h b/Scene/CSceneNode.h index 6c36a31d..75b8e6b9 100644 --- a/Scene/CSceneNode.h +++ b/Scene/CSceneNode.h @@ -66,7 +66,7 @@ public: void SetInheritance(bool InheritPos, bool InheritRot, bool InheritScale); void LoadModelMatrix(); void BuildLightList(CGameArea *pArea); - void LoadLights(); + void LoadLights(const SViewInfo& ViewInfo); void DrawBoundingBox(); // Transform diff --git a/Scene/CScriptNode.cpp b/Scene/CScriptNode.cpp index 05fbaadf..a9212470 100644 --- a/Scene/CScriptNode.cpp +++ b/Scene/CScriptNode.cpp @@ -172,7 +172,7 @@ void CScriptNode::Draw(ERenderOptions Options, const SViewInfo& ViewInfo) if (mpActiveModel) { LoadModelMatrix(); - LoadLights(); + LoadLights(ViewInfo); CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo).ToVector4f(); mpActiveModel->Draw(Options, 0); } @@ -190,7 +190,7 @@ void CScriptNode::Draw(ERenderOptions Options, const SViewInfo& ViewInfo) glDepthMask(GL_TRUE); LoadModelMatrix(); - LoadLights(); + LoadLights(ViewInfo); CGraphics::UpdateVertexBlock(); CGraphics::UpdateLightBlock(); CDrawUtil::DrawShadedCube(CColor::skTransparentPurple * TintColor(ViewInfo)); @@ -210,7 +210,7 @@ void CScriptNode::DrawAsset(ERenderOptions Options, u32 Asset, const SViewInfo& CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo).ToVector4f(); LoadModelMatrix(); - LoadLights(); + LoadLights(ViewInfo); mpActiveModel->DrawSurface(Options, Asset, 0); }