Skip to content

Commit

Permalink
fix(packages/hooks): add meshopt decoder to gltf loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlomoh committed Sep 11, 2024
1 parent 6dae863 commit 87e2198
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { WebGLRenderer } from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader';
import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module';

import eventSystem from '../event-system';

Expand All @@ -30,6 +31,8 @@ function createGltfLoader() {

const gltfLoader = new GLTFLoader()
.setDRACOLoader(dracoLoader)
.setKTX2Loader(ktxLoader.detectSupport(new WebGLRenderer()))
.setMeshoptDecoder(MeshoptDecoder);

gltfLoader.manager.onError = (url) => {
eventSystem.emit('load-error', `Failed to load file ${url}`);
Expand Down

0 comments on commit 87e2198

Please sign in to comment.