Lysa  0.0
Lysa 3D Engine
Rendering window

MainWindow.ixx : window and renderer configuration

The window configuration and the MainWindow class are co-located in src/MainWindow.ixx. lysa::RenderingWindowConfiguration is an aggregate that describes everything from the window title down to the post-processing stack:

export module main_window;
import lysa;
lysa::RenderingWindowConfiguration renderingWindowConfiguration {
.title = "Lysa – Rotating Asset",
.width = 1280,
.height = 720,
.renderTargetConfiguration = {
.presentMode = vireo::PresentMode::VSYNC,
.rendererConfiguration = {
.depthStencilFormat = vireo::ImageFormat::D32_SFLOAT,
.clearColor = lysa::float3{0.05f, 0.05f, 0.10f},
.toneMappingType = lysa::ToneMappingType::ACES,
.postProcessAntiAliasingType = lysa::PostProcessAntiAliasingType::SMAA,
.bloomEnabled = true,
.ambientOcclusionType = lysa::AmbientOcclusionType::GTAO,
}
}
};

Renderer type

rendererType selects the rendering pipeline:

Value Description
DEFERRED G-buffer pass → lighting pass → post-processing. Best for many dynamic lights.
FORWARD Single forward color pass. Simpler; fewer lights per draw call.

The deferred path writes albedo, normals, roughness/metallic, and depth into G-buffers during the geometry pass, then resolves all lighting in a single compute pass. This decouples the cost of lighting from the number of rendered triangles, making it efficient for scenes with many overlapping lights.

Present mode and depth format

presentMode:

Value Effect
VSYNC Locks to the display refresh rate; no tearing
IMMEDIATE No synchronisation; lowest latency but may tear

depthStencilFormat: D32_SFLOAT gives full 32-bit depth precision. Use D24_UNORM_S8_UINT when a stencil buffer is needed alongside depth.

Post-processing options

Field Options
toneMappingType NONE, REINHARD, ACES
postProcessAntiAliasingType NONE, FXAA, SMAA
ambientOcclusionType NONE, SSAO, GTAO
bloomEnabled true / false

ACES tone mapping maps HDR radiance values to the display range with a cinematic contrast curve. SMAA (Subpixel Morphological Anti-Aliasing) is a post-process filter that reduces jaggies without accumulation artefacts. GTAO (Ground Truth Ambient Occlusion) is a screen-space technique that darkens concavities for added depth.

All post-processing passes run as compute shaders on the GPU and can be individually disabled for performance profiling.

MainWindow class

MainWindow extends lysa::RenderingWindow and subscribes to two events in its constructor:

class MainWindow : public lysa::RenderingWindow {
public:
MainWindow() : RenderingWindow(renderingWindowConfiguration) {
[&](const lysa::Event&) {
auto title = renderingWindowConfiguration.title;
== vireo::Backend::VULKAN)
? " (Vulkan)" : " (DirectX)";
setTitle(title);
show();
});
[&](const lysa::Event&) { lysa::ctx().exit = true; });
}
};

READY fires once the GPU swapchain is initialised. The window is hidden by default and shown only at this point, so the first visible frame is already rendered, avoiding a blank flash on startup. The active backend name is appended to the title bar for quick identification.

CLOSING fires when the user dismisses the window. Setting lysa::ctx().exit = true causes lysa::Lysa::run() to return on the next iteration.

lysa::RenderingWindow exposes helper methods you will frequently need:

Method Purpose
getRenderTarget() Returns the lysa::RenderTarget that owns the swapchain
getMousePosition() Returns the current cursor position in pixels
resetMousePosition() Moves the cursor to the window centre (used for FPS look)
setMouseMode(mode) VISIBLE, HIDDEN, or HIDDEN_CAPTURED
setTitle(str) Updates the window title bar
id Unique identifier used when subscribing to window-targeted events

Next : Scene node hierarchy