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

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

#include <OxygenEngine/scene/component/scene/debug.h>

+ Inheritance diagram for oe::component::scene::Debug:
+ Collaboration diagram for oe::component::scene::Debug:

Classes

struct  FPSCameraKeyBindings
 Controls to move the FPS Camera. More...
 

Public Member Functions

 Debug (oe::scene::Manager &scene_manager, core::Device &device, core::Window &window, oe::core::EventHandler &event_handler)
 Constructor.
 
void update (const std::chrono::nanoseconds delta)
 Update the component.
 
virtual void onNodeRemove (oe::scene::Node &node) override
 Run actions on node removal.
 
void render ()
 Render the Debug GUI.
 
void dumpSceneToFile (const std::string &filename) const
 Save all scene transform into a json file.
 
void loadSceneFromFile (const std::string &filename)
 Load all scene transforms from a json file.
 
- Public Member Functions inherited from oe::scene::SceneComponent
 SceneComponent (Manager &entity)
 Constructor.
 
ManagergetSceneManager ()
 Get Scene bound to this component.
 
const ManagergetSceneManager () const
 Get Scene bound to this component.
 
virtual void onNodeAdd (Node &)
 Run actions after a node is added.
 
- Public Member Functions inherited from oe::component::EntityComponent< Manager >
const std::string & getName () const
 
- Public Member Functions inherited from oe::component::Component
virtual void onUpdate (const std::chrono::nanoseconds, const int8_t=0)
 Run actions on entity update.
 

Public Attributes

bool show_help_tooltips = false
 Toggle to add tooltips to help understand some widget meaning.
 
bool show_origin = true
 Toggle to show world origin.
 
oe::scene::Nodecurrent_node_details = nullptr
 The node in the detail window.
 
FPSCameraKeyBindings fps_camera_controls
 Keybindings to control the FPS Camera.
 
float fps_camera_default_speed = 6.0f
 FPS Camera Speed.
 
float fps_camera_sensitivity = 0.001f
 FPS Camera mouse sensitivity.
 
- Public Attributes inherited from oe::component::Component
bool is_active = true
 Toggle to check if the Component is active, actual meaning heavily depends of the component type.
 

Additional Inherited Members

- Protected Member Functions inherited from oe::component::EntityComponent< Manager >
 EntityComponent (Manager &entity)
 
- Protected Attributes inherited from oe::component::EntityComponent< Manager >
Manager & _entity
 

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
auto scene_debug = scene_manager.addComponent<oe::component::scene::Debug>
(
"The name you want to give to this component"
device,
window,
event_handler
);
// In your update code
void your_application_update(const double& delta)
{
// Other Scene updates
// ...
scene_debug->update(delta);
}
// In your render code
void your_application_render()
{
// Other rendering
// ...
// The component should be rendered on top of other rendering
scene_debug->render();
}
Show extensive debugging informations about the scene.
Definition debug.h:81
void update(const std::chrono::nanoseconds delta)
Update the component.
See also
An example can be found in the extended_debug.cpp
Note
The component won't react nor display GUI if its not active

Constructor & Destructor Documentation

◆ Debug()

oe::component::scene::Debug::Debug ( oe::scene::Manager scene_manager,
core::Device device,
core::Window window,
oe::core::EventHandler event_handler 
)

Constructor.

Parameters
scene_managerScene 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::scene::Debug::dumpSceneToFile ( const std::string &  filename) const

Save all scene transform into a json file.

Parameters
filenameFile to save (relative to the working folder)

◆ loadSceneFromFile()

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

Load all scene transforms from a json file.

Parameters
filenameFile to load (relative to the working folder)

◆ onNodeRemove()

virtual void oe::component::scene::Debug::onNodeRemove ( oe::scene::Node node)
overridevirtual

Run actions on node removal.

Used to update detail view if the displayed node is removed

Parameters
nodeThe node that will be removed

Reimplemented from oe::scene::SceneComponent.

◆ render()

void oe::component::scene::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::scene::Debug::update ( const std::chrono::nanoseconds  delta)

Update the component.

Note
As it does internal computation (eg FPS), it should be called only once per frame. hence not overriding onUpdate
Parameters
deltadelta time

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