Made collision wireframe render with glPolygonMode
This commit is contained in:
parent
6ac7c1cbd2
commit
2860c27d15
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue