Performance sampler added

This commit is contained in:
2022-10-30 16:25:18 +01:00
parent f0984b6117
commit 65ae892951
5 changed files with 160 additions and 77 deletions

View File

@ -7,6 +7,7 @@
#include "GUI.h"
#include "Util.h"
#include <entt/entt.hpp>
#include "../../BarinkEngine/src/PerfCounter.h"
/*
* Define globals
@ -16,6 +17,7 @@ Scene scene;
BarinkEngine::Renderable* renderable;
BarinkEngine::SceneObject* object;
Entity cube;
/*
* Runs once at startup
* - USe to initialize the game/sandbox/demo
@ -49,19 +51,11 @@ void Start() {
auto AmbientLight = scene.AddEntity("AmbientLight");
AmbientLight.AddComponent<BarinkEngine::LightComponent>();
renderer.Prepare(scene);
}
bool showImGuiMetrics = false;
/*
* Runs every frame
* - Use to draw Immediate mode graphics (Not meant for HUD's )
@ -69,7 +63,7 @@ bool showImGuiMetrics = false;
void ImmediateGraphicsDraw()
{
// Show internal BarinkEngine stats
ShowStats();
EngineInstrumentation::ShowStats();
ImGui::Begin("Scene view");
auto group = scene.getReg().view<BarinkEngine::IdentifierComponent>();
@ -79,18 +73,12 @@ void ImmediateGraphicsDraw()
});
ImGui::End();
ImGui::ShowMetricsWindow();
ImGui::Begin("Settings");
if (ImGui::Button("ImGui Debug"))
{
std::cout << "Click!" << std::endl;
showImGuiMetrics = true;
}
ImGui::ShowMetricsWindow(&showImGuiMetrics);
auto& a = cube.GetComponent<BarinkEngine::Render3DComponent>();
auto& b = cube.GetComponent<BarinkEngine::TransformComponent>();
@ -106,13 +94,9 @@ void ImmediateGraphicsDraw()
ImGui::SliderFloat3("l-Color", &light.Color[0], 0.0f, 1.0f);
});
ImGui::End();
}
/*
@ -120,9 +104,12 @@ void ImmediateGraphicsDraw()
* - Meant for game logic ( non-physics related)
*/
void Update()
{
}
void Render()
{
renderer.Render(scene);
}
/*
@ -131,4 +118,4 @@ void Update()
*/
void Stop()
{
}
}