summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2019-01-27 11:10:15 +0100
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2019-01-27 11:10:15 +0100
commitda3df2fca7a55ae7ca8342816623bd9cb4d5f33b (patch)
treeef25c742afca6962647aa055f02548ce43f4c472 /src
parentAdded const-keyword to World (diff)
downloadAltCraft-da3df2fca7a55ae7ca8342816623bd9cb4d5f33b.tar
AltCraft-da3df2fca7a55ae7ca8342816623bd9cb4d5f33b.tar.gz
AltCraft-da3df2fca7a55ae7ca8342816623bd9cb4d5f33b.tar.bz2
AltCraft-da3df2fca7a55ae7ca8342816623bd9cb4d5f33b.tar.lz
AltCraft-da3df2fca7a55ae7ca8342816623bd9cb4d5f33b.tar.xz
AltCraft-da3df2fca7a55ae7ca8342816623bd9cb4d5f33b.tar.zst
AltCraft-da3df2fca7a55ae7ca8342816623bd9cb4d5f33b.zip
Diffstat (limited to 'src')
-rw-r--r--src/DebugInfo.cpp3
-rw-r--r--src/DebugInfo.hpp1
-rw-r--r--src/Render.cpp4
-rw-r--r--src/RendererWorld.cpp3
4 files changed, 10 insertions, 1 deletions
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();
}