class inheritance and the scene manager
class inheritance and the scene manager
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?
no...
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.
Re: class inheritance and the scene manager
i derived my own camera and when i create a new one i goqwe 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?
Code: Select all
cam = new MyOwnCam();
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:
So you'll want to emulate this, probably along the lines of
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.
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;
Code: Select all
MyCam* cam = new MyCam(smgr, smgr, id, position, lookat);
node->drop();
smgr->setActiveCamera(cam);