Colladaloader And Progresscallback
What is the correct way of implementing a loading bar in ColladaLoader? The source code shows that the loader takes three parameters. One which is a progressCallback. progressCallb
Solution 1:
Looking at the source code of ColladaLoader.js
, it looks like the progressCallback
function checks the total amount of characters in your collada file(5,200,000) and the amount of characters read.
You can get a percentage by using
var percent = Math.round(callback.loaded / callback.total) * 100;
Your percentage is jumping from one number to another most likely because it is being called locally or part of the data is cached. If you run this from a server, your percentage will be updated gradually.
WestLangley is correct that the total will only show up on a server or local server and as null
if opened as file. This is because Ajax sends a request to the server.
Post a Comment for "Colladaloader And Progresscallback"