@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
30 lines (29 loc) • 934 B
JavaScript
;
import { ASSETS_ROOT } from "../../../core/loader/AssetsUtils";
import { GLTFLoaderHandler } from "../../../core/loader/geometry/GLTF";
import { SopTypeFile } from "../../poly/registers/nodes/types/Sop";
import { BaseFileSopOperation } from "./utils/File/_BaseFileOperation";
import { sanitizeUrl } from "../../../core/UrlHelper";
export class FileGLTFSopOperation extends BaseFileSopOperation {
static type() {
return SopTypeFile.FILE_GLTF;
}
_createGeoLoaderHandler(params) {
return new GLTFLoaderHandler(params.url, this._node);
}
async _load(loader, params) {
if (this._node) {
return await loader.load({
draco: params.draco,
ktx2: params.ktx2,
node: this._node
});
}
}
}
FileGLTFSopOperation.DEFAULT_PARAMS = {
url: sanitizeUrl(`${ASSETS_ROOT}/models/resources/threedscans.com/eagle.glb`),
draco: true,
ktx2: false,
matrixAutoUpdate: false
};