Viewer#

namespace viewer#
class DebugViewerApp#
#include <debug_viewer_app.h>

Standalone desktop application hosting GLFW windowing, user input, camera controllers, and main rendering loop.

Public Functions

DebugViewerApp()#

Default constructor.

~DebugViewerApp()#

Destructor releasing window and viewer resources.

DebugViewerApp(const DebugViewerApp&) = delete#
DebugViewerApp &operator=(const DebugViewerApp&) = delete#
DebugViewerApp(DebugViewerApp &&other) noexcept#

Move constructor.

Parameters:

other – Instance to move from.

DebugViewerApp &operator=(DebugViewerApp &&other) noexcept#

Move assignment operator.

Parameters:

other – Instance to move from.

Returns:

Reference to this.

bool initialize(DebugViewerAppDesc desc, engine::RuntimeConfig &inOutRuntimeConfig)#

Initializes desktop window, input handlers, and configures runtime presentation targets.

Zero dimensions and rates are raised to one, and non-positive movement/timing values fall back to their defaults. This updates inOutRuntimeConfig's presentation settings and native window handles. Video capture requires captureFps <= simulationFps; exclusive and borderless fullscreen cannot both be requested.

Parameters:
  • desc – Viewer application configuration settings.

  • inOutRuntimeConfig – Engine runtime configuration updated for this viewer.

Returns:

False when validation, GLFW setup, window creation, or platform-view setup fails.

bool run(engine::Runtime &runtime, DebugViewerCameraBinding camera, DebugViewerCallbacks callbacks = {})#

Enters the application main loop, processing events, ticking simulation, and rendering frames until exit.

beforeTick runs after camera/input updates but before prepare/upload/physics work; afterTick runs after the frame is ended. The supplied camera must name a live entity with a camera component. Headless runs additionally require a nonzero maxFrames.

Parameters:
  • runtime – Active engine runtime instance.

  • camera – Driven camera entity and movement speed settings.

  • callbacks – Optional pre-tick and post-tick hook callbacks.

Returns:

False for invalid setup, missing runtime/camera resources, or video-capture failures. Physics/upload failures skip the corresponding simulation work for that frame and do not by themselves change this result.

void requestExit()#

Requests the application main loop to terminate after the current frame.

void shutdown()#

Destroys the desktop window and releases viewer subsystems.

Safe to call before initialization or multiple times.

struct DebugViewerAppDesc#
#include <debug_viewer_app.h>

Launch configuration parameters for the interactive debug viewer application.

Public Members

std::string windowTitle = "CRESSim Neo Debug Viewer"#

Window caption text.

std::uint32_t width = 1280#

Window client area width in pixels.

std::uint32_t height = 720#

Window client area height in pixels.

bool windowEnabled = true#

Whether a desktop window is opened (false runs headless).

bool windowVisible = true#

Initial window visibility.

bool startFullscreen = false#

Start in exclusive fullscreen mode.

bool startFullscreenWindowed = false#

Start in borderless windowed fullscreen mode.

bool vSync = true#

Enable vertical synchronization.

float inputSensitivity = 0.08f#

Mouse look sensitivity multiplier.

float moveSpeed = 3.0f#

Base fly camera movement speed in units per second.

float speedBoostScale = 3.0f#

Movement speed multiplier when holding sprint key.

float speedSlowScale = 0.35f#

Movement speed multiplier when holding precision slow key.

float wheelSpeedScale = 0.12f#

Speed adjustment increment from mouse scroll wheel.

float minMoveSpeed = 0.25f#

Minimum clamp on adjustable camera movement speed.

float maxMoveSpeed = 80.0f#

Maximum clamp on adjustable camera movement speed.

float fixedDeltaSeconds = 1.0f / 60.0f#

Target fixed delta time step in seconds.

bool useFixedTimestep#

Enforce fixed time step rather than elapsed wall-clock delta.

bool stepSimulation = true#

Step the physics simulation on each tick.

std::uint64_t maxFrames#

Maximum frames to execute before auto-quitting (0 runs indefinitely).

bool showStats = true#

Show performance statistics in the window title and logs.

bool enableDebugParticles = false#

Enable particle physics debug visual overlays.

std::uint32_t statsIntervalFrames#

Interval in frames for logging performance statistics.

std::string captureVideoPath = {}#

Output video path encoded through FFmpeg; its extension selects the container.

std::uint32_t captureFps = 30#

Video recording output frame rate.

std::uint32_t simulationFps#

Capture scheduler reference rate; it does not set the simulation timestep.

std::uint32_t captureSwitchIntervalFrames#

Interval in captured frames to rotate cameras (0 disables auto-rotation).

DebugViewerKeymap keymap = {}#

Keyboard and mouse button configuration.

struct DebugViewerCallbacks#
#include <debug_viewer_app.h>

Frame event callbacks invoked before and after each simulation tick.

Public Members

std::function<void(const common::FrameContext&, engine::Runtime&)> beforeTick = {}#

Invoked before physics stepping and systems tick.

std::function<void(const common::FrameContext&, engine::Runtime&)> afterTick = {}#

Invoked after physics stepping and render pass dispatch.

struct DebugViewerCameraBinding#
#include <debug_viewer_app.h>

Camera entity binding and movement tuning parameters for the viewer controller.

Public Members

common::EntityId cameraEntity#

Entity ID of camera driven by fly controls.

float moveSpeed = 0.0f#

Initial movement speed override (0 uses app default).

float inputSensitivity = 0.0f#

Mouse look sensitivity override (0 uses app default).

float speedBoostScale = 0.0f#

Sprint boost scale override (0 uses app default).

float speedSlowScale = 0.0f#

Precision slow scale override (0 uses app default).

struct DebugViewerKeymap#
#include <debug_viewer_app.h>

GLFW keycode mappings for first-person fly camera navigation and application hotkeys.

Public Members

int moveForward = 87#

Forward movement key (default: W).

int moveBackward = 83#

Backward movement key (default: S).

int moveLeft = 65#

Strafe left key (default: A).

int moveRight = 68#

Strafe right key (default: D).

int moveUp = 69#

Ascend elevation key (default: E).

int moveDown = 81#

Descend elevation key (default: Q).

int speedBoostPrimary = 340#

Primary movement speed boost key (default: Left Shift).

int speedBoostSecondary = 344#

Secondary movement speed boost key (default: Right Shift).

int speedSlowPrimary = 341#

Primary movement precision slow key (default: Left Ctrl).

int speedSlowSecondary = 345#

Secondary movement precision slow key (default: Right Ctrl).

int lookButton#

Mouse button held to rotate the camera view (default: Right Mouse Button = 1).

int resetCamera = 70#

Reset camera pose to initial authored transform (default: F).

int toggleStats#

Toggle window-title statistics and periodic telemetry logging (default: H).

int togglePresentedOutputMode#

Toggle between camera presentation and an available explicit output (default: U).

int cyclePresentedCameraPrevious#

Switch active presentation view to previous camera (default: [).

int cyclePresentedCameraNext#

Switch active presentation view to next camera (default: ]).

int cyclePresentedProbePrevious#

Cycle previous probe or sensor attachment (default: ,).

int cyclePresentedProbeNext = 46#

Cycle next probe or sensor attachment (default: .).

int quit = 256#

Exit application key (default: Escape).