Fixed lighting mode in EGMC editor, disabled EGMC editor outside MP2/3, fixed a crash in the anim params editor

This commit is contained in:
parax0
2016-01-16 13:32:40 -07:00
parent 440c3ad484
commit af94b54acf
6 changed files with 35 additions and 14 deletions

View File

@@ -8,7 +8,7 @@ CModelNode::CModelNode(CScene *pScene, CSceneNode *pParent, CModel *pModel) : CS
{
SetModel(pModel);
mScale = CVector3f(1.f);
mLightingEnabled = true;
mWorldModel = false;
mForceAlphaOn = false;
mEnableScanOverlay = false;
mTintColor = CColor::skWhite;
@@ -39,21 +39,38 @@ void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInf
if (!mpModel) return;
if (mForceAlphaOn) Options = (FRenderOptions) (Options & ~eNoAlpha);
if (mLightingEnabled)
if (!mWorldModel)
{
CGraphics::SetDefaultLighting();
CGraphics::UpdateLightBlock();
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor;
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
CGraphics::sPixelBlock.TevColor = CColor::skWhite;
}
else
{
CGraphics::sNumLights = 0;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skBlack;
bool IsLightingEnabled = CGraphics::sLightMode == CGraphics::eWorldLighting || ViewInfo.GameMode;
if (IsLightingEnabled)
{
CGraphics::sNumLights = 0;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skBlack;
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
CGraphics::UpdateLightBlock();
}
else
{
LoadLights(ViewInfo);
if (CGraphics::sLightMode == CGraphics::eNoLighting)
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skWhite;
}
float Mul = CGraphics::sWorldLightMultiplier;
CGraphics::sPixelBlock.TevColor = CColor(Mul,Mul,Mul);
}
CGraphics::sPixelBlock.TevColor = CColor::skWhite;
CGraphics::sPixelBlock.TintColor = TintColor(ViewInfo);
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
LoadModelMatrix();
if (ComponentIndex < 0)

View File

@@ -8,7 +8,7 @@ class CModelNode : public CSceneNode
{
TResPtr<CModel> mpModel;
u32 mActiveMatSet;
bool mLightingEnabled;
bool mWorldModel;
bool mForceAlphaOn;
CColor mTintColor;
bool mEnableScanOverlay;
@@ -29,7 +29,7 @@ public:
void SetModel(CModel *pModel);
inline void SetMatSet(u32 MatSet) { mActiveMatSet = MatSet; }
inline void SetDynamicLighting(bool Enable) { mLightingEnabled = Enable; }
inline void SetWorldModel(bool World) { mWorldModel = World; }
inline void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
inline void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
inline void ClearTintColor() { mTintColor = CColor::skWhite; }
@@ -37,7 +37,7 @@ public:
inline void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
inline CModel* Model() const { return mpModel; }
inline u32 MatSet() const { return mActiveMatSet; }
inline bool IsDynamicLightingEnabled() const { return mLightingEnabled; }
inline bool IsWorldModel() const { return mWorldModel; }
inline u32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; }
};

View File

@@ -106,7 +106,7 @@ void CScene::SetActiveArea(CGameArea *pArea)
CModel *pModel = mpArea->GetTerrainModel(iMdl);
CModelNode *pNode = CreateModelNode(pModel);
pNode->SetName("World Model " + TString::FromInt32(iMdl, 0, 10));
pNode->SetDynamicLighting(false);
pNode->SetWorldModel(true);
}
CreateCollisionNode(mpArea->GetCollision());