我将使用three.js将渲染的伪造查看器导出为glTF文件,以便我可以保存它。 代码如下。
const exportGLTF = () => {
var scene = viewer.impl.sceneAfter;
exporter.parse( scene, function ( gltf ) {
const output = JSON.stringify( gltf, null, 2 );
saveString( output, 'scene.gltf' );
}, {trs: true} );
}
但它输出的是空的 gltf 文件。(像下面的结果。)
{
"asset": {
"version": "2.0",
"generator": "THREE.GLTFExporter"
},
"scenes": [
{
"nodes": [],
"name": "AuxScene"
}
],
"scene": 0
}
我认为从伪造查看器获取场景不起作用。(var scene = viewer.impl.sceneAfter;
)
所以如果有人有这方面的经验,请帮助我。