Can I pause the rendering of the rootNode and keep gui still rendering?

Hi,



I’m trying to get load a scene while displaying a loading screen. A simple image and a “loading” text floating around in the corner.

So I use a Callable object to create my scene and it works almost great!

My problem is, I can’t add nodes to the rootNode at any point I want because it might be rendering.

Could I stop the rendering of the rootNode, maybe remove the rootNode from the renderer while it’s loading?

Without stop rendering the gui stuff… Is that possible?

Enqueue is the the magic key word here. oô



Why stop rendering. Is it important for you that it does not? If not… simply enqueue your callables and process them when the time is right… In update() it should be pretty save to do that.

Read the threading tutorial…

I got the idea of using callable from the tutorial.

I just didn’t like the idea of having to write

[java]Vector3f location = application.enqueue(new Callable<Vector3f>() {

public Vector3f call() throws Exception {

//we clone the location so we can use the variable safely on our thread

return mySpatial.getLocalTranslation().clone();

}

}).get();[/java]

Each time I require a simple vector.



But it’s not a huge deal. Ill just make a fake rootNode.

While loading I’ll add to that rootNode and when I’m done loading I transfer all models from the fake to the real rootNode.

@Addez said:
I got the idea of using callable from the tutorial.
I just didn't like the idea of having to write
[java]Vector3f location = application.enqueue(new Callable&lt;Vector3f&gt;() {
public Vector3f call() throws Exception {
//we clone the location so we can use the variable safely on our thread
return mySpatial.getLocalTranslation().clone();
}
}).get();[/java]
Each time I require a simple vector.

But it's not a huge deal. Ill just make a fake rootNode.
While loading I'll add to that rootNode and when I'm done loading I transfer all models from the fake to the real rootNode.


Or just add the "fake" node to the root node. There is no reason to transfer them all anyway.

I think too often people use the root node as a general dumping ground instead of having properly localized roots for different purposes.

And I agree… anyone catching themselves writing that snipped of code in a real app is likely doing something wrong at the design level.