Lysa  0.0
Lysa 3D Engine
Application Class Reference

Detailed Description

Central runtime object that owns the engine subsystems (windowing, GPU queues, resources, physics, and async helpers) and drives the main loop.

Public Member Functions

 Application (ApplicationConfiguration &config)
 
virtual void onReady ()
 
virtual void onQuit ()
 
void addWindow (const std::shared_ptr< Window > &window)
 
void removeWindow (Window *window)
 
auto & getMainWindow () const
 
void updatePipelines (const std::unordered_map< pipeline_id, std::vector< std::shared_ptr< Material >>> &pipelineIds) const
 
void run ()
 
virtual ~Application ()
 

Static Public Member Functions

static const vireo::Vireo & getVireo ()
 
static ResourcesgetResources ()
 
static bool & quit ()
 
static auto & getGraphicQueue ()
 
static auto & getComputeQueue ()
 
static Application & getInstance ()
 
static ApplicationConfigurationgetConfiguration ()
 
static PhysicsEnginegetPhysicsEngine ()
 
static AsyncQueuegetAsyncQueue ()
 
template<typename Lambda >
static auto callDeferred (Lambda lambda)
 
template<typename Lambda >
static auto callAsync (Lambda lambda)
 

Static Public Attributes

static constexpr float FIXED_DELTA_TIME {1.0f/60.0f}
 

Constructor & Destructor Documentation

Application ( ApplicationConfiguration config)

Construct the application runtime using the provided configuration.

virtual ~Application ( )
virtual

Member Function Documentation

void addWindow ( const std::shared_ptr< Window > &  window)

Adds a window to be managed and rendered by the application.

static auto callAsync ( Lambda  lambda)
inlinestatic

Starts a new thread that need access the GPU/VRAM.
Use this instead of starting a thread manually because the rendering system needs to wait for all the threads completion before releasing resources.

static auto callDeferred ( Lambda  lambda)
inlinestatic

Add a lambda expression in the deferred calls queue.
They will be called before the next frame, after the scene pre-drawing updates where nodes are added/removed from the drawing lists (for all the frames in flight).

static AsyncQueue& getAsyncQueue ( )
inlinestatic

Returns the asynchronous queue helper used for background GPU work.

static auto& getComputeQueue ( )
inlinestatic

Returns the compute submit queue used for compute workloads.

static ApplicationConfiguration& getConfiguration ( )
inlinestatic

Returns the application configuration provided at startup.

static auto& getGraphicQueue ( )
inlinestatic

Returns the graphics submit queue used for rendering work.

static Application& getInstance ( )
inlinestatic

Returns the singleton application instance.

auto& getMainWindow ( ) const
inline

Returns a reference to the main window (the first added window).

static PhysicsEngine& getPhysicsEngine ( )
inlinestatic

Returns the physics engine owned by the application.

static Resources& getResources ( )
inlinestatic

Returns the global resources manager owned by the application.

static const vireo::Vireo& getVireo ( )
inlinestatic

Returns the global Vireo object

virtual void onQuit ( )
inlinevirtual

Called when the application is about to quit.

virtual void onReady ( )
inlinevirtual

Called once after initialization is complete and the engine is ready.

static bool& quit ( )
inlinestatic

Request the application to exit its main loop at the next opportunity.

void removeWindow ( Window window)

Removes a previously added window from the application.

void run ( )

Enter the main loop and run until quit() is requested.

void updatePipelines ( const std::unordered_map< pipeline_id, std::vector< std::shared_ptr< Material >>> &  pipelineIds) const

Updates rendering pipelines associated with the specified IDs.

Friends And Related Function Documentation

friend class Node
friend

Member Data Documentation

constexpr float FIXED_DELTA_TIME {1.0f/60.0f}
staticconstexpr

Fixed time step used by the physics update loop (in seconds).