three-gltf-downloader
v1.0.3
Published
Handy function to download a three.js scene as a glTF Binary
Readme
three-gltf-downloader
A helper function to download three.js scenes (or Object3D subtrees) to a binary glTF file. It utilizes the THREE.GLTFExporter, and includes the browser code to actually download it to disk.
Installation
$ npm install --save download-three-gltfUsage
global.THREE = require("three")
const download = require("download-three-gltf")
const scene = new THREE.Scene()
... add some stuff to scene ...
download(scene, {filename: "MyModel.glb"})Or bind it to a ctrl+s to download later on
window.addEventListener("keydown", (e) => {
if (e.key === "s" && e.ctrlKey) download(scene);
});