如何导出并导入一个场景与三个JS? [英] How to export and then import a scene with Three JS?
问题描述
我已经尝试过ObjectExporter和SceneExporter。但是仍然无法理解如何将这些数据加载到ThreeJS环境中。
正确的方法是什么?
SceneExporter不导出通过JSON加载的场景对象
ObjectExporter无法导出纹理
链接脚本
ObjectExporter.js
GeometryExporter.js
BufferGeometryExporter.js
MaterialExporter。 js
函数exportScene(save,type){
exporter = new THREE.ObjectExporter;
var obj = exporter.parse(scene);
var json = JSON.stringify(obj);
log(json);
}
将json保存到文件ext .json
从 https://github.com/mrdoob/three.js/tree/master / examples / js / exporters
从 https: //github.com/mrdoob/three.js/tree/master/editor
默认导入编辑器菜单 - >文件 - >导入
我正在努力添加能力导出纹理
I have a complex 3D scene builded with Three JS and a lot of Javascript code. I need to export this scene as one file and then use it on my site with a simple ThreeJS scene player.
I have tried ObjectExporter and SceneExporter. But still can not understand how to load this data back into ThreeJS environment.
What is the right way to do this?
SceneExporter does not export the scene objects that are loaded through JSON ObjectExporter can't exports texture
link scripts
ObjectExporter.js
GeometryExporter.js
BufferGeometryExporter.js
MaterialExporter.js
function exportScene(save, type) {
exporter = new THREE.ObjectExporter;
var obj = exporter.parse(scene);
var json = JSON.stringify(obj);
log(json);
}
save json to file ext .json Library taken from https://github.com/mrdoob/three.js/tree/master/examples/js/exporters Loader taken from https://github.com/mrdoob/three.js/tree/master/editor default import in editor menu->file->import I'm working on that to add the ability to export texture
这篇关于如何导出并导入一个场景与三个JS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!