GLTFExporter - Verge3D 用户手册 - Soft8Soft
Description: 了解如何在使用 Verge3D 制作的交互式 3D 应用程序中使用 GLTFExporter

# GLTFExporter

An exporter for glTF 2.0 assets.

## Extensions

GLTFExporter supports the following glTF 2.0 extension:

- KHR_materials_unlit

## 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

### # .parse(input : Object3D | Array, onCompleted : Function, onError : Function, options : Object)

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.

### # .parseAsync(input : Object3D | Array, options : Object) → Promise

Export scenes/objects to to glTF 2.0 format.

Similar to .parse() method, but returns a promise value instead of calling callbacks.

## 源代码

关于如何获取此模块的源代码，请查看 本页。