19 m_renderer = renderer;
26 if (!m_renderer || !m_renderer->GetImGUIEnabled() || !m_visible)
30 m_metricTimer += deltaTime;
31 if (m_metricTimer >= m_config.MetricRefreshInterval) {
36 if (m_config.ShowCameraPanel) RenderCameraPanel();
37 if (m_config.ShowPerformancePanel) RenderPerformancePanel();
40void DebugOverlay::RenderCameraPanel() {
87 bool enabled = controller->IsEnabled();
93 float yaw = controller->GetYaw();
96 controller->GetYawRange().GetX(),
97 controller->GetYawRange().GetY()))
98 controller->SetYaw(yaw);
100 float pitch = controller->GetPitch();
102 "Pitch", &pitch, 1.0f,
103 controller->GetPitchRange().GetX(),
104 controller->GetPitchRange().GetY()))
105 controller->SetPitch(pitch);
107 float roll = controller->GetRoll();
110 controller->GetRollRange().GetX(),
111 controller->GetRollRange().GetY()))
112 controller->SetRoll(roll);
114 UI::Text(
"Speed: %.2f / %.2f", controller->GetSpeed(),
115 controller->GetMaxSpeed());
117 controller->GetAcceleration());
119 controller->GetVelocity().ToString().c_str());
121 controller->GetTranslationInput()
131void DebugOverlay::RenderPerformancePanel() {
138 switch (m_renderer->GetType()) {
157 UI::Text(
"FPS: %d", m_renderer->GetFrameRate());
158 UI::Text(
"Frame Time: %.2f ms", m_renderer->GetFrameTime());
161 UI::Text(
"Vertices: %d", m_renderer->GetVertices());
162 UI::Text(
"Triangles: %d", m_renderer->GetTriangles());
165 UI::Text(
"CPU: %.1f%%", m_cachedMetrics.CpuUsagePercent);
166 UI::Text(
"RAM: %.1f MB", m_cachedMetrics.RamUsageMB);
168 if (m_cachedMetrics.GpuUsagePercent > 0.0f)
169 UI::Text(
"GPU: %.1f%%", m_cachedMetrics.GpuUsagePercent);
181 const char* labels[] = {
"Off",
"2x",
"4x",
"8x"};
182 int values[] = {1, 2, 4, 8};
184 uint32_t maxMSAA = m_renderer->GetMaxMSAASampleCount();
185 for (
int i = 1; i < 4; i++)
186 if (
static_cast<uint32_t
>(values[i]) <= maxMSAA) count = i + 1;
188 for (
int i = 0; i < count; i++)
189 if (
static_cast<uint32_t
>(values[i]) == m_renderer->GetMSAASampleCount()) current = i;
190 if (
UI::Combo(
"MSAA", ¤t, labels, count))
191 m_renderer->SetMSAASampleCount(values[current]);
void SetFieldOfView(float fov)
void SetPosition(const Math::Vector3D &position)
Math::Vector3D GetPosition() const
float GetFieldOfView() const
float GetFarPlane() const
Math::Vector3D GetLookTarget() const
Math::Vector3D GetUp() const
Math::Vector3D GetDirection() const
ProjectionType GetProjectionType() const
void SetDirection(const Math::Vector3D &direction)
float GetNearPlane() const
static void SetEnabled(bool enabled)
static void Initialize()
Allocates the shared vertex buffer, shader, and constant buffer.
void Initialize(RenderEngine::Renderer *renderer, GameBase *game)
void Render(float deltaTime)
Refreshes cached metrics on the configured interval and draws the enabled panels.
virtual SceneBase * GetActiveScene()
T * GetComponent()
Finds the first attached component of type T, or nullptr.
std::string ToString() const
const std::string & GetName() const
Abstract render backend: swapchain, frame lifecycle, and post-effect toggles.
Camera * GetActiveCamera() const
static SystemMetricsData Query()
Reads the current CPU/RAM/GPU usage from the OS.
ENGINE_API void Separator()
ENGINE_API bool Button(const char *label)
ENGINE_API float GetViewportWidth()
ENGINE_API void BeginGroup()
ENGINE_API void TextColored(float r, float g, float b, float a, const char *fmt,...)
ENGINE_API void EndGroup()
ENGINE_API void BeginChild(const char *name)
ENGINE_API void EndChild()
ENGINE_API void Text(const char *fmt,...)
ENGINE_API void TextDisabled(const char *fmt,...)
ENGINE_API void SameLine()
ENGINE_API void BeginPanel(const char *name, float x, float y, float bgAlpha=0.4f, int flags=PanelFlags_NoTitleBar|PanelFlags_AutoResize|PanelFlags_NoMove|PanelFlags_NoInput|PanelFlags_NoFocusOnAppear)
Opens a floating overlay window at (x, y); pair with EndPanel.
ENGINE_API bool Checkbox(const char *label, bool *value)
ENGINE_API bool Combo(const char *label, int *current, const char *const items[], int count)
ENGINE_API void EndPanel()
ENGINE_API bool DragFloat(const char *label, float *value, float speed=1.0f, float min=0.0f, float max=0.0f)
Root namespace for everything the engine exposes.