Capítulo 541 de 859

Chapter 541: DRACOExporter

Core Idea

An exporter to compress geometry with the Draco library.

Draco is an open source library for compressing and decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller, at the cost of additional decoding time on the client device.

Standalone Draco files have a .drc extension, and contain vertex positions, normals, colors, and other attributes. Draco files do not contain materials, textures, animation, or node hierarchies – to use these features, embed Draco geometry inside of a glTF file. A normal glTF file can be converted to a Draco-compressed glTF file using glTF-Pipeline.

The exporter requires the Draco encoder to be loaded as a global script in advance:

<script src="https://cdn.jsdelivr.net/gh/google/draco@1.5.7/javascript/draco_encoder.js"></script>
const exporter = new DRACOExporter();
const data = await exporter.parseAsync( mesh, options );

Key Concepts

  • MESH_EDGEBREAKER_ENCODING : number (constant): Edgebreaker encoding.
  • MESH_SEQUENTIAL_ENCODING : number (constant): Sequential encoding.

Code Examples

import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js';
  • What it demonstrates: Typical usage of DRACOExporter.

Reference Tables

Constructor

Signature
new DRACOExporter()

Properties

PropertyDescription
.MESH_EDGEBREAKER_ENCODING : number (constant)Edgebreaker encoding.
.MESH_SEQUENTIAL_ENCODING : number (constant)Sequential encoding.

Methods

MethodDescription
.parse()Deprecated: Use DRACOExporter#parseAsync instead.
`.parseAsync( object : MeshPoints, options : DRACOExporter~Options ) : Promise.<Int8Array> (async)`

Key Takeaways

  1. Most relevant properties: MESH_EDGEBREAKER_ENCODING, MESH_SEQUENTIAL_ENCODING.
  2. Key methods: parse, parseAsync.

Connects To