From da3df2fca7a55ae7ca8342816623bd9cb4d5f33b Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sun, 27 Jan 2019 15:10:15 +0500 Subject: Added "Renderer faces" metric --- src/DebugInfo.cpp | 3 ++- src/DebugInfo.hpp | 1 + src/Render.cpp | 4 ++++ src/RendererWorld.cpp | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/DebugInfo.cpp b/src/DebugInfo.cpp index e2d439b..89e9425 100644 --- a/src/DebugInfo.cpp +++ b/src/DebugInfo.cpp @@ -3,4 +3,5 @@ std::atomic_int DebugInfo::totalSections(0); std::atomic_int DebugInfo::renderSections(0); std::atomic_int DebugInfo::readyRenderer(0); -std::atomic_int DebugInfo::gameThreadTime(0); \ No newline at end of file +std::atomic_int DebugInfo::gameThreadTime(0); +std::atomic_int DebugInfo::renderFaces(0); \ No newline at end of file diff --git a/src/DebugInfo.hpp b/src/DebugInfo.hpp index a29a056..e6aa17c 100644 --- a/src/DebugInfo.hpp +++ b/src/DebugInfo.hpp @@ -7,4 +7,5 @@ struct DebugInfo { static std::atomic_int renderSections; static std::atomic_int readyRenderer; static std::atomic_int gameThreadTime; + static std::atomic_int renderFaces; }; \ No newline at end of file diff --git a/src/Render.cpp b/src/Render.cpp index a081dbb..cf108e4 100644 --- a/src/Render.cpp +++ b/src/Render.cpp @@ -399,6 +399,10 @@ void Render::RenderGui() { "Culled sections: %d", (int) DebugInfo::renderSections - world->culledSections); + ImGui::Text( + "Rendered faces: %d", + (int)DebugInfo::renderFaces); + ImGui::Text( "Player pos: %.1f %.1f %.1f OnGround=%d", playerPtr->pos.x, diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp index 1743a25..e0a28a4 100644 --- a/src/RendererWorld.cpp +++ b/src/RendererWorld.cpp @@ -386,6 +386,7 @@ void RendererWorld::Render(RenderState & renderState) { Frustum frustum(projView); size_t culledSections = sections.size(); + unsigned int renderedFaces = 0; for (auto& section : sections) { glm::vec3 point{ section.second.GetPosition().x * 16 + 8, @@ -400,8 +401,10 @@ void RendererWorld::Render(RenderState & renderState) { continue; } section.second.Render(renderState); + renderedFaces += section.second.numOfFaces; } this->culledSections = culledSections; + DebugInfo::renderFaces = renderedFaces; glCheckError(); } -- cgit v1.2.3