Made collision wireframe render with glPolygonMode

This commit is contained in:
parax0 2016-03-01 04:05:40 -07:00
parent 6ac7c1cbd2
commit 2860c27d15
1 changed files with 6 additions and 16 deletions

View File

@ -1,5 +1,6 @@
#include "CCollisionMesh.h" #include "CCollisionMesh.h"
#include "Core/Render/CRenderer.h" #include "Core/Render/CRenderer.h"
#include "Core/Render/CDrawUtil.h"
CCollisionMesh::CCollisionMesh() CCollisionMesh::CCollisionMesh()
{ {
@ -75,27 +76,16 @@ void CCollisionMesh::Draw()
if (!mBuffered) BufferGL(); if (!mBuffered) BufferGL();
mVBO.Bind(); mVBO.Bind();
mIBO.Bind(); mIBO.DrawElements();
glDrawElements(GL_TRIANGLES, mIBO.GetSize(), GL_UNSIGNED_SHORT, (void*) 0);
gDrawCount++;
mIBO.Unbind();
mVBO.Unbind(); mVBO.Unbind();
} }
void CCollisionMesh::DrawWireframe() void CCollisionMesh::DrawWireframe()
{ {
if (!mBuffered) BufferGL(); CDrawUtil::UseColorShader(CColor::skBlack);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
mVBO.Bind(); Draw();
mIBO.Bind(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
for (u32 f = 0; f < mFaceCount; f++)
{
glDrawElements(GL_LINE_LOOP, 3, GL_UNSIGNED_SHORT, (void*) (f * 6));
gDrawCount++;
}
mIBO.Unbind();
mVBO.Unbind();
} }
CCollisionMesh::CCollisionVertex* CCollisionMesh::GetVertex(u16 index) CCollisionMesh::CCollisionVertex* CCollisionMesh::GetVertex(u16 index)