Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
debug.h
1#ifndef OE_COMPONENT_DEBUG_H
2#define OE_COMPONENT_DEBUG_H
3
4#include "config.h" // IWYU pragma: keep (Required for OXYGEN_ENGINE_DEBUG_TOOLS)
5
6#ifndef OXYGEN_ENGINE_DEBUG_TOOLS
7 #error Debug tools are not included in this build, please enable then with OE_DEBUG_TOOLS CMake option
8#endif
9
10#include "../core/device.h"
11#include "../gui/manager.h"
12
13#include "fps_camera.h"
14#include "../scene/scene.h"
15
17{
73 class Debug
74 {
75 public:
86 core::Device& device,
87 core::Window& window,
88 oe::core::EventHandler& event_handler
89 );
90
98 void update(const std::chrono::nanoseconds delta);
99
108
114 void render();
115
123 void dumpSceneToFile(const std::string& filename) const;
124
132 void loadSceneFromFile(const std::string& filename);
133
134 private:
135 scene::Scene& _scene;
136
137 public:
145 bool is_active = true;
146
150 bool show_help_tooltips = false;
151
155 bool show_origin = true;
156
161
166
170 glm::vec3 selected_node_aabb_color = glm::vec3(1.0f, 1.0f, 0.0f);
171
175 glm::vec3 all_nodes_aabb_color = glm::vec3(1.0f, 0.0f, 1.0f);
176
181
186
187 #ifdef OXYGEN_ENGINE_DEBUG_VALIDATE_ORDERED_OPERATIONS
188 bool is_between_update_render = false;
189 #endif
190
191 private:
192 gui::Manager _gui;
193
194 core::Device& _device;
195 core::Window& _window;
196 oe::core::EventHandler& _event_handler;
197
198 int32_t _last_id = 0;
199
200 int32_t _frame_count = 0;
201 double _render_time = 0;
202
203 int32_t _last_fps = 0;
204
205 bool _fps_camera_mode = false;
206
207 void _generate_gui(nk_context* context);
208
209 void _treat_node(nk_context* context, oe::scene::Node& node);
210 void _node_tooltip(nk_context* context, oe::scene::Node& node);
211
212 void _node_details(nk_context* context, oe::scene::Node& node);
213 void _node_transforms(nk_context* context, oe::scene::Node& node);
214 void _camera_settings(nk_context* context);
215 };
216}
217
218#endif
void render()
Render the Debug GUI.
glm::vec3 selected_node_aabb_color
Color of selected node AABB.
Definition debug.h:170
void update(const std::chrono::nanoseconds delta)
Update the component.
bool show_selected_node_aabb
Toggle to show bounding boxes of selected node.
Definition debug.h:165
bool is_active
Toggle the status of the component.
Definition debug.h:145
void loadSceneFromFile(const std::string &filename)
Load all scene transforms from a json file.
FpsCamera fps_camera
the FPS Camera
Definition debug.h:185
bool show_help_tooltips
Toggle to add tooltips to help understand some widget meaning.
Definition debug.h:150
glm::vec3 all_nodes_aabb_color
Color of all nodes AABB.
Definition debug.h:175
void onNodeRemove(oe::scene::Node &node)
Run actions on node removal.
bool show_origin
Toggle to show world origin.
Definition debug.h:155
Debug(oe::scene::Scene &scene, core::Device &device, core::Window &window, oe::core::EventHandler &event_handler)
Constructor.
void dumpSceneToFile(const std::string &filename) const
Save all scene transforms into a json file.
bool show_all_nodes_aabb
Toggle to show bounding boxes of all nodes.
Definition debug.h:160
oe::scene::NodePtr current_node_details
The node in the detail window.
Definition debug.h:180
The OxygenEngine device that will manage events, windows, scene, etc...
Definition device.h:17
Event handler.
Definition event_handler.h:18
Definition window.h:24
Definition manager.h:35
Scene node.
Definition node.h:30
Logical scene manager.
Definition scene.h:18
Components bound to a node.
Definition namespaces.h:14
Components bound to the scene.
Definition namespaces.h:19
Scene / node components (camera, lighting, ...).
Definition debug.h:17
Control a camera like an FPS one (No clip, ignores any collisions).
Definition fps_camera.h:16
Wrapper to a node reference to use pointers to node even if the actual node moves in memory.
Definition node_ptr.h:19