immersive2/src/util/diagramExporter.ts
2023-11-07 07:20:11 -06:00

22 lines
574 B
TypeScript

import {Scene} from "@babylonjs/core";
export class DiagramExporter {
private scene: Scene;
constructor(scene: Scene) {
this.scene = scene;
}
public exportgltf() {
import("@babylonjs/serializers").then((serializers) => {
serializers.GLTF2Export.GLBAsync(this.scene, 'diagram.glb', {
shouldExportNode: function (node) {
return (node?.metadata?.exportable as boolean);
}
}).then((gltf) => {
gltf.downloadFiles();
});
});
}
}