Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

This is a bit of a newbie question, but if for example, I want to extend the scene manager, and add a function; do I extend my class (inherit) from CSceneManager or ISceneManager?

Because I'm trying this in MySceneManager.h:

#include <CSceneManager.h>

class RTSSceneManager : public CSceneManager
{
    virtual ICameraSceneNode* addCameraSceneNodeRTS(ISceneNode* parent = 0,
            const core::vector3df& position = core::vector3df(0,0,0),
            const core::vector3df& lookat = core::vector3df(0,0,100),
            s32 id=-1, bool makeActive=true) = 0;
};

But it's giving me this error:

fatal error C1083: Cannot open include file: 'CSceneManager.h': No such file or directory

It works if I use ISceneManager instead of CSceneManager, but then won't I have to re implement CSceneManager over again?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You don't need to extend the scene manager nor the camera(like you said you need modify the engine itself for that). Just add an animator, extend from ISceneNodeAnimatorCameraFPS.h or ISceneNodeAnimatorCameraMaya.h and implement it's functions, instead of extending from the camera and having to extend the numerous functions it has.

share|improve this answer

That error is just because either you're not setting the right path for the SceneManager headers (wherever CSceneManager.h is located), or you do but you're using <> instead of "" in the #include line. It has nothing to do with the inheritance, it should fail either you use CSceneManager or ISceneManager, because you're not including the header properly (or at least that's what the error is saying).

For extending the scene manager you must derive from CSceneManager, as ISceneManager is just an pure virtual interface with no function definitions. Note the =0 at the end of the function declarations in the ISceneManager class, that means the function has a null definition which the implementation class must overload to comply with the interface declaration. If you do derive directly from ISceneManager, you must provide an implementation for every pure virtual function it declares.

share|improve this answer
    
I tried both the "" and the <> However I noticed that the ISceneManager is in the Include folder of the Irrlicht engine while the CSceneManager.h and .cpp are in the source folder. Should I add the source folder to the dependencies (using VS2008) or should I cut or copy the CSceneManager.h and .cpp to the include folder? –  patokun Sep 16 '11 at 7:43
    
Ok I got an answer from the Irrlicht forums. The only way to extend the scene manager is by changing the source code of the engine and recompiling it, instead of extending it from my project. Thank you for your help! –  patokun Sep 16 '11 at 7:52
    
I still believe you could extend it that way, and also for the include files you should go to project properties->Configuration Properties->C++->Additional Include Directories, rather than add as a default path –  Pablo Ariel Sep 16 '11 at 8:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.