Set up game-neutral collision materials; Jump Not Allowed flag now flags that surface as unstandable; other minor fixes

This commit is contained in:
parax0
2017-01-11 06:29:30 -07:00
parent be40dfdf02
commit 08dee84367
13 changed files with 255 additions and 85 deletions

View File

@@ -329,14 +329,23 @@ void CDrawUtil::UseTextureShader(const CColor& TintColor)
CMaterial::KillCachedMaterial();
}
void CDrawUtil::UseCollisionShader(const CColor& TintColor /*= CColor::skWhite*/)
void CDrawUtil::UseCollisionShader(bool IsFloor, bool IsUnstandable, const CColor& TintColor /*= CColor::skWhite*/)
{
Init();
mpCollisionShader->SetCurrent();
// Force blend mode to opaque + set alpha to 0 to ensure collision geometry isn't bloomed
glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ZERO, GL_ZERO);
static GLuint TintColorLoc = mpCollisionShader->GetUniformLocation("TintColor");
glUniform4f(TintColorLoc, TintColor.R, TintColor.G, TintColor.B, TintColor.A);
static GLuint IsFloorLoc = mpCollisionShader->GetUniformLocation("IsFloor");
glUniform1i(IsFloorLoc, IsFloor ? 1 : 0);
static GLuint IsUnstandableLoc = mpCollisionShader->GetUniformLocation("IsUnstandable");
glUniform1i(IsUnstandableLoc, IsUnstandable ? 1 : 0);
CMaterial::KillCachedMaterial();
}

View File

@@ -89,7 +89,7 @@ public:
static void UseColorShaderLighting(const CColor& Color);
static void UseTextureShader();
static void UseTextureShader(const CColor& TintColor);
static void UseCollisionShader(const CColor& TintColor = CColor::skWhite);
static void UseCollisionShader(bool IsFloor, bool IsUnstandable, const CColor& TintColor = CColor::skWhite);
static CShader* GetTextShader();
static void LoadCheckerboardTexture(u32 GLTextureUnit);

View File

@@ -6,21 +6,24 @@
#include <Math/CMatrix4f.h>
#include <Math/CRay.h>
enum ECollisionDrawMode
{
eCDM_Default,
eCDM_TintSurfaceType
};
struct SCollisionRenderSettings
{
ECollisionDrawMode DrawMode;
u64 HighlightMask;
u64 HideMask;
bool DrawWireframe;
bool DrawBackfaces;
bool DrawAreaCollisionBounds;
bool TintWithSurfaceColor;
bool TintUnwalkableTris;
SCollisionRenderSettings()
: DrawMode(eCDM_TintSurfaceType), HighlightMask(0), HideMask(0), DrawWireframe(false) {}
: HighlightMask(0)
, HideMask(0)
, DrawWireframe(true)
, DrawBackfaces(false)
, DrawAreaCollisionBounds(true)
, TintWithSurfaceColor(true)
, TintUnwalkableTris(false) {}
};
struct SViewInfo