[page:Loader] →
[name]
A loader for loading a
.gltf resource in
JSON format.
The
glTF file format is a JSON file format to enable rapid delivery and loading of 3D content.
Constructor
[name]( )
Creates a new [name].
Properties
Methods
[method:Object3D load]( [page:String url], [page:Function callback] )
[page:String url] — required
[page:Function callback] — Will be called when load completes. The argument will be an [page:Object] containing the loaded .[page:Object3D scene], .[page:Array cameras] and .[page:Array animations].
Begin loading from url and call the callback function with the parsed response content.
Notes
This class is often used with [page:glTFAnimator THREE.glTFAnimator] to animate parsed animations.
Example
// instantiate a loader
var loader = new THREE.glTFLoader();
// load a glTF resource
loader.load(
// resource URL
'models/gltf/duck/duck.json',
// Function when resource is loaded
function ( object ) {
scene.add( object.scene );
}
);
[example:webgl_loader_gltf]
Source
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/gltf/glTFLoader.js examples/js/loaders/gltf/glTFLoader.js]