multiple scenemanagers

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
coffeeman

multiple scenemanagers

Post by coffeeman »

Hi!

my problem is that i want split a screen and display two different scenes in it. means that on the one side is another scene then on the other side.

is it possible to use two scenemanagers in ogre?
or could i use another resolution for this?
multiple viewports like in the splitscreendemo will not work because there will the same scene displayed in the viewports.

hope someone could give me a answer or could me a little bit.
William Finlayson
Posts: 61
Joined: Mon Oct 25, 2004 12:11 am

Post by William Finlayson »

You could try using 2 dummy scene nodes, and use them as the root for your two scenes, simply hide one while displaying the other. I don't think that that would cause any complications, but perhaps someone whose tried something similar could confirm this?
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post by luckymutt »

is it possible to use two scenemanagers in ogre?
uuhhh...this is Irrlicht
coffeeman

Post by coffeeman »

ups, sry.

i certainly mean irrlicht. ;)
coffeeman

Post by coffeeman »

could you help me a little bit more.

i tried it with the following code:

Code: Select all

smgr = device->getSceneManger();
smgr2 = device->getSceneManager();
and in renderloop

Code: Select all

...
smgr->getRootScene()->setVisible(false); 
smgr2->getRootScene()->setVisible(false); 
...
but the problem is that the smgr and smgr2 are two pointers to the same scene.

have i misunderstand it?
coffeeman

Post by coffeeman »

in the renderloop i use the boolean variables in right way. the sample in the post before was only to show which syntax i used. ;)
William Finlayson
Posts: 61
Joined: Mon Oct 25, 2004 12:11 am

Post by William Finlayson »

You would use the same scene manager for both scenes:

Code: Select all

smgr = device->getSceneManger(); 
but have your two 'scenes' attached to it:

Code: Select all

ISceneNode scene1 = smgr->addEmptySceneNode();
ISceneNode scene2 = smgr->addEmptySceneNode();
And then instead of creating your scene nodes with parent 0, pass them scene1 or scene2 as the parent:

Code: Select all

ISceneNode scene1_Level = smgr->addOctTreeSceneNode(Level1Mesh, scene1);
ISceneNode scene2_Level = smgr->addOctTreeSceneNode(Level2Mesh, scene2);
Then to render:

Code: Select all

//before drawing scene1
scene1.setVisible(true);
scene2.setVisible(false);
//set up view port 1, and draw scene
// ... viewport code
smgr.drawAll();

//before drawing scene2
scene1.setVisible(false);
scene2.setVisible(true);
//set up view port 2, and draw scene
// ... viewport code
smgr.drawAll();
In essence, do everything you would normally do to set up your scenes, but be sure to use ISceneNode scene1 or scene2 as the root parent rather then the default scene manager root node. Hope thats clear enough, if not, ask away :D
coffeeman

Post by coffeeman »

thx, now i have understand it.
i will test it this afternoon.
Myth
Posts: 81
Joined: Wed Apr 13, 2005 5:48 pm

Post by Myth »

Indeed if you "get" the scene manager. You'll get a pointer. So no matter how much you do that it will always point to the same thing.
A pointer value has a * when declaring it.
Like: ISceneNode *blah;
ISceneNode is astract so it has to be a pointer.

Also, you only need 1 scenenode if it's both on the same level (that's what you want right?).
Just another camera position for the other camera.
Having the same level in your memory twice is not needed;

Code: Select all

ISceneNode *node = smgr->addOctTreeSceneNode(LevelMesh, scene1);
If you want another node for the same level you can always do:

Code: Select all

ISceneNode *controller2 = controller1;
This message might be a bit off topic.. srry.

- Myth
JOIN MY (100mbs 2x 3GHZ CPU) IRRLICHT FORUMS
http://irrlicht.halo4you.com/forums/
For all your programming quesitons and irrlicht ones!.

My fan site: http://www.halo-center.com
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hi, I've read this thread lately, but I just want to inform you that the next version will have the possibility of using multiple scene managers. If this helps a bit. :)
Guest

Post by Guest »

OK thx, but : how do we use it?
Post Reply