我如何确定何时加载模型以获得有关加载进度的定期更新,以便我可以构建加载图标。我已经跟踪了我能找到的每个turorial,但是每个回答的onProgress方法只在加载完成后才会触发一次。
我在打字稿中的加载程序代码:
// Load manager
private manager = new THREE.LoadingManager();
// Set up loading manager (in constructor of class)
this.manager.onProgress = function ( item, loaded, total ) {
console.log( item, loaded, total );
};
// Load OBJ File from Server
private loadFile(path) {
let loader = new THREE.OBJLoader(this.manager)
loader.load(path, (obj)=>{
this.model = obj;
this.boundingBox = new THREE.BoxHelper(obj)
this.scene.add(this.model);
});
}
日志:
http://localhost:5000/api/file/largeModels/z3.obj 1 1
我只在加载了模型后得到这一个日志。我该如何解决这个问题?
答案 0 :(得分:1)
请尝试以下代码。
from Tkinter import *
master = Tk()
info=[ ['sue', 1, 'Argentina', 'Bsc'],
['peggy-sue', 17, 'U.K.', 'Bsc'],
['susie', 234, 'France', 'BA']
]
listbox = Listbox(master, width=60)
listbox.pack()
listbox.insert(END, "{:<15s} {:>5s} {:<25s} {:<5s}".format("Name","id","Nationality","Qual") )
for i in range(len(info)):
item = "{:<15s} {:>5d} {:<25s} {:<5s}".format(info[i][0],info[i][1],info[i][2],info[i][3])
print item # Gives nicely formatted lines
listbox.insert(END, item) #Lines are not nicely formatted in listbox
mainloop()