linker errors CShadowVolumeNode deriving from IMeshSceneNode

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
oringe
Posts: 41
Joined: Tue Jul 05, 2011 7:06 am
Location: San Francisco

linker errors CShadowVolumeNode deriving from IMeshSceneNode

Post by oringe »

I have derived my own kxCubeNode class from IMeshSceneNode. My class is basically a cut and paste from CCubeSceneNode with some modifications.
I recently updated my game project to irrlicht 1.8 and now I am having a problem with CShadowVolumeSceneNode in my derived class.
The relevant code from my class: (same as CCubeSceneNode.cpp)

Code: Select all

//! Creates shadow volume scene node as child of this node
//! and returns a pointer to it.
IShadowVolumeSceneNode* kxCubeNode::addShadowVolumeSceneNode(
        const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)
{
    if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))
        return 0;
    if (!shadowMesh)
        shadowMesh = m_mesh; // if null is given, use the mesh of node
    if (m_shadow)
        m_shadow->drop();
 
    m_shadow = new CShadowVolumeSceneNode
        (shadowMesh, this, SceneManager, id,  zfailmethod, infinity);
    return m_shadow;
}
This function is unique to 1.8. It is also the only place where 'new' is used to allocate an Object for the class.
CShadowVolumeSceneNode is not included in <irrlicht.h> so I must #include <CShadowVolumeSceneNode.h> in my kxCubeNode.cpp right?
But this is causing problems, 'unresolved external symbol'
I've set my project properties include dir to both /include and /source/Irrlicht but the linker problems persist :(
polylux
Posts: 267
Joined: Thu Aug 27, 2009 12:39 pm
Location: EU

Re: linker errors CShadowVolumeNode deriving from IMeshScene

Post by polylux »

Hey oringe!

Could you post the linker errors as well?

p.
beer->setMotivationCallback(this);
oringe
Posts: 41
Joined: Tue Jul 05, 2011 7:06 am
Location: San Francisco

Re: linker errors CShadowVolumeNode deriving from IMeshScene

Post by oringe »

Code: Select all

kxCubeNode.obj : error LNK2001: unresolved external symbol "public: __thiscall irr::scene::CShadowVolumeSceneNode::CShadowVolumeSceneNode(class irr::scene::IMesh const *,class irr::scene::ISceneNode *,class irr::scene::ISceneManager *,int,bool,float)" (??0CShadowVolumeSceneNode@scene@irr@@QAE@PBVIMesh@12@PAVISceneNode@12@PAVISceneManager@12@H_NM@Z)
If I comment out the body of the addShadowVolumeSceneNode function and just return 0, everything compiles and runs fine.
I'm pretty sure the problem is with CShadowVolumeSceneNode and it's #include <CShadowVolumeSceneNode.h>
If I include this header in my kxCubeNode.cpp file then all the includes inside the shadow header are not linked properly?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: linker errors CShadowVolumeNode deriving from IMeshScene

Post by hybrid »

Well, the problem is that you cannot instantiate the class directly, as none of its methods are exported. Instead, you need a shadow creation method which is directly available from some other existing class. Bad things is that Irrlicht is currently not able to accept this type of scene node anywhere else than hidden in custom scene nodes. I think it's the only way, though, adding a method in the scene manager which creates a single shadow mesh. We cannot add this to 1.8, though, as it would break the API compatibility, so you have to wait for the next release before it is included in main distributions.
Post Reply