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:
parent
440c3ad484
commit
af94b54acf
|
@ -112,7 +112,7 @@ u32 CAnimationParameters::Unknown(u32 index)
|
||||||
// ************ SETTERS ************
|
// ************ SETTERS ************
|
||||||
void CAnimationParameters::SetResource(CResource *pRes)
|
void CAnimationParameters::SetResource(CResource *pRes)
|
||||||
{
|
{
|
||||||
if ((pRes->Type() == eAnimSet) || (pRes->Type() == eCharacter))
|
if (!pRes || (pRes->Type() == eAnimSet) || (pRes->Type() == eCharacter))
|
||||||
{
|
{
|
||||||
mpCharSet = pRes;
|
mpCharSet = pRes;
|
||||||
mNodeIndex = 0;
|
mNodeIndex = 0;
|
||||||
|
|
|
@ -8,7 +8,7 @@ CModelNode::CModelNode(CScene *pScene, CSceneNode *pParent, CModel *pModel) : CS
|
||||||
{
|
{
|
||||||
SetModel(pModel);
|
SetModel(pModel);
|
||||||
mScale = CVector3f(1.f);
|
mScale = CVector3f(1.f);
|
||||||
mLightingEnabled = true;
|
mWorldModel = false;
|
||||||
mForceAlphaOn = false;
|
mForceAlphaOn = false;
|
||||||
mEnableScanOverlay = false;
|
mEnableScanOverlay = false;
|
||||||
mTintColor = CColor::skWhite;
|
mTintColor = CColor::skWhite;
|
||||||
|
@ -39,21 +39,38 @@ void CModelNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewInf
|
||||||
if (!mpModel) return;
|
if (!mpModel) return;
|
||||||
if (mForceAlphaOn) Options = (FRenderOptions) (Options & ~eNoAlpha);
|
if (mForceAlphaOn) Options = (FRenderOptions) (Options & ~eNoAlpha);
|
||||||
|
|
||||||
if (mLightingEnabled)
|
if (!mWorldModel)
|
||||||
{
|
{
|
||||||
CGraphics::SetDefaultLighting();
|
CGraphics::SetDefaultLighting();
|
||||||
CGraphics::UpdateLightBlock();
|
CGraphics::UpdateLightBlock();
|
||||||
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor;
|
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor;
|
||||||
|
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
|
||||||
|
CGraphics::sPixelBlock.TevColor = CColor::skWhite;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CGraphics::sNumLights = 0;
|
bool IsLightingEnabled = CGraphics::sLightMode == CGraphics::eWorldLighting || ViewInfo.GameMode;
|
||||||
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skBlack;
|
|
||||||
|
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.TintColor = TintColor(ViewInfo);
|
||||||
CGraphics::sPixelBlock.LightmapMultiplier = 1.f;
|
|
||||||
LoadModelMatrix();
|
LoadModelMatrix();
|
||||||
|
|
||||||
if (ComponentIndex < 0)
|
if (ComponentIndex < 0)
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CModelNode : public CSceneNode
|
||||||
{
|
{
|
||||||
TResPtr<CModel> mpModel;
|
TResPtr<CModel> mpModel;
|
||||||
u32 mActiveMatSet;
|
u32 mActiveMatSet;
|
||||||
bool mLightingEnabled;
|
bool mWorldModel;
|
||||||
bool mForceAlphaOn;
|
bool mForceAlphaOn;
|
||||||
CColor mTintColor;
|
CColor mTintColor;
|
||||||
bool mEnableScanOverlay;
|
bool mEnableScanOverlay;
|
||||||
|
@ -29,7 +29,7 @@ public:
|
||||||
void SetModel(CModel *pModel);
|
void SetModel(CModel *pModel);
|
||||||
|
|
||||||
inline void SetMatSet(u32 MatSet) { mActiveMatSet = MatSet; }
|
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 ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; }
|
||||||
inline void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
|
inline void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; }
|
||||||
inline void ClearTintColor() { mTintColor = CColor::skWhite; }
|
inline void ClearTintColor() { mTintColor = CColor::skWhite; }
|
||||||
|
@ -37,7 +37,7 @@ public:
|
||||||
inline void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
|
inline void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; }
|
||||||
inline CModel* Model() const { return mpModel; }
|
inline CModel* Model() const { return mpModel; }
|
||||||
inline u32 MatSet() const { return mActiveMatSet; }
|
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; }
|
inline u32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ void CScene::SetActiveArea(CGameArea *pArea)
|
||||||
CModel *pModel = mpArea->GetTerrainModel(iMdl);
|
CModel *pModel = mpArea->GetTerrainModel(iMdl);
|
||||||
CModelNode *pNode = CreateModelNode(pModel);
|
CModelNode *pNode = CreateModelNode(pModel);
|
||||||
pNode->SetName("World Model " + TString::FromInt32(iMdl, 0, 10));
|
pNode->SetName("World Model " + TString::FromInt32(iMdl, 0, 10));
|
||||||
pNode->SetDynamicLighting(false);
|
pNode->SetWorldModel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateCollisionNode(mpArea->GetCollision());
|
CreateCollisionNode(mpArea->GetCollision());
|
||||||
|
|
|
@ -67,7 +67,7 @@ void WAnimParamsEditor::SetParameters(const CAnimationParameters& params)
|
||||||
void WAnimParamsEditor::OnResourceChanged(QString path)
|
void WAnimParamsEditor::OnResourceChanged(QString path)
|
||||||
{
|
{
|
||||||
CResource *pRes = gResCache.GetResource(path.toStdString());
|
CResource *pRes = gResCache.GetResource(path.toStdString());
|
||||||
if (pRes->Type() != eAnimSet) pRes = nullptr;
|
if (pRes && pRes->Type() != eAnimSet) pRes = nullptr;
|
||||||
|
|
||||||
mParams.SetResource(pRes);
|
mParams.SetResource(pRes);
|
||||||
emit ParametersChanged(mParams);
|
emit ParametersChanged(mParams);
|
||||||
|
|
|
@ -150,16 +150,20 @@ void CWorldEditor::SetArea(CWorld *pWorld, CGameArea *pArea)
|
||||||
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
|
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
|
||||||
if (mpWorld->Version() == eCorruption)
|
if (mpWorld->Version() == eCorruption)
|
||||||
{
|
{
|
||||||
ui->menuBloom->setEnabled(true);
|
ui->menuBloom->setVisible(true);
|
||||||
on_ActionFakeBloom_triggered();
|
on_ActionFakeBloom_triggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->menuBloom->setEnabled(false);
|
ui->menuBloom->setVisible(false);
|
||||||
on_ActionNoBloom_triggered();
|
on_ActionNoBloom_triggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable EGMC editing for Prime 1 and DKCR
|
||||||
|
bool AllowEGMC = ( (mpWorld->Version() >= eEchoesDemo) && (mpWorld->Version() <= eCorruption) );
|
||||||
|
ui->ActionEditPoiToWorldMap->setVisible(AllowEGMC);
|
||||||
|
|
||||||
// Set up sidebar tabs
|
// Set up sidebar tabs
|
||||||
CMasterTemplate *pMaster = CMasterTemplate::GetMasterForGame(mpArea->Version());
|
CMasterTemplate *pMaster = CMasterTemplate::GetMasterForGame(mpArea->Version());
|
||||||
ui->InstancesTabContents->SetMaster(pMaster);
|
ui->InstancesTabContents->SetMaster(pMaster);
|
||||||
|
|
Loading…
Reference in New Issue