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;
}
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();

View File

@ -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

View File

@ -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);
}