add vertices count to debug panel

This commit is contained in:
MihailRis 2026-11-01 01:30:39 +03:00
parent e3b475d2bb
commit d857e7326d
4 changed files with 21 additions and 2 deletions

View file

@ -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;

View file

@ -8,6 +8,7 @@
struct MeshStats {
static int meshesCount;
static int drawCalls;
static int vertices;
};
struct IndexBufferData {

View file

@ -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;
}
}