mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-21 02:39:17 +00:00
Added a couple more collision view features; set up a proper UI for changing collision render settings
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "CCollisionMaterial.h"
|
||||
#include "EGame.h"
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
ECollisionFlag CCollisionMaterial::SurfaceType(EGame Game) const
|
||||
{
|
||||
@@ -42,7 +42,7 @@ ECollisionFlag CCollisionMaterial::SurfaceType(EGame Game) const
|
||||
}
|
||||
|
||||
// Type-to-color mappings
|
||||
const std::map<ECollisionFlag, CColor> gkTypeToColor = {
|
||||
const std::unordered_map<ECollisionFlag, CColor> gkTypeToColor = {
|
||||
{ eCF_Stone, CColor::Integral(220, 215, 160) }, // Brownish/greenish
|
||||
{ eCF_Metal, CColor::Integral(143, 143, 143) }, // Gray
|
||||
{ eCF_Grass, CColor::Integral( 90, 150, 70) }, // Green
|
||||
|
||||
@@ -122,7 +122,7 @@ void CCollisionMesh::Draw()
|
||||
mVBO.Unbind();
|
||||
}
|
||||
|
||||
void CCollisionMesh::DrawMaterial(u32 MatIdx)
|
||||
void CCollisionMesh::DrawMaterial(u32 MatIdx, bool Wireframe)
|
||||
{
|
||||
if (!mBuffered) BufferGL();
|
||||
ASSERT(MatIdx < mMaterials.size());
|
||||
@@ -130,7 +130,18 @@ void CCollisionMesh::DrawMaterial(u32 MatIdx)
|
||||
mVBO.Bind();
|
||||
u32 StartIdx = (MatIdx == 0 ? 0 : mMaterialOffsets[MatIdx - 1]);
|
||||
u32 NumElements = mMaterialOffsets[MatIdx] - StartIdx;
|
||||
|
||||
if (Wireframe)
|
||||
{
|
||||
CDrawUtil::UseColorShader(CColor::skBlack);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
}
|
||||
|
||||
mIBO.DrawElements(StartIdx, NumElements);
|
||||
|
||||
if (Wireframe)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
mVBO.Unbind();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
|
||||
void BufferGL();
|
||||
void Draw();
|
||||
void DrawMaterial(u32 MatIdx);
|
||||
void DrawMaterial(u32 MatIdx, bool Wireframe);
|
||||
void DrawWireframe();
|
||||
|
||||
inline u32 NumMaterials() const { return mMaterials.size(); }
|
||||
|
||||
Reference in New Issue
Block a user