Import
GLTFExporter is an addon, and must be imported explicitly, see Installation#Addons.
import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js';
Properties
.textureUtils : WebGLTextureUtils | WebGPUTextureUtils
A reference to a texture utils module.
Default is null.
Methods
.parse( input : Scene | Array.<Scene>, onDone : GLTFExporter~OnDone, onError : GLTFExporter~OnError, options : GLTFExporter~Options )
Parses the given scenes and generates the glTF output.
| input |
A scene or an array of scenes. |
| onDone |
A callback function that is executed when the export has finished. |
| onError |
A callback function that is executed when an error happens. |
| options |
options |
.parseAsync( input : Scene | Array.<Scene>, options : GLTFExporter~Options ) : Promise.<(ArrayBuffer|string)>
Async version of GLTFExporter#parse.
| input |
A scene or an array of scenes. |
| options |
options. |
- Returns: A Promise that resolved with the exported glTF data.
.register( callback : function ) : GLTFExporter
Registers a plugin callback. This API is internally used to implement the various glTF extensions but can also used by third-party code to add additional logic to the exporter.
| callback |
The callback function to register. |
- Returns: A reference to this exporter.
.setTextureUtils( utils : WebGLTextureUtils | WebGPUTextureUtils ) : GLTFExporter
Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.
Depending on whether you use WebGLRenderer or WebGPURenderer, you must inject the corresponding texture utils WebGLTextureUtils or WebGPUTextureUtils.
| utils |
The texture utils. |
- Returns: A reference to this exporter.
.unregister( callback : function ) : GLTFExporter
Unregisters a plugin callback.
| callback |
The callback function to unregister. |
- Returns: A reference to this exporter.
Type Definitions
.OnDone( result : ArrayBuffer | string )
onDone callback of GLTFExporter.
| result |
The generated .gltf (JSON) or .glb (binary). |
.OnError( error : Error )
onError callback of GLTFExporter.
| error |
The error object. |
.Options
Export options of GLTFExporter.
|
trs
boolean |
Export position, rotation and scale instead of matrix per node. Default is |
|
onlyVisible
boolean |
Export only visible 3D objects. Default is |
|
binary
boolean |
Export in binary (.glb) format, returning an ArrayBuffer. Default is |
|
maxTextureSize
number |
Restricts the image maximum size (both width and height) to the given value. Default is |
|
animations
Array.<AnimationClip> |
List of animations to be included in the export. Default is |
|
includeCustomExtensions
boolean |
Export custom glTF extensions defined on an object's Default is |