Added support for "white ambient" flag in DKCR to fix black world geometry
This commit is contained in:
parent
63bdc1def7
commit
1727a337c6
|
@ -36,7 +36,8 @@ public:
|
||||||
eIndStage = 0x400,
|
eIndStage = 0x400,
|
||||||
eLightmap = 0x800,
|
eLightmap = 0x800,
|
||||||
eShortTexCoord = 0x2000,
|
eShortTexCoord = 0x2000,
|
||||||
eAllSettings = 0x2FF8
|
eDrawWhiteAmbient = 0x80000, // this flag is possibly incorrect! attempted fix for black world models in DKCR
|
||||||
|
eAllSettings = 0x82FF8
|
||||||
};
|
};
|
||||||
DECLARE_FLAGS(EMaterialOption, FMaterialOptions)
|
DECLARE_FLAGS(EMaterialOption, FMaterialOptions)
|
||||||
|
|
||||||
|
|
|
@ -261,8 +261,9 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
|
||||||
pMat->mOptions |= CMaterial::eTransparent;
|
pMat->mOptions |= CMaterial::eTransparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags & 0x10) pMat->mOptions |= CMaterial::ePunchthrough;
|
if (Flags & 0x10) pMat->mOptions |= CMaterial::ePunchthrough;
|
||||||
if (Flags & 0x100) pMat->mOptions |= CMaterial::eOccluder;
|
if (Flags & 0x100) pMat->mOptions |= CMaterial::eOccluder;
|
||||||
|
if (Flags & 0x80000) pMat->mOptions |= CMaterial::eDrawWhiteAmbient;
|
||||||
mHas0x400 = ((Flags & 0x400) != 0);
|
mHas0x400 = ((Flags & 0x400) != 0);
|
||||||
|
|
||||||
mpFile->Seek(0x8, SEEK_CUR); // Don't know what any of this is
|
mpFile->Seek(0x8, SEEK_CUR); // Don't know what any of this is
|
||||||
|
|
|
@ -26,8 +26,6 @@ class CScriptLoader
|
||||||
CScriptObject* LoadObjectMP2(IInputStream& SCLY);
|
CScriptObject* LoadObjectMP2(IInputStream& SCLY);
|
||||||
CScriptLayer* LoadLayerMP2(IInputStream& SCLY);
|
CScriptLayer* LoadLayerMP2(IInputStream& SCLY);
|
||||||
|
|
||||||
void SetupAttribs();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CScriptLayer* LoadLayer(IInputStream& SCLY, CGameArea *pArea, EGame version);
|
static CScriptLayer* LoadLayer(IInputStream& SCLY, CGameArea *pArea, EGame version);
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,11 +58,12 @@ void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewIn
|
||||||
if (!mpModel) return;
|
if (!mpModel) return;
|
||||||
|
|
||||||
bool IsLightingEnabled = CGraphics::sLightMode == CGraphics::eWorldLighting || ViewInfo.GameMode;
|
bool IsLightingEnabled = CGraphics::sLightMode == CGraphics::eWorldLighting || ViewInfo.GameMode;
|
||||||
|
bool UseWhiteAmbient = (mpModel->GetMaterial()->Options() & CMaterial::eDrawWhiteAmbient) != 0;
|
||||||
|
|
||||||
if (IsLightingEnabled)
|
if (IsLightingEnabled)
|
||||||
{
|
{
|
||||||
CGraphics::sNumLights = 0;
|
CGraphics::sNumLights = 0;
|
||||||
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skBlack;
|
CGraphics::sVertexBlock.COLOR0_Amb = UseWhiteAmbient ? CColor::skWhite : CColor::skBlack;
|
||||||
CGraphics::sPixelBlock.LightmapMultiplier = 1.0f;
|
CGraphics::sPixelBlock.LightmapMultiplier = 1.0f;
|
||||||
CGraphics::UpdateLightBlock();
|
CGraphics::UpdateLightBlock();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +71,7 @@ void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewIn
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadLights(ViewInfo);
|
LoadLights(ViewInfo);
|
||||||
if (CGraphics::sLightMode == CGraphics::eNoLighting)
|
if (CGraphics::sLightMode == CGraphics::eNoLighting || UseWhiteAmbient)
|
||||||
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skWhite;
|
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skWhite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue