GLTFExporter
An exporter for glTF 2.0 assets.
Extensions
GLTFExporter supports the following glTF 2.0 extension:
Code Example
const exporter = new v3d.GLTFExporter();
exporter.parse(
app.scene,
function(gltf) {
console.log(gltf);
},
function(error) {
console.log('glTF export failed!');
},
options
);
Constructor
GLTFExporter()
Creates a new GLTFExporter.
Methods
- input
- Scene or objects to export.
- onCompleted
- Will be called when the export completes. The argument will be the generated glTF JSON or binary ArrayBuffer.
- onError
- Will be called if there are any errors during the glTF generation.
- options
-
Export options:
- trs — export position, rotation, and scale instead of matrix per node. Default is
false
.
- onlyVisible — export only visible objects. Default is
true
.
- binary — export in binary (.glb) format, returning an ArrayBuffer. Default is
false
.
- maxTextureSize — restricts the image maximum size (both width and height) to the given value. Default is
Infinity
.
- animations — array of AnimationClip. List of animations to be included in the export.
- includeCustomExtensions — export custom glTF extensions defined on an object's
userData.gltfExtensions
property. Default is false
.
Export scene/objects to to glTF 2.0 format.
Export scenes/objects to to glTF 2.0 format.
Similar to .parse() method, but returns a promise value instead of calling callbacks.
Source
For more info on how to obtain the source code of this module see this page.