mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-21 18:09:46 +00:00
add vertices count to debug panel
This commit is contained in:
parent
e3b475d2bb
commit
d857e7326d
4 changed files with 21 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "graphics/core/Mesh.hpp"
|
||||
|
||||
int MeshStats::meshesCount = 0;
|
||||
int MeshStats::drawCalls = 0;
|
||||
int MeshStats::drawCalls = 0;
|
||||
int MeshStats::vertices = 0;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
struct MeshStats {
|
||||
static int meshesCount;
|
||||
static int drawCalls;
|
||||
static int vertices;
|
||||
};
|
||||
|
||||
struct IndexBufferData {
|
||||
|
|
|
|||
|
|
@ -126,17 +126,20 @@ void Mesh<VertexStructure>::draw(unsigned int primitive, int iboIndex) const {
|
|||
|
||||
if (!ibos.empty()) {
|
||||
if (iboIndex < ibos.size()) {
|
||||
size_t indexCount = ibos.at(iboIndex).indexCount;
|
||||
glBindVertexArray(vao);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibos[iboIndex].ibo);
|
||||
glDrawElements(
|
||||
primitive, ibos.at(iboIndex).indexCount, GL_UNSIGNED_INT, nullptr
|
||||
primitive, indexCount, GL_UNSIGNED_INT, nullptr
|
||||
);
|
||||
glBindVertexArray(0);
|
||||
MeshStats::vertices += indexCount;
|
||||
}
|
||||
} else if (vertexCount > 0) {
|
||||
glBindVertexArray(vao);
|
||||
glDrawArrays(primitive, 0, vertexCount);
|
||||
glBindVertexArray(0);
|
||||
MeshStats::vertices += vertexCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue