Page 1 of 1

loading multiple .irr files?

Posted: Thu May 09, 2013 8:27 pm
by n56
making a multiple level game using different .irr files, how can we do this?

Re: loading multiple .irr files?

Posted: Thu May 09, 2013 8:42 pm
by luthyr
Do you mean loading multiple .irr files into one active scene (manager) or having separate levels, each a different .irr file?

If you are wanting to simultaneously load multiple .irr files, I think you can just simply load them in succession.

If you want to treat them as separate level files, then you just need to call the SceneManager's clear function and load the next level.

Re: loading multiple .irr files?

Posted: Fri May 10, 2013 8:27 am
by n56
having seperate levels, i use thre clear but does that mean everything i had in the scenemanager goes? is there not a way to unload a level only?

Re: loading multiple .irr files?

Posted: Fri May 10, 2013 1:20 pm
by luthyr
One thing you could do is load a level where the root node is another node, and simply remove that node if you'd like to keep everything else intact. It would act as a holder of all the level objects.

So: Create an empty scene node position (0,0,0) rotation (0,0,0) scale (1,1,1). Call loadScene and set the parent to be that empty scene node so all objects get loaded as a child of this object. Then if you call SceneManager->queueForRemoval() or emptyNode->remove() or whatever to remove it from the scene, you can keep the rest of the SceneManager objects.

Re: loading multiple .irr files?

Posted: Fri May 10, 2013 6:33 pm
by n56
when clearing the scenemgr i get an error?

Re: loading multiple .irr files?

Posted: Fri May 10, 2013 7:32 pm
by luthyr
That's not enough info to tell what's going on, but if you remove objects from the scene, you have to be absolutely sure nothing is referencing them still. For instance, you cannot remove objects if they are queued up to draw (which is why QueueForRemoval() is safer). Otherwise, if anything is trying to access those now deleted objects outside of the scene manager, it will crash.

Re: loading multiple .irr files?

Posted: Sat May 11, 2013 10:58 am
by Mel
It is better to handle the scene clear outside the begin/end calls, it is the best way to be sure you aren't picking something you shouldn't