I'm trying to create a mesh draw callback using the iMeshDrawCallback struct, and am having issues - I don't know if it's supposed to be declared in a standard SCF implementation or not, since it's declared with "public iBase" instead of "public virtual iBase" in CS's mesh.h. I can't really find any code online that uses this (I found one thing, but it does everything in a completely different way).
Here's what I've made:
header file:
struct iDirectionalCallback : public virtual iBase
{
public:
SCF_INTERFACE(iDirectionalCallback, 0, 0, 1);
};
class DirectionalCallback : public scfImplementation2<DirectionalCallback, iDirectionalCallback, iMeshDrawCallback>
{
public:
DirectionalCallback(iBase* base);
virtual ~DirectionalCallback();
virtual bool BeforeDrawing(iMeshWrapper *spr, iRenderView *rview);
};
implementation:
SCF_IMPLEMENT_FACTORY(DirectionalCallback)
DirectionalCallback::DirectionalCallback(iBase* base) : scfImplementationType(this, base)
{
}
DirectionalCallback::~DirectionalCallback()
{
}
bool DirectionalCallback::BeforeDrawing(iMeshWrapper *spr, iRenderView *rview)
{
return true;
}
So when creating a test object using these data structures:
csRef<iDirectionalCallback> a = scfCreateInstance<iDirectionalCallback>("DirectionalCallback");
error C2259: 'DirectionalCallback' : cannot instantiate abstract class
due to following members:
'void iBase::IncRef(void)' : is abstract
c:\cs\include\csutil\scf_interface.h(118) : see declaration of 'iBase::IncRef'
'void iBase::DecRef(void)' : is abstract
c:\cs\include\csutil\scf_interface.h(120) : see declaration of 'iBase::DecRef'
'int iBase::GetRefCount(void)' : is abstract
c:\cs\include\csutil\scf_interface.h(122) : see declaration of 'iBase::GetRefCount'
'void iBase::AddRefOwner(void **)' : is abstract
c:\cs\include\csutil\scf_interface.h(131) : see declaration of 'iBase::AddRefOwner'
'void iBase::RemoveRefOwner(void **)' : is abstract
c:\cs\include\csutil\scf_interface.h(133) : see declaration of 'iBase::RemoveRefOwner'
directional.cpp(33) : error C2594: 'initializing' : ambiguous conversions from 'DirectionalCallback *' to 'iBase *'
If iMeshDrawCallback is removed from the SCF type declaration, then it works. Any ideas on how this should be set up?
-eventhorizon