Download recipe/decode.mjs from Lucasgitguy-co/forma3d-tiny-3: direct link, hf CLI and curl.
- Browser
- Download file 608 Bytes
-
https://huggingface.co/Lucasgitguy-co/forma3d-tiny-3/resolve/main/recipe/decode.mjs
- Command line
-
hf download hf://Lucasgitguy-co/forma3d-tiny-3/recipe/decode.mjs
-
curl -L -o decode.mjs https://huggingface.co/Lucasgitguy-co/forma3d-tiny-3/resolve/main/recipe/decode.mjs
608 Bytes
| import { NodeIO } from '@gltf-transform/core'; | |
| import { ALL_EXTENSIONS } from '@gltf-transform/extensions'; | |
| import { dequantize } from '@gltf-transform/functions'; | |
| import { MeshoptDecoder } from 'meshoptimizer'; | |
| await MeshoptDecoder.ready; | |
| const io = new NodeIO().registerExtensions(ALL_EXTENSIONS) | |
| .registerDependencies({ 'meshopt.decoder': MeshoptDecoder }); | |
| const doc = await io.read(process.argv[2]); | |
| await doc.transform(dequantize()); | |
| for (const ext of doc.getRoot().listExtensionsUsed()) { | |
| if (ext.extensionName === 'EXT_meshopt_compression') ext.dispose(); | |
| } | |
| await io.write(process.argv[3], doc); | |