1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
#pragma once
#if defined(WITH_IMGUI) || defined(DOXYGEN_GENERATING_OUTPUT)
#include "IDebugOverlay.h"
#include <memory>
#include <Containers/String.h>
#include <Containers/SmallVector.h>
using namespace Death::Containers;
namespace nCine
{
class AppConfiguration;
class IInputEventHandler;
class Viewport;
class SceneNode;
/// Overlay debug ImGui interface
class ImGuiDebugOverlay : public IDebugOverlay
{
public:
explicit ImGuiDebugOverlay(float profileTextUpdateTime);
ImGuiDebugOverlay(const ImGuiDebugOverlay&) = delete;
ImGuiDebugOverlay& operator=(const ImGuiDebugOverlay&) = delete;
void Update() override;
void UpdateFrameTimings() override;
#if defined(DEATH_TRACE)
void Log(TraceLevel level, StringView time, StringView threadId, StringView functionName, StringView message) override;
#endif
private:
static constexpr float Margin = 10.0f;
static constexpr float Transparency = 0.5f;
#ifndef DOXYGEN_GENERATING_OUTPUT
// Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
struct ValuesType
{
enum
{
FrameTime = 0,
BeginFrame,
UpdateVisitDraw,
Update,
PostUpdate,
Visit,
Draw,
ImGui,
EndFrame,
CulledNodes,
VboUsed,
IboUsed,
UboUsed,
SpriteVertices,
MeshSpriteVertices,
TileMapVertices,
ParticleVertices,
LightingVertices,
TextVertices,
ImGuiVertices,
UnspecifiedVertices,
TotalVertices,
#if defined(WITH_LUA)
LuaUsed,
LuaOperations,
#endif
Count
};
};
struct LogMessage
{
String Time;
String Text;
String ThreadId;
StringView FunctionName;
TraceLevel Level;
};
#endif
bool lockOverlayPositions_;
bool showTopLeftOverlay_;
bool showTopRightOverlay_;
bool showBottomLeftOverlay_;
bool showBottomRightOverlay_;
std::uint32_t numValues_;
std::unique_ptr<float[]> plotValues_[ValuesType::Count];
float maxFrameTime_;
float maxUpdateVisitDraw_;
std::uint32_t index_;
bool plotAdditionalFrameValues_;
bool plotOverlayValues_;
String comboVideoModes_;
SmallVector<LogMessage, 0> logBuffer_;
#if defined(WITH_RENDERDOC)
static constexpr std::uint32_t MaxRenderDocPathLength = 128;
static constexpr std::uint32_t MaxRenderDocCommentsLength = 512;
String renderDocPathTemplate_;
String renderDocFileComments_;
String renderDocCapturePath_;
std::uint32_t renderDocLastNumCaptures_;
#endif
void guiWindow();
void guiConfigureGui();
void guiInitTimes();
void guiLog();
void guiGraphicsCapabilities();
void guiApplicationConfiguration();
void guiRenderingSettings();
void guiWindowSettings();
void guiAudioPlayers();
void guiInputState();
void guiRenderDoc();
void guiAllocators();
void guiViewports(Viewport* viewport, std::uint32_t viewportId);
void guiRecursiveChildrenNodes(SceneNode* node, std::uint32_t childId);
void guiNodeInspector();
#if defined(NCINE_PROFILING)
void guiTopLeft();
#endif
void guiTopRight();
void guiBottomLeft();
void guiBottomRight();
void guiPlots();
void InitPlotValues();
#if defined(NCINE_PROFILING)
void UpdateOverlayTimings();
#endif
};
}
#endif
|