Jump to content

SceneLoader : difference between onsuccess, scene.isready, scene.executeWhenReady


Vousk-prod.
 Share

Recommended Posts

Yup everyone,

 

Some little questions about proper scene management.

 

1. Is scene.executeWhenReady(callback) equivalent to something like "as soon as scene.isReady, call callback" ?

 

2. We can load complete scene or meshes[ ] from .babylon files with

SceneLoader.Load(rootUrl, sceneFilename, engine, onsuccess, progressCallBack, onerror)

SceneLoader.ImportMesh(meshesNames, rootUrl, sceneFilename, scene, onsuccess, progressCallBack, onerror)

 

Both methods have that great onsuccess callback. The loading is processed in a parallel thread, and it sounds like onsuccess is called only when the scene/meshes[ ] is fully loaded.

 

But when I put this for my onsuccess callback :

function (scene -or meshes, particles, skeletons- ) {             scene.executeWhenReady( function() { ... do some init operations on meshes, like changing material etc... } );}

Time tests show that the scene.executeWhenReady is sent later than the onsuccess, as if it is waiting for some more stuff to load.

 

What the onsuccess and executeWhenReady callbacks are respectively waiting for ?

Link to comment
Share on other sites

about two thirds of the way down http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx in a code comment it says that scene.executeWhenReady waits "for textures and shaders to be ready". Maybe images haven't been loaded yet or maybe the textures and shaders just need to be prepared.

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...