Hagop

scene.getWaitingItemsCount() Incrementation issue

Recommended Posts

Dear all

Maybe this is a dummy question, but I couldn't figure out a workaround solution. I have created a scene using the standard var createScene = function() {}, after which I make MULTIPLE calls to import meshes BABYLON.SceneLoader.ImportMesh().

I try to display the Preloading screen  using the following code

var renderFunction = function ()
     {
       
        if (scene) {
            
                var remaining = scene.getWaitingItemsCount();
                
                if (remaining !=0)
                {
                engine.displayLoadingUI();
                engine.loadingUIBackgroundColor = "green";
                engine.loadingUIText = "Please Wait, An Incredible 3D Online Shopping Experience is Streaming:     " + (remaining ? (remaining + " items remaining") : "");
                }
                else if (remaining ==0)
                {
                    engine.hideLoadingUI();
                }
    
            scene.render();
                 }
        };

engine.runRenderLoop(renderFunction);

The problme is that scene.getWaitingItemsCount() fluctuates, it decreases than increases, then decreases until it gets to zero. Is there a way for Counting to wait for ALL meshes/textures to QUEUE before it fires?

 

Share this post


Link to post
Share on other sites

OK, I see, however is there a way where we can restrict counting to a single BABYLON.SceneLoader.ImportMesh()  call and discard the rest of the calls?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.