Examples¶
Freya includes example applications demonstrating various engine features. Shared helpers live in Examples/Common/ (FreyaExamplesCommon).
IndustrialPipeLamp¶
Location: Examples/IndustrialPipeLamp/
Deferred PBR reference: lamps, animated lights, shadow-caster modes (0–4), light gizmos (F3), and a secondary window (F10). Quality / deferred views live in the ImGui debug panel.
SsaoDebug¶
Location: Examples/SsaoDebug/
SSAO debug scene (DamagedHelmet, Dragon, ally_ship). Quality, deferred views, and SSAO knobs live in the ImGui debug panel.
SkinnedFox¶
Location: Examples/SkinnedFox/
Crowd skinned demo: Blend2D locomotion, layers, look/IK, CPU or GPU skin paths, animation LOD, and anim_prof metrics. See Animation.
CellBulbasaur¶
Location: Examples/CellBulbasaur/
Cell + edge post-process, custom G-buffer techniques (cell / triplanar / unlit), and toggleable posts (outline, color_grade, underwater, heat_haze, glow). World-space HealthBar / Text nameplates demo BillboardAlign::Screen (Cell) vs Cylindrical (PBR). Hotkeys: F4–F11. Ground uses a tiled albedo for triplanar (F10). TAA/bloom stay available from options.
Creating a new example¶
- Add
Examples/<Name>/Main.cppandResources/as needed. - Add a short
CMakeLists.txt:
add_freya_example(MyExample SOURCES Main.cpp)
# optional: IBL studio|outdoor|both|none (default: studio)
- Register it in Examples/CMakeLists.txt with
add_subdirectory(MyExample).
Reuse helpers from FreyaExamples:::
FlyCam— RMB look + WASD (options for flatten / look-gated move)CreateGroundPlane— procedural ground quadFindClipContaining— animation clip name searchCycleQuality/QualityName— Low→…→Off quality enumsDebugOverlay— Dear ImGui panel (quality / SSAO debug views / CPU + per-stage GPU ms via Vulkan timestamps)ConfigureLogging— console +*.logfile sink (FREYA_LOG_FILE,FREYA_LOG_CONSOLE=0)
Debug overlay¶
All four examples enable FreyaExamples::DebugOverlay on startup. The panel shows:
- Timing — CPU frame/update ms, render resolution, and GPU ms per
IFrameStagefromRenderer::PollFrameGpuTiming(Vulkan timestamps on desktop). This is not Mali HWCPipe (PTILES/ late-ZS); those counters are Arm-only. - Quality — Shadow / SSAO / TAA / Bloom / VSync
- Debug views — deferred G-buffer / SSAO / shadows (
DeferredDebugView), debug draw, SSAO knobs
The scene is rendered to an offscreen viewport (SetViewportTarget) and blitted behind ImGui on the swapchain UI pass (BeginUI / EndUI). FlyCam ignores mouse look while ImGui wants mouse capture; WASD stays available.
Running Examples¶
To build and run examples: