Fixes for standable collision tris visualization in Metroid Prime 3
This commit is contained in:
parent
9654cf1428
commit
57c2830b04
|
@ -1,5 +1,6 @@
|
|||
#include "CCollisionMaterial.h"
|
||||
#include "EGame.h"
|
||||
#include <Common/Assert.h>
|
||||
#include <unordered_map>
|
||||
|
||||
ECollisionFlag CCollisionMaterial::SurfaceType(EGame Game) const
|
||||
|
@ -71,3 +72,14 @@ CColor CCollisionMaterial::SurfaceColor(EGame Game) const
|
|||
auto FindColor = gkTypeToColor.find(SurfType);
|
||||
return (FindColor == gkTypeToColor.end() ? CColor::skWhite : FindColor->second);
|
||||
}
|
||||
|
||||
bool CCollisionMaterial::IsFloor() const
|
||||
{
|
||||
return HasFlag(eCF_Floor) && !HasFlag(eCF_JumpNotAllowed);
|
||||
}
|
||||
|
||||
bool CCollisionMaterial::IsUnstandable(EGame Game) const
|
||||
{
|
||||
BREAK_ONLY_ASSERT(!HasFlag(eCF_Wood));
|
||||
return HasFlag(eCF_JumpNotAllowed) || (Game >= eEchoesDemo && !HasFlag(eCF_Floor) && HasAnyFlags(eCF_Wall | eCF_Ceiling));
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ enum ECollisionFlag
|
|||
eCF_ScanThru = 0x01000000,
|
||||
eCF_AiWalkThru = 0x02000000,
|
||||
eCF_FlippedTri = 0x04000000,
|
||||
eCF_Floor = 0x08000000,
|
||||
eCF_AiBlock = 0x10000000,
|
||||
eCF_JumpNotAllowed = 0x20000000,
|
||||
eCF_SpiderBall = 0x40000000,
|
||||
eCF_WallJump = 0x80000000
|
||||
eCF_Ceiling = 0x08000000,
|
||||
eCF_Wall = 0x10000000,
|
||||
eCF_Floor = 0x20000000,
|
||||
eCF_AiBlock = 0x40000000,
|
||||
eCF_JumpNotAllowed = 0x80000000
|
||||
};
|
||||
|
||||
class CCollisionMaterial : public TFlags<ECollisionFlag>
|
||||
|
@ -56,6 +56,8 @@ class CCollisionMaterial : public TFlags<ECollisionFlag>
|
|||
public:
|
||||
ECollisionFlag SurfaceType(EGame Game) const;
|
||||
CColor SurfaceColor(EGame Game) const;
|
||||
bool IsFloor() const;
|
||||
bool IsUnstandable(EGame Game) const;
|
||||
|
||||
inline u64 RawFlags() const { return mRawFlags; }
|
||||
};
|
||||
|
|
|
@ -66,6 +66,8 @@ void CCollisionLoader::ReadPropertyFlags(IInputStream& rSrc)
|
|||
if (RawFlags & 0x02000000) Material |= eCF_FlippedTri;
|
||||
if (RawFlags & 0x08000000) Material |= eCF_ScanThru;
|
||||
if (RawFlags & 0x10000000) Material |= eCF_AiWalkThru;
|
||||
if (RawFlags & 0x20000000) Material |= eCF_Ceiling;
|
||||
if (RawFlags & 0x40000000) Material |= eCF_Wall;
|
||||
if (RawFlags & 0x80000000) Material |= eCF_Floor;
|
||||
}
|
||||
|
||||
|
@ -95,12 +97,12 @@ void CCollisionLoader::ReadPropertyFlags(IInputStream& rSrc)
|
|||
if (RawFlags & 0x02000000) Material |= eCF_Rubber;
|
||||
if (RawFlags & 0x08000000) Material |= eCF_ScanThru;
|
||||
if (RawFlags & 0x10000000) Material |= eCF_AiWalkThru;
|
||||
if (RawFlags & 0x20000000) Material |= eCF_Ceiling;
|
||||
if (RawFlags & 0x40000000) Material |= eCF_Wall;
|
||||
if (RawFlags & 0x80000000) Material |= eCF_Floor;
|
||||
|
||||
if (RawFlags & 0x0001000000000000) Material |= eCF_AiBlock;
|
||||
if (RawFlags & 0x0400000000000000) Material |= eCF_JumpNotAllowed;
|
||||
if (RawFlags & 0x2000000000000000) Material |= eCF_SpiderBall;
|
||||
if (RawFlags & 0x4000000000000000) Material |= eCF_WallJump;
|
||||
}
|
||||
|
||||
else if (mVersion == eReturns)
|
||||
|
|
|
@ -68,8 +68,8 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
|
|||
else if (CollisionGame != eReturns && rkViewInfo.CollisionSettings.TintWithSurfaceColor)
|
||||
Tint *= rMat.SurfaceColor(CollisionGame);
|
||||
|
||||
bool IsFloor = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.HasFlag(eCF_Floor) : true) || CollisionGame == eReturns;
|
||||
bool IsUnstandable = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.HasFlag(eCF_JumpNotAllowed) : false) && CollisionGame != eReturns;
|
||||
bool IsFloor = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsFloor() : true) || CollisionGame == eReturns;
|
||||
bool IsUnstandable = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsUnstandable(CollisionGame) : false) && CollisionGame != eReturns;
|
||||
CDrawUtil::UseCollisionShader(IsFloor, IsUnstandable, Tint);
|
||||
pMesh->DrawMaterial(iMat, false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue