Merge branch 'main' into dev

This commit is contained in:
MihailRis 2026-11-01 02:03:50 +03:00
commit 5011a654be
7 changed files with 69 additions and 26 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

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

View file

@ -118,17 +118,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;
}
}