mirror of https://gitee.com/cf-fz/WebCAD.git
parent
0ef9621b43
commit
9fb7bd7ead
@ -0,0 +1,34 @@
|
||||
import { Command } from "../Editor/CommandMachine";
|
||||
import { FileSystem } from "../Common/FileSystem";
|
||||
import * as THREE from "three";
|
||||
import { app } from '../ApplicationServices/Application';
|
||||
|
||||
//FileSystem
|
||||
|
||||
|
||||
export class Fbx implements Command
|
||||
{
|
||||
async exec()
|
||||
{
|
||||
FileSystem.chooseFile((f: FileList) =>
|
||||
{
|
||||
var reader = new FileReader();
|
||||
|
||||
// Closure to capture the file information.
|
||||
reader.onload = (ev) =>
|
||||
{
|
||||
console.log(ev);
|
||||
let manager = new THREE.LoadingManager();
|
||||
let loader = new THREE.FBXLoader(manager);
|
||||
let obj = loader.parse(reader.result, "");
|
||||
|
||||
obj.scale.set(0.01, 0.01, 0.01);
|
||||
obj.matrixWorldNeedsUpdate = true;
|
||||
|
||||
app.m_Viewer.m_Scene.add(obj);
|
||||
}
|
||||
// Read in the image file as a data URL.
|
||||
reader.readAsArrayBuffer(f.item(0));
|
||||
}, null, null);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue