I am writing a multi-threaded application. It is very important to me that some objects, shared among threads, be managed by std::shared_ptr. This is the scenario:
- Input events are handled by a thread different from the rendering thread.
- The input event handler needs a reference to the (to be made "atomic") camera, so it can "control" the camera.
However, Ogre::Camera and Ogre::SceneManager have a somewhat promiscuous relationship, because the scene manager needs to know if objects are visible or not. So, if the camera is not created by Ogre::SceneManager::createCamera, things do not work.
Since Ogre::SceneManager::mCamVisibleObjectsMap is protected, the only solution I see for using a self-managed camera, is to subclass Ogre::SceneManager to implement some registerCamera() / unregisterCamera().
Any thoughts (besides "never use multi-threading")?
PS: Yes, I know that multi-threading is very dangerous.
PPS: I am successfully using OgreBites and SDL3.