Camera not managed by a SceneManager

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
andrecaldas
Halfling
Posts: 55
Joined: Mon May 06, 2024 1:06 am
x 4

Camera not managed by a SceneManager

Post by andrecaldas »

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:

  1. Input events are handled by a thread different from the rendering thread.
  2. 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. :-)

andrecaldas
Halfling
Posts: 55
Joined: Mon May 06, 2024 1:06 am
x 4

Re: Camera not managed by a SceneManager

Post by andrecaldas »

andrecaldas wrote: Sat Aug 31, 2024 9:04 pm

The input event handler needs a reference to the (to be made "atomic") camera, so it can "control" the camera.

That was very silly of me, I am sorry!

This is my first Ogre program... I realize that I do not need to "control" the camera. I just need to control the "camera node" :lol: . And it seems it is completely okay to create a node without using the scene manager...

Post Reply