class inheritance and the scene manager

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
qwe
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

class inheritance and the scene manager

Post by qwe »

so, if i create my own drived class in Irrlicht for, say, the camera scene node, do I have to modify the scene manager code so i can call smgr->addCustomCameraSceneNode()? or what?
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

no...

Post by schick »

what you want is to set up a custom node. You dont need to use the scenemanager to create such. Watch out for http://irrlicht.sourceforge.net/tut003.html tutorial, here you get the most information you need. If you have further needs post them in the forum.
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

shick, that tutorial is on CustomSceneNodes, not CustomCameraNodes...
a screen cap is worth 0x100000 DWORDS
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Re: class inheritance and the scene manager

Post by rt »

qwe wrote:so, if i create my own drived class in Irrlicht for, say, the camera scene node, do I have to modify the scene manager code so i can call smgr->addCustomCameraSceneNode()? or what?
i derived my own camera and when i create a new one i go

Code: Select all

cam = new MyOwnCam();
since the constructor of CCameraSceneNode takes care of deleting the object when the device is dropped there is nothing else to do. i could post the code for it if you'd like
qwe
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Post by qwe »

interesting... so the object doesn't have to relate to the scene manager like normal? I thought that's what addWhateverSceneNode() was for...
Boogle
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

Post by Boogle »

It is more complicated when creating your own but you don't have to add a new addMyCamera() method to the scene manager.

This is the code from the scene manager for adding a standard camera:

Code: Select all

if (!parent)
	parent = this;

ICameraSceneNode* node = new CCameraSceneNode(parent, this, id, position, lookat);
node->drop();

if (!ActiveCamera)
	ActiveCamera = node;

return node;
So you'll want to emulate this, probably along the lines of

Code: Select all

MyCam* cam = new MyCam(smgr, smgr, id, position, lookat);
node->drop();

smgr->setActiveCamera(cam);
which you can just stick anywhere you want in your own code (without having to update Irrlicht). The two smgr's allow you to specify a different parent in place of the first if you want. The second is there just because you'll need it for the ICameraSceneNode constructor, since you'll be implementing this interface.
qwe
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Post by qwe »

awesome. thanks you guys :D
Post Reply