一个能让 GLTF 局部懒加载的 Loader
注: 适用于
THREE R129
,较老 THREE 版本可能需要从对应的 GLTFLoader 重新适配
> pnpm/npm i -S lazy-gltf-loader
详细接口说明请参考types/lazy-gltf-loader.d.ts
import * as THREE from 'three';
import { LazyGLTFLoader } from 'lazy-gltf-loader';
const loader = new LazyGLTFLoader();
loader
.loadAsync('./banzi+bag/banzi+bag.gltf', {
include: ['FENDI_PAIZI', 'close-brown'],
})
.then(gltf => {
console.log(gltf);
gltf.parser
.lazyNodes(['FENDI_PAIZI.001', 'close-red'])
.then(([banziNode, closeNode]) => {
console.log(banziNode, closeNode);
});
});
loader
.loadAsync('./banzi2/banzi2.gltf', {
exclude: ['FENDI_PAIZI'],
})
.then(gltf => {
console.log(gltf);
gltf.parser.lazyAnimation(name).then(animation => {
console.log(animation);
});
});
合并 mesh
合并 material
合并 texture
动画独立化
1
rookielzy 2021-06-24 14:06:14 +08:00
牛!学习了
|