2
\$\begingroup\$

If I want to extend the scene manager, and add a function; do I extend my class from CSceneManager or ISceneManager?

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?

\$\endgroup\$

2 Answers 2

3
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ 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? \$\endgroup\$
    – patokun
    Commented Sep 16, 2011 at 7:43
  • \$\begingroup\$ 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! \$\endgroup\$
    – patokun
    Commented Sep 16, 2011 at 7:52
  • \$\begingroup\$ 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 \$\endgroup\$ Commented Sep 16, 2011 at 8:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .