mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-23 02:49: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
|
|
@ -78,6 +78,8 @@ std::shared_ptr<UINode> create_debug_panel(
|
||||||
static int drawCallsMax = drawCalls;
|
static int drawCallsMax = drawCalls;
|
||||||
static std::wstring drawCallsAvgString = L"";
|
static std::wstring drawCallsAvgString = L"";
|
||||||
static std::wstring drawCallsMinMaxString = L"";
|
static std::wstring drawCallsMinMaxString = L"";
|
||||||
|
static int verticesCount = 0;
|
||||||
|
static std::wstring verticesCountString = L"";
|
||||||
|
|
||||||
static size_t lastTotalDownload = 0;
|
static size_t lastTotalDownload = 0;
|
||||||
static size_t lastTotalUpload = 0;
|
static size_t lastTotalUpload = 0;
|
||||||
|
|
@ -151,6 +153,18 @@ std::shared_ptr<UINode> create_debug_panel(
|
||||||
panel->add(create_label(gui, []() {
|
panel->add(create_label(gui, []() {
|
||||||
return drawCallsMinMaxString;
|
return drawCallsMinMaxString;
|
||||||
}));
|
}));
|
||||||
|
panel->add(create_label(gui, []() {
|
||||||
|
static int frame = 0;
|
||||||
|
verticesCount = std::max<int>(verticesCount, MeshStats::vertices);
|
||||||
|
if (frame % 4 == 0) {
|
||||||
|
verticesCountString =
|
||||||
|
L"vertices: " + std::to_wstring(verticesCount);
|
||||||
|
}
|
||||||
|
frame++;
|
||||||
|
MeshStats::vertices = 0;
|
||||||
|
verticesCount = 0;
|
||||||
|
return verticesCountString;
|
||||||
|
}));
|
||||||
panel->add(create_label(gui, []() {
|
panel->add(create_label(gui, []() {
|
||||||
return L"speakers: " + std::to_wstring(audio::count_speakers()) +
|
return L"speakers: " + std::to_wstring(audio::count_speakers()) +
|
||||||
L" streams: " + std::to_wstring(audio::count_streams());
|
L" streams: " + std::to_wstring(audio::count_streams());
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "graphics/core/Mesh.hpp"
|
#include "graphics/core/Mesh.hpp"
|
||||||
|
|
||||||
int MeshStats::meshesCount = 0;
|
int MeshStats::meshesCount = 0;
|
||||||
int MeshStats::drawCalls = 0;
|
int MeshStats::drawCalls = 0;
|
||||||
|
int MeshStats::vertices = 0;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
struct MeshStats {
|
struct MeshStats {
|
||||||
static int meshesCount;
|
static int meshesCount;
|
||||||
static int drawCalls;
|
static int drawCalls;
|
||||||
|
static int vertices;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IndexBufferData {
|
struct IndexBufferData {
|
||||||
|
|
|
||||||
|
|
@ -126,17 +126,20 @@ void Mesh<VertexStructure>::draw(unsigned int primitive, int iboIndex) const {
|
||||||
|
|
||||||
if (!ibos.empty()) {
|
if (!ibos.empty()) {
|
||||||
if (iboIndex < ibos.size()) {
|
if (iboIndex < ibos.size()) {
|
||||||
|
size_t indexCount = ibos.at(iboIndex).indexCount;
|
||||||
glBindVertexArray(vao);
|
glBindVertexArray(vao);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibos[iboIndex].ibo);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibos[iboIndex].ibo);
|
||||||
glDrawElements(
|
glDrawElements(
|
||||||
primitive, ibos.at(iboIndex).indexCount, GL_UNSIGNED_INT, nullptr
|
primitive, indexCount, GL_UNSIGNED_INT, nullptr
|
||||||
);
|
);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
MeshStats::vertices += indexCount;
|
||||||
}
|
}
|
||||||
} else if (vertexCount > 0) {
|
} else if (vertexCount > 0) {
|
||||||
glBindVertexArray(vao);
|
glBindVertexArray(vao);
|
||||||
glDrawArrays(primitive, 0, vertexCount);
|
glDrawArrays(primitive, 0, vertexCount);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
MeshStats::vertices += vertexCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue