I apologize if I have overlooked something. When I user exits a level I need to destroy everything so I can recreate it all when the user re-enters the level/enters a new level. Is there a way to completely clear a scene? I would be nice if there was. If there is not, what are all the things that need to be cleared? Currently I am doing the following:
calling detachAllChildren() on the root node to kill all children
calling getLocalLightList().clear() on the root node to kill all the local lights
calling getWorldLightList().clear() on the root node to kill all the world lights
I am thinking I also have to remove all controls from the root node. Do I also need to detach my AppStates from the StateManager? Any added cameras I would also have to clear out I am guessing.
Anything else?
Thanks
~David
Well you have to remove all things you have added Processors, GUI, etc. If you are likely to switch “scenes” often you might want to create an AppState that does that in the attach and detach methods. You could also use it to preload the scene on a different thread before you attach it (on the OpenGL thread of course).
Hmm that’s an idea, I will have to look into it. What type of object are ‘Processors’? Guis are fine as I am using Nifty and I have it (almost) completely separate from the JMonkey code.
BTW sorry for posting in the wrong area (again). Wasn’t sure what was specific 'JMonkey Discussion" and what is more generalized troubleshooting >_<.
~David
Processors might be Pssm or Water processors, as said if you dont add…() anything to one of the objects of the Application you dont have to remove it :).