Added a basic UI to change collision render settings, added the ability to color collision based on the surface type

This commit is contained in:
parax0
2016-12-26 23:02:32 -07:00
parent 78baa42bce
commit be40dfdf02
13 changed files with 254 additions and 8 deletions

View File

@@ -45,13 +45,72 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER
for (u32 iMat = 0; iMat < pMesh->NumMaterials(); iMat++)
{
CDrawUtil::UseCollisionShader(BaseTint);
SCollisionMaterial& rMat = pMesh->GetMaterial(iMat);
if (rkViewInfo.CollisionSettings.HideMask != 0 && (rMat.RawFlags & rkViewInfo.CollisionSettings.HideMask) == rkViewInfo.CollisionSettings.HideMask)
continue;
CColor Tint = BaseTint;
if (rkViewInfo.CollisionSettings.HighlightMask != 0 && (rMat.RawFlags & rkViewInfo.CollisionSettings.HighlightMask) == rkViewInfo.CollisionSettings.HighlightMask)
Tint *= CColor::skRed;
else if (mpCollision->Game() <= ePrime && rkViewInfo.CollisionSettings.DrawMode == eCDM_TintSurfaceType)
{
// Organic
if (rMat.RawFlags & 0x00800000)
Tint *= CColor::Integral(130, 130, 250); // Purple
// Wood
else if (rMat.RawFlags & 0x00400000)
Tint *= CColor::Integral(190, 140, 105); // Brown
// Sand
else if (rMat.RawFlags & 0x00020000)
Tint *= CColor::Integral(230, 200, 170); // Light Brown
// Shield
else if (rMat.RawFlags & 0x00010000)
Tint *= CColor::Integral(250, 230, 60); // Yellow
// Glass
else if (rMat.RawFlags & 0x00008000)
Tint *= CColor::Integral(20, 255, 190); // Greenish/Bluish
// Snow
else if (rMat.RawFlags & 0x00000800)
Tint *= CColor::Integral(230, 255, 255); // *Very* light blue
// Lava
else if (rMat.RawFlags & 0x00000200)
Tint *= CColor::Integral(200, 30, 30); // Red
// Rock
else if (rMat.RawFlags & 0x00000100)
Tint *= CColor::Integral(150, 130, 120); // Brownish-gray
// Phazon
else if (rMat.RawFlags & 0x00000080)
Tint *= CColor::Integral(0, 128, 255); // Blue
// Metal Grating
else if (rMat.RawFlags & 0x00000040)
Tint *= CColor::Integral(170, 170, 170); // Gray
// Ice
else if (rMat.RawFlags & 0x00000010)
Tint *= CColor::Integral(200, 255, 255); // Light blue
// Grass
else if (rMat.RawFlags & 0x00000008)
Tint *= CColor::Integral(90, 150, 70); // Green
// Metal
else if (rMat.RawFlags & 0x00000004)
Tint *= CColor::Integral(110, 110, 110); // Dark gray
// Stone
else if (rMat.RawFlags & 0x00000002)
Tint *= CColor::Integral(220, 215, 160); // Brown/green ish
}
CDrawUtil::UseCollisionShader(Tint);
pMesh->DrawMaterial(iMat);
}
}
//CDrawUtil::UseColorShader(CColor::skTransparentBlack);
//mpCollision->DrawWireframe();
if (rkViewInfo.CollisionSettings.DrawWireframe)
{
CDrawUtil::UseColorShader(CColor::skTransparentBlack);
mpCollision->DrawWireframe();
}
}
SRayIntersection CCollisionNode::RayNodeIntersectTest(const CRay& /*rkRay*/, u32 /*AssetID*/, const SViewInfo& /*rkViewInfo*/)