[name]

App class allows you to set up your 3D application more easily. It includes code to init WebGL renderer, load glTF scenes, auto-start animations as well as logic for basic camera controls.

Constructor

[name](container, ctxSettings, preloader)

container - the id of an HTML-element or the HTML-element itself to contain the canvas.
[page:Object ctxSettings] - the WebGL context attributes to be passed in the 'canvas.getContext()' method.
[page:Preloader preloader] - the application's Preloader.

Properties

[property:Boolean clearBkgOnLoad]

Set the scene background to *null* after loading a gltf scene. Default is *false*.

[property:HTMLElement container]

A container element. This is a parent element for 3D Canvas used for rendering operations.

[property:Scene scene]

Application main scene.

[property:Camera camera]

Application main camera.

[property:Clock clock]

Application clock object.

[property:null controls]

Application main camera controls object.

[property:AnimationMixer mixer]

Mixer used to play animations loaded from glTF data.

[property:HTMLElement preloader]

App preloader element (exists only during scene loading)

[property:WebGLRenderer renderer]

Application WebGL renderer.

[property:GLTFLoader loader]

Application glTF loader.

[property:Number worldCubemapRes]

Resolution of the cubemap texture represeinting the world material. Default is 1024.

Methods

[method:null animate]()

Handler for scene updates: rendering, animations and camera controls. Do not change unless you know what you are doing.

[method:null cleanup]()

Unload scene and clean up application data.

[method:null enableControls]()

Enable controls for the main app camera. Depending on the control type specified for the camera this method will give you 'ORBIT', 'FLYING' or static camera.

[method:Camera getCamera]()

Returns main app camera.

[method:number getHeight]()

Return calculated container element height.

[method:number getWidth]()

Return calculated container element width.

[method:null initPostprocessing]()

Handler for app post-processing initialization. Do not change unless you know what you are doing.

[method:null load](url, loadOkCb, loadErrorCb, autoStart)

Load the glTF scene.

[method:null onResize]()

Handler for canvas resize event. Do not change unless you know what you are doing.

[method:null render]()

Handler for scene rendering. Do not change unless you know what you are doing.

[method:null run]()

Starts the application by removing the preloader and starting the rendering cycle.
[sourceHint]