Closed donmccurdy closed 3 years ago
Out of curiosity, would something like this https://github.com/zeux/meshoptimizer/issues/232 be of interest here, or is copying the decoder .js a natural/expected route to follow for three.js?
Thanks for checking — I don't think it makes much difference for this viewer, since three.js is already a dependency and I have the option of copying the decoder into this repository's Git tree or importing from the three.js npm package. I just haven't gotten to it yet.
A separate npm package for the meshoptimizer decoder could be helpful for https://github.com/donmccurdy/glTF-Transform/issues/106, though, since it doesn't already depend on three.js. That would allow glTF-Transform to decompress a glTF file using KHR_meshopt_compression
to a vanilla glTF file. The workflow for reading files using Draco, for example, is...
import { NodeIO } from '@gltf-transform/core';
import { DracoMeshCompression } from '@gltf-transform/extensions';
import * as draco3d from 'draco3dgltf';
const io = new NodeIO()
.registerExtensions([DracoMeshCompression])
.registerDependencies({
'draco3d.decoder': await draco3d.createDecoderModule(), // Optional.
'draco3d.encoder': await draco3d.createEncoderModule(), // Optional.
});
const doc = io.read('compressed.glb');
... which allows me to leave those dependencies out of the library itself, while still making it easy for users to enable them.
See https://github.com/mrdoob/three.js/pull/21114.