diff --git a/src/debug_collector.cpp b/src/debug_collector.cpp index a2f6c13..cc0d104 100644 --- a/src/debug_collector.cpp +++ b/src/debug_collector.cpp @@ -15,6 +15,7 @@ void DebugCollector::init_text() { Text version_text("version"); Text fps_text("fps"); Text player_pos_text("player_pos"); + Text rendered_chunk_text("rendered_chunk"); version_text .position(0.0f, 100.0f) .scale(0.8f) @@ -27,11 +28,14 @@ void DebugCollector::init_text() { .position(0.0f, 150.0f) .scale(0.8f) .text("x: 0.00 y: 0.00 z: 0.00"); - + rendered_chunk_text + .text("Rendered Chunk: 0") + .scale(0.8f) + .position(0.0, 200.0f); m_texts.insert({version_text.uuid(), std::move(version_text)}); m_texts.insert({fps_text.uuid(), std::move(fps_text)}); m_texts.insert({player_pos_text.uuid(), std::move(player_pos_text)}); - + m_texts.insert({rendered_chunk_text.uuid(), std::move(rendered_chunk_text)}); } std::unordered_map& DebugCollector::all_texts() { diff --git a/src/gameplay/world.cpp b/src/gameplay/world.cpp index ea5237d..76c6918 100644 --- a/src/gameplay/world.cpp +++ b/src/gameplay/world.cpp @@ -1,4 +1,6 @@ #include + +#include #include #include #include @@ -128,7 +130,7 @@ void World::init_world() { void World::render(const glm::mat4& mvp_matrix) { Math::extract_frustum_planes(mvp_matrix, m_planes); - + int rendered_sum = 0; for (const auto& snapshot : m_render_snapshots) { if (is_aabb_in_frustum(snapshot.center, snapshot.half_extents)) { @@ -143,11 +145,13 @@ void World::render(const glm::mat4& mvp_matrix) { glDrawArrays(GL_TRIANGLES, 0, snapshot.vertex_count); glBindBuffer(GL_ARRAY_BUFFER, 0); + rendered_sum++; } } + DebugCollector::get().report("rendered_chunk", "Rendered Chunk: " + std::to_string(rendered_sum)); }