|
Avara3D 0.2.0
C++ API reference
|
Base class and top-level entry point for A3D applications. More...
#include <a3d/Application.h>
Public Member Functions | |
| Application (int argc, char *argv[], log::Level logLevel=log::Level::Info) | |
| Creates application state from process arguments and configures logging. More... | |
Static Public Member Functions | |
| static int | Run (std::unique_ptr< Application > application) |
Runs application using the platform host loop. More... | |
Protected Types | |
| using | SceneCommand = std::function< void(Scene &)> |
| Callable queued for execution at a simulation-step boundary. More... | |
Protected Member Functions | |
| virtual std::unique_ptr< Scene > | init ()=0 |
| Creates the initial Scene for the application. More... | |
| virtual SimulationConfig | simulationConfig () const |
| Supplies the initial simulation scheduling configuration. More... | |
| virtual bool | shouldContinue (const Scene &scene) |
| Determines whether the application host loop should continue. More... | |
| virtual void | didShutdown () |
| Called after the Runner and Scene have been destroyed during shutdown. More... | |
| Runner & | runner () |
| Returns the application's Runner after initialization. More... | |
| const Runner & | runner () const |
| Returns the application's Runner after initialization. More... | |
| Scene & | scene () |
| Returns the application's Scene after initialization. More... | |
| const Scene & | scene () const |
| Returns the application's Scene after initialization. More... | |
| void | queueScenePreStepCommand (SceneCommand command) |
Queues command to run before the next simulation step. More... | |
| void | queueScenePostStepCommand (SceneCommand command) |
Queues command to run after the next simulation step. More... | |
| const std::vector< std::string > & | args () const |
| Returns process command-line arguments excluding the executable name. More... | |
| virtual void | runnerUpdate (Runner &runner, Scene &scene, const Runner::UpdateInfo &info) |
| Called near the beginning of each Runner host update. More... | |
| virtual void | inputDidUpdate (Runner &runner, Scene &scene, InputContext &inputContext, const InputContext::UpdateInfo &) |
| Called after the InputContext has processed the current host update. More... | |
| virtual void | sceneWillStep (Runner &runner, Scene &scene, const Scene::StepInfo &info) |
| Called immediately before each Scene simulation step. More... | |
| virtual void | sceneDidStep (Runner &runner, Scene &scene, const Scene::StepInfo &info) |
| Called immediately after each Scene simulation step. More... | |
| virtual void | frameDidBegin (Runner &runner, Scene &scene, VisualWorld &visualWorld, const VisualWorld::RenderInfo &info) |
| Called after a render frame begins and before scene traversal and drawing. More... | |
| virtual void | contactDidBegin (Runner &runner, Scene &scene, PhysicsWorld &physicsWorld, const PhysicsContact &contact) |
| Called when the PhysicsWorld reports the beginning of a contact. More... | |
| virtual void | contactDidContinue (Runner &runner, Scene &scene, PhysicsWorld &physicsWorld, const PhysicsContact &contact) |
| Called when the PhysicsWorld reports a continuing contact. More... | |
| virtual void | contactDidEnd (Runner &runner, Scene &scene, PhysicsWorld &physicsWorld, const PhysicsContact &contact) |
| Called when the PhysicsWorld reports the end of a contact. More... | |
Base class and top-level entry point for A3D applications.
Applications normally derive from Application, implement init() to create the initial Scene, and optionally override the protected lifecycle and simulation callbacks. Transfer ownership of the derived instance to Run(), which drives the platform host loop for the lifetime of the application.
Application owns the Scene and Runner created for an application and coordinates initialization, host updates, input, simulation callbacks, rendering, contact callbacks, and shutdown.
Unlike other A3D classes, Application is intentionally designed to be subclassed by application code; its protected API is part of the supported application interface.
Definition at line 46 of file Application.h.
|
protected |
Callable queued for execution at a simulation-step boundary.
Definition at line 90 of file Application.h.
| a3d::Application::Application | ( | int | argc, |
| char * | argv[], | ||
| log::Level | logLevel = log::Level::Info |
||
| ) |
Creates application state from process arguments and configures logging.
Derived application constructors normally forward their process arguments and desired initial log level to this constructor.
| argc | number of process command-line arguments. |
| argv | process command-line argument array. |
| logLevel | initial application log level. |
|
protected |
Returns process command-line arguments excluding the executable name.
|
protectedvirtual |
Called when the PhysicsWorld reports the beginning of a contact.
The default implementation does nothing.
|
protectedvirtual |
Called when the PhysicsWorld reports a continuing contact.
The default implementation does nothing.
|
protectedvirtual |
Called when the PhysicsWorld reports the end of a contact.
The default implementation does nothing.
|
protectedvirtual |
|
protectedvirtual |
Called after a render frame begins and before scene traversal and drawing.
The default implementation does nothing.
|
protectedpure virtual |
|
protectedvirtual |
Called after the InputContext has processed the current host update.
The default implementation does nothing.
|
protected |
Queues command to run after the next simulation step.
The command runs after physics advances and before sceneDidStep().
| std::invalid_argument | if command is empty. |
|
protected |
Queues command to run before the next simulation step.
The command runs before sceneWillStep() and before physics advances.
| std::invalid_argument | if command is empty. |
|
static |
Runs application using the platform host loop.
Run() takes ownership of application. On native builds it blocks until execution stops and shutdown completes. On web builds it installs the browser main loop and returns after scheduling execution; the Application is destroyed when that loop terminates.
| std::invalid_argument | if application is nullptr. |
|
protected |
|
protected |
|
protectedvirtual |
Called near the beginning of each Runner host update.
This hook runs before event polling, input update, simulation scheduling, and rendering. The default implementation does nothing.
|
protected |
|
protected |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Supplies the initial simulation scheduling configuration.
Called once after init() and before the Runner is started. The default implementation returns a default-constructed SimulationConfig.