Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::component::Debug Class Reference

Show extensive debugging informations about the scene. More...

#include <OxygenEngine/component/debug.h>

Collaboration diagram for oe::component::Debug:

Public Member Functions

 Debug (oe::scene::Scene &scene, core::Device &device, core::Window &window, oe::core::EventHandler &event_handler)
 Constructor.
void update (const std::chrono::nanoseconds delta)
 Update the component.
void onNodeRemove (oe::scene::Node &node)
 Run actions on node removal.
void render ()
 Render the Debug GUI.
void dumpSceneToFile (const std::string &filename) const
 Save all scene transforms into a json file.
void loadSceneFromFile (const std::string &filename)
 Load all scene transforms from a json file.

Public Attributes

bool is_active = true
 Toggle the status of the component.
bool show_help_tooltips = false
 Toggle to add tooltips to help understand some widget meaning.
bool show_origin = true
 Toggle to show world origin.
bool show_all_nodes_aabb = false
 Toggle to show bounding boxes of all nodes.
bool show_selected_node_aabb = true
 Toggle to show bounding boxes of selected node.
glm::vec3 selected_node_aabb_color = glm::vec3(1.0f, 1.0f, 0.0f)
 Color of selected node AABB.
glm::vec3 all_nodes_aabb_color = glm::vec3(1.0f, 0.0f, 1.0f)
 Color of all nodes AABB.
oe::scene::NodePtr current_node_details = {}
 The node in the detail window.
FpsCamera fps_camera
 the FPS Camera

Detailed Description

Show extensive debugging informations about the scene.

Features:

  • Easily see the nodes hierarchy with a interactive tree
    • Right click on a node to get more details
  • Detailed information about nodes
    • Class name
    • Toggle visibility
    • Editable local Transform (Translation, rotation (euler angles), scale)
    • Global Transform (Translation, rotation (euler angles), scale)
    • Components list (Class, enable/disable, properties)
  • Save / load all scene transforms into scene-dump.json (in application working folder)
    • Absolute node names are saved
    • Helps saving reproducible scene states
  • Show/hide origin axis
  • Get information about the running application
    • FPS
    • Window position
    • Cursor position (relative to top-left window corner)
    • Current timestamp
    • Device uptime in seconds
    • VSync toggle
  • Get information about Oxygen Engine
    • Version
    • Commit
    • Build date

Code usage:

// In your startup code
oe::component::Debug debug(scene, device, window, event_handler);
// In your update code
void your_application_update(const nanoseconds& delta)
{
// Other Scene updates
// ...
debug->update(delta);
}
// In your render code
void your_application_render()
{
// Other rendering
// ...
// The component should be rendered on top of other rendering
debug->render();
}
Show extensive debugging informations about the scene.
Definition debug.h:74
Components bound to the scene.
Definition namespaces.h:19
See also
An example can be found in the extended_debug.cpp

Constructor & Destructor Documentation

◆ Debug()

oe::component::Debug::Debug ( oe::scene::Scene & scene,
core::Device & device,
core::Window & window,
oe::core::EventHandler & event_handler )

Constructor.

Parameters
sceneScene bound to the component
deviceEngine device (used to capture device information)
windowMain window (used to capture window information + resolution)
event_handlerEvent handler (used to update the UI and show input status)

Member Function Documentation

◆ dumpSceneToFile()

void oe::component::Debug::dumpSceneToFile ( const std::string & filename) const

Save all scene transforms into a json file.

The oe::core::Filesystem might not be available/ready, the save is done using classic fstream

Parameters
filenameFile to save (relative to the working folder)

◆ loadSceneFromFile()

void oe::component::Debug::loadSceneFromFile ( const std::string & filename)

Load all scene transforms from a json file.

The oe::core::Filesystem might not be available/ready, the load is done using classic fstream

Parameters
filenameFile to load (relative to the working folder)

◆ onNodeRemove()

void oe::component::Debug::onNodeRemove ( oe::scene::Node & node)

Run actions on node removal.

Used to update detail view if the displayed node is removed

Parameters
nodeThe node that will be removed

◆ render()

void oe::component::Debug::render ( )

Render the Debug GUI.

Note
The oe::render::Debug is not rendered here to let you handle it yourself according to your pipeline

◆ update()

void oe::component::Debug::update ( const std::chrono::nanoseconds delta)

Update the component.

Note
As it does internal computation and state updates, it should be called only once per frame.
Parameters
deltadelta time

Member Data Documentation

◆ is_active

bool oe::component::Debug::is_active = true

Toggle the status of the component.

The component won't react nor display GUI if its not active.

Debug objects will be still rendered (can be disabled in settings)


The documentation for this class was generated from the following file: