Jump to content

assetsManager loading percentage


al404
 Share

Recommended Posts

I found a way to display % a custom loading screen with this code

// loading 
function MyLoadingScreen(text) {
	this.loadingUIText = text;
}

MyLoadingScreen.prototype.displayLoadingUI = function() {
	//alert(this.loadingUIText);
}

MyLoadingScreen.prototype.hideLoadingUI = function() {
	
	//alert("DONE!");
	
}

var loadingScreen = new MyLoadingScreen("");
engine.loadingScreen = loadingScreen;

also adding as second function this code to BABYLON.SceneLoader.ImportMesh i can display loading % of my main mesh

, function (evt) { 

	 	if (evt.lengthComputable) {
	 		$('#box-loading-txt').html("Loading, please wait..." + (evt.loaded * 100 / evt.total).toFixed() + "%");
	 		
	 	} else {
	 		dlCount = evt.loaded / (1024 * 1024);
	 		$('#box-loading-txt').html("Loading, please wait..." + Math.floor(dlCount * 100.0) / 100.0 + " MB already loaded.");	 		
	 	} 
	});

since i also have some big texture and the assets to load i'm adding AssetsManager

but i don't know hot to display a % of total file loading instead of my single mesh

 

 

Link to comment
Share on other sites

i saw that on one of the examples but as far as i understood

you cont total assets and how many are already loaded

mi issue is that i probably have 10 assets 5 are very light and the other 5 are between 300kb and 1Mb

can't i retrive total assets weight?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...