ReadonlyaudioReadonlycompsReadonlyengineReadonlyenvReadonlyeventsReadonlyfpvReadonlyobjs3ReadonlyorbitReadonlyraycastReadonlystateStaticrunAsynchronously creates and initializes a new App instance, which acts as the central entry point of the application. After successful validation, this method constructs a fully configured App object that manages 3D objects, web components, application state, and runtime dependencies. This method is typically called once during application startup to ensure a consistent initialization sequence, guaranteeing that all required configuration values and checks are completed before the main logic begins execution.
Optionalcfg: Cfg
A Cfg object containing initialization parameters, runtime settings, and optional debug options.
Optionalclasses: TClasses
Class registry for components and 3D objects. Default: empty object
OptionalcreateStateMachine: (app: App<TClasses>) => AnyStateMachine
Factory function that receives the fully created App instance and returns a state machine.
A promise that resolves when the app startup sequence has completed or when a startup error has been caught.
Example
import { App, cfg, Comp, Obj3D } from 'illutions';
// Enable automatic rotation for the orbit controls.
cfg.orbitCtrls.autoRotate = true;
// Register the classes that should be available to illutions.
// The keys, e.g. `Obj1`, must match the corresponding name used in the scene.
const classes = {
comps: {
// Custom component class registration.
Comp1: Comp,
},
objs3D: {
// Custom 3D object class registration.
Obj1: Obj3D,
},
};
// Create and initialize the illutions app with the given config and registered classes.
App.run(cfg, classes);
Represents the central controller of the illutions 3D engine. The class initializes and manages all core modules of the engine. It provides an entry point for creating and controlling a complete 3D scene.