Published
Edited
Dec 10, 2020
7 stars
Insert cell
Insert cell
Insert cell
render(scene, camera)
Insert cell
Insert cell
Insert cell
gltfExport = {
const exporter = new THREE.GLTFExporter();
const gltf = await new Promise(resolve =>
exporter.parse(scene, resolve, {
binary: false,
truncateDrawRange: false
})
);
const blob = new Blob([JSON.stringify(gltf)], { type: 'model/gltf+json' });
return DOM.download(blob, 'south-sudan-roads.gltf', 'Save GLTF');
}
Insert cell
glbExport = {
const exporter = new THREE.GLTFExporter();
const glb = await new Promise(resolve =>
exporter.parse([scene, camera], resolve, {
binary: true,
truncateDrawRange: false
})
);
const blob = new Blob([glb], { type: 'model/gltf-binary' });
return DOM.download(blob, 'south-sudan-roads.glb', 'Save GLB');
}
Insert cell
Insert cell
Insert cell
importedGltf = {
const loader = new THREE.GLTFLoader();
const url = await FileAttachment("south-sudan-roads.gltf").url();
return await new Promise(resolve =>
loader.load(url, function(gltf) {
resolve(gltf);
})
);
}
Insert cell
render(importedGltf.scene, importedGltf.cameras[0])
Insert cell
Insert cell
importedGlb = {
const loader = new THREE.GLTFLoader();
const url = await FileAttachment("south-sudan-roads.glb").url();
return await new Promise(resolve =>
loader.load(url, function(glb) {
resolve(glb);
})
);
}
Insert cell
render(importedGlb.scene, importedGlb.cameras[0])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more