From 6aba3fa81d9526f289a3496f9bd258d841b829fe Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 21 Feb 2023 20:59:29 +0100 Subject: [PATCH] DRACO loader support --- src/models/GLTF.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/models/GLTF.ts b/src/models/GLTF.ts index 3bca863..c4d7b0b 100644 --- a/src/models/GLTF.ts +++ b/src/models/GLTF.ts @@ -1,11 +1,20 @@ import { defineComponent } from 'vue' import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js' +import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js' import Model from './Model' export default defineComponent({ extends: Model, + props: { + dracoPath: { type: String, required: true }, + }, created() { const loader = new GLTFLoader() + if (this.dracoPath) { + const dracoLoader = new DRACOLoader() + dracoLoader.setDecoderPath(this.dracoPath) + loader.setDRACOLoader(dracoLoader) + } this.$emit('before-load', loader) loader.load(this.src, (gltf) => { this.onLoad(gltf)