feat(3d-nds): use draco to compress glb model
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as THREE from "three";
|
||||
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
||||
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
|
||||
|
||||
type Rect = [number, number, number, number];
|
||||
|
||||
@@ -50,7 +51,12 @@ const createModel = (path: string) => {
|
||||
const model = new THREE.Group();
|
||||
modelCache.set(path, model);
|
||||
|
||||
new GLTFLoader().load(
|
||||
const dracoLoader = new DRACOLoader();
|
||||
dracoLoader.setDecoderPath("/draco/");
|
||||
|
||||
const loader = new GLTFLoader();
|
||||
loader.setDRACOLoader(dracoLoader);
|
||||
loader.load(
|
||||
path,
|
||||
(gltf) => {
|
||||
for (const child of [...gltf.scene.children]) {
|
||||
|
||||
Reference in New Issue
Block a user