模型加载前的three.js gif图像加载器 [英] three.js gif image loader on before model load
问题描述
如何在使用 OBJMTLLoader
或 AssimpJSONLoader
加载 3d 模型之前显示 gif 图像加载器以指示模型的状态?我使用的是 Three.js 版本 67 并使用下面的代码加载 gif 加载器,但该函数在加载模型时没有任何效果
How to show a gif image loader to indicate the status of the model on before load the 3d models using OBJMTLLoader
orAssimpJSONLoader
? am using three.js version 67 and am using below code load the gif loader, but the function doesn't have any effect while load the model
var loadManager = new THREE.LoadingManager();
loadManager.onProgress = function ( item, loaded, total ) {
alert('hi');
console.log( item, loaded, total );
};
var objloader = new THREE.OBJMTLLoader(loadManager);
这里做错了什么,遗漏了什么?
what am doing wrong here, am missing anything?
推荐答案
快速阅读 LoadingManager docs 这个类似乎没有显示单个加载器的进度,但它显示了多个加载器的进度.
因此,如果您向加载管理器发送 4 个加载器,则 onProgress 事件将触发 4 次,其中 'loaded' 变量为 1、2、3 和 4.
Having a quick read of the LoadingManager docs it seems that the class does not show progress of a single loader, but it shows the progress of many.
So if you send the loading manager 4 loaders, the onProgress event would fire 4 times with the 'loaded' variable being 1, 2, 3 and 4.
这篇关于模型加载前的three.js gif图像加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!