Since model files (created inside or outside of jME) usually will include TextureStates (assuming the model uses textures), we're prevented from backgrounding model loads, since texture loads require the GL thread. Could anybody opine whether the following tactic would work to allow me to load large models over the network from a background (non-GL) thread? I also want it to work for the use case of local models that have a lot of procedural intialization code, like to merge morphs… basically anything that would cause the scene frames to lock noticably as the model instantiates.
Modify the required JMEImporter classes, or the savable implementation methods, to just save off texture image URLs and Spatial.lock*() needs; and add a new method like glInit() which would apply these settings which require the GL thread. Then the loading code would do something like:
// background thread
incipientSpatial = importerImpl.load(modelUrl);
// add to jME update thread queue, or Threading.invokeOnOpenGLThread(), etc.
// GL thread
Postnote: I think that Ogre XML models probably do not have these problems, perhaps to accommodate this use case (Ogre XML materials may be loaded separately). If so, that's a great benefit of OgreXML and I'll use that when I can, but I need this to work with non-Ogre-XML models too.