Capítulo 188 de 859
A loader for the MDD format.
MDD stores a position for every vertex in a model for every frame in an animation. Similar to BVH, it can be used to transfer animation data between different 3D applications or engines.
MDD stores its data in binary format (big endian) in the following way:
const loader = new MDDLoader();
const result = await loader.loadAsync( 'models/mdd/cube.mdd' );
const morphTargets = result.morphTargets;
const clip = result.clip;
// clip.optimize(); // optional
const geometry = new THREE.BoxGeometry();
geometry.morphAttributes.position = morphTargets; // apply morph targets (vertex data must match)
const material = new THREE.MeshBasicMaterial();
const mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
const mixer = new THREE.AnimationMixer( mesh );
mixer.clipAction( clip ).play();
Constructor
| Signature |
|---|
new MDDLoader( manager : LoadingManager ) |
Methods
| Method | Description |
|---|---|
.load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) | Starts loading from the given URL and passes the loaded MDD asset to the onLoad() callback. |
.parse( data : ArrayBuffer ) : Object | Parses the given MDD data and returns an object holding the animation clip and the respective morph targets. |