I've been thinking some more about this part:
Should not be too difficult as OSG defines copy construction operators for its scene graph, with detailed control over Deep or Shallow copies for each component. We want a shallow copy, except for anything that has a controller attached to it.Creating multiple instances of the same NIF file should be overhauled. For static meshes we can just share the entire scene graph, since OSG allows multiple parents for a node. Currently we have to parse the file again for every instance that is created.
One problem would be that Controllers store a pointer to the target node, which would become invalid. We can solve this by turning controllers into nodes, attached as a child of their target.
When that's done, we can create instances of any .nif (be it static or dynamic) without having to convert it again. Is that much faster? I'm not sure. Either way, I'm leaning toward this approach because it requires almost no code and we will have resource sharing (e.g. for Geometry) built in automatically due to the shallow copy.
I *think* that's already done, or rather, not an issue in the first place. With the default threading mode, osgViewer uses a separate graphics thread for OpenGL calls, which goes on drawing (and swapping) while the main thread is already running the next frame's update (or in the case of the loading screen, loading stuff). I bumped into this when attempting to change a StateSet from a key event handler, which crashed sometimes when the graphics thread had not submitted that StateSet for drawing yet. (FWIW, that was easily fixable by setting the StateSet's DataVariance to DYNAMIC, as explained in Robert's post)Render the loading screen in a separate thread