I have a network thread receiving entity data for a region, in jme2 I had an own asset system where assets(nodes) were attached to the scenegraph and on update the loaded(nodes) were attached below once loaded.
Having moved to jme3 I have ditched my asset system in favor of the standard, but come around the problem of IllegalStateException in Spatial::checkCulling. It seems calls to updateGeometry are not that good idea in an non synchronized way.
So here’s my question. How do you handle this in plain jme3, is there a standard way of doing this, or do I have to revive some kind of dummy assets. Or would you suggest some kind of AsyncManager which is integrated into the update call (but this would require to store an information on where to attach the loaded nodes too, hmm…) Anyway, is there something like this already in jme3 ?
Don’t, use Callables that you enque to the opengl thread, so all scenegraph changes are done in the openglthread. (also i wonder taht that worked in jme2, as it is not at all thread safe what you did/plan to do.
Your problem mainly is taht you modify the scnegraph outside openglthread, don#t.
From what I understand the Spatial::update is the right place to do that, in jme2 a, nd 3. Don’t get me wrong, a node is present in the actual sg. As soon as the asset is loaded(by a Future), it will be attached as a child on the next update call. Worked perfect in jme2.
Solved it by adding a sceneupdater which gets called instead of attachChild. Updater queues the requests to be attached and does it so in the update loop of the application (simpleUpdate)
Just curious… how is this different than the Callable queue already built into JME? Or are you using that queue and this is just a wrapper of some sort?
Theres like a hundred posts with the snippet I will add to this one as well and the documentation at least mentions it twice.
No, it’s not using that queue. I’ll have a look at it. The docs suggest it is valled in the render loop (guess just a docs bug). Perhaps a wiki hint or an example might be usefull, as I have read the introductions and found no site suggesting its usage. I’ll teporreport back.