![]() |
Lysa
0.0
Lysa 3D Engine
|
lysa::ContextConfiguration and lysa::Lysa Every Lysa application is anchored by two objects: a lysa::ContextConfiguration aggregate that describes engine-wide settings, and a lysa::Lysa instance that consumes it and initialises the graphics device, virtual filesystem, and event bus.
In this sample both live in Main.cpp. The configuration is declared at file scope so it can be mutated in lysaMain (to pick the graphics backend) before the engine is constructed:
ContextConfiguration | Field | Default | Effect |
|---|---|---|
backendConfiguration.backend | VULKAN | Graphics API (VULKAN or DIRECTX) |
deltaTime | 1.0/60.0 | Fixed timestep for PHYSICS_PROCESS events |
framesInFlight | 2 | Number of GPU frames in flight (double-buffering) |
maxShadowMapsPerScene | 20 | Upper bound on active shadow maps |
resourcesCapacity | see below | GPU pool sizes for meshes, images, materials |
eventsReserveCapacity | 100 | Initial event-queue pre-allocation |
resourcesCapacity defaults are generous for small scenes. For large worlds (hundreds of unique meshes, thousands of textures) you should raise meshes, images, and vertices to avoid pool exhaustion at runtime:
After lysa::Lysa is constructed the singleton is reachable everywhere via lysa::ctx(). Common members you will use throughout an application:
The app:// URI scheme maps to the working directory at startup. res:// resolves to the engine's own resource directory.
lysa::Lysa must be the first member of the Application class because the window, camera, and scene all depend on the context it creates. C++ initialises members in declaration order, so the ordering in the class definition is sufficient:
Lysa provides its own platform main and calls lysaMain. The backend selection happens here, before Application is constructed, because backendConfiguration is read once during lysa::Lysa construction:
lysaMain uses if constexpr so the DirectX branch is compiled only on Windows. On Linux the Vulkan path is always used and no runtime check is needed.Next : Rendering window