OpenShaderDesigner 0.0.1
Loading...
Searching...
No Matches
Profiler.h
1// =====================================================================================================================
2// OpenShaderDesigner, an open source software utility to create materials and shaders.
3// Copyright (C) 2024 Medusa Slockbower
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17// =====================================================================================================================
18
19#ifndef PROFILER_H
20#define PROFILER_H
21
22#include <Core/EventSystem.h>
23#include <Core/Window.h>
24#include <Editor/EditorWindow.h>
25#include <Utility/Timer.h>
26
27namespace OpenShaderDesigner
28{
29
31 : public EditorWindow
32 , public EventHandler<BeginFrame>
33 , public EventHandler<EndFrame>
34{
35public:
36 Profiler();
37 ~Profiler();
38
39 void DrawWindow() override;
40
41 bool HandleEvent(const EventHandler<BeginFrame>::HandledType* event) override;
42 bool HandleEvent(const EventHandler<EndFrame>::HandledType* event) override;
43
44private:
45 enum
46 {
47 EVENTS = 0
48 , RENDER
49 , EDITOR
50 , END
51
52 , COUNT
53 , LAST = COUNT - 1
54 };
55
56 uint64_t Frame_;
57 double Deltas_[COUNT];
58 Timer Timer_;
59};
60
61}
62
63
64
65#endif //PROFILER_H
EditorWindow class for wrapping ImGui window functionality.
Definition EditorWindow.h:32
EventHandler interface for creating custom EventHandlers.
Definition EventSystem.h:68
EventType HandledType
The type handled by the EventHandler.
Definition EventSystem.h:70
Definition Profiler.h:34
void DrawWindow() override
DrawWindow function for when the EditorWindow is being drawn.
Definition Profiler.cpp:38
Definition Timer.h:28