rjw stamp

Welcome to ryanwold.net


Resize reading pane

I ran into a recent issue using SceneExporter(), as referenced in older Three.js tutorials. THREE.SceneExporter() has been deprecated. Fortunately, Three.js offers other ways to import and export files. GLTF is the currently recommended Exporter to use. But, for local development purposes, I wanted a basic .json format, and fortunately, it is quite easy to get started with.

function save() { var result = scene.toJSON(); localStorage.savedScene = JSON.stringify(result); }

function load() { var json = JSON.parse(localStorage.savedScene); var loader=new THREE.ObjectLoader(); loader.parse(json, function(e) { // Set the Scene as the loaded Object scene = e; }); }


Date
2019-11-17
Status
release
Visibility