Force world lighting in game mode

This commit is contained in:
parax0 2015-11-26 03:46:09 -07:00
parent c132197df0
commit 6ceb1b9230
3 changed files with 18 additions and 19 deletions

View File

@ -175,31 +175,30 @@ void CSceneNode::BuildLightList(CGameArea *pArea)
mLights[i] = LightEntries[i].pLight; mLights[i] = LightEntries[i].pLight;
} }
void CSceneNode::LoadLights() void CSceneNode::LoadLights(const SViewInfo& ViewInfo)
{ {
CGraphics::sNumLights = 0; 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 // World lighting: world ambient color, node dynamic lights
CGraphics::sVertexBlock.COLOR0_Amb = mAmbientColor.ToVector4f(); CGraphics::sVertexBlock.COLOR0_Amb = mAmbientColor.ToVector4f();
for (u32 iLight = 0; iLight < mLightCount; iLight++) for (u32 iLight = 0; iLight < mLightCount; iLight++)
mLights[iLight]->Load(); 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(); CGraphics::UpdateLightBlock();

View File

@ -66,7 +66,7 @@ public:
void SetInheritance(bool InheritPos, bool InheritRot, bool InheritScale); void SetInheritance(bool InheritPos, bool InheritRot, bool InheritScale);
void LoadModelMatrix(); void LoadModelMatrix();
void BuildLightList(CGameArea *pArea); void BuildLightList(CGameArea *pArea);
void LoadLights(); void LoadLights(const SViewInfo& ViewInfo);
void DrawBoundingBox(); void DrawBoundingBox();
// Transform // Transform

View File

@ -172,7 +172,7 @@ void CScriptNode::Draw(ERenderOptions Options, const SViewInfo& ViewInfo)
if (mpActiveModel) if (mpActiveModel)
{ {
LoadModelMatrix(); LoadModelMatrix();
LoadLights(); LoadLights(ViewInfo);
CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo).ToVector4f(); CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo).ToVector4f();
mpActiveModel->Draw(Options, 0); mpActiveModel->Draw(Options, 0);
} }
@ -190,7 +190,7 @@ void CScriptNode::Draw(ERenderOptions Options, const SViewInfo& ViewInfo)
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
LoadModelMatrix(); LoadModelMatrix();
LoadLights(); LoadLights(ViewInfo);
CGraphics::UpdateVertexBlock(); CGraphics::UpdateVertexBlock();
CGraphics::UpdateLightBlock(); CGraphics::UpdateLightBlock();
CDrawUtil::DrawShadedCube(CColor::skTransparentPurple * TintColor(ViewInfo)); 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(); CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo).ToVector4f();
LoadModelMatrix(); LoadModelMatrix();
LoadLights(); LoadLights(ViewInfo);
mpActiveModel->DrawSurface(Options, Asset, 0); mpActiveModel->DrawSurface(Options, Asset, 0);
} }