Crystal Space
Welcome, Guest. Please login or register.
September 01, 2014, 09:40:58 am

Login with username, password and session length
Search:     Advanced search
9009 Posts in 2043 Topics by 8371 Members
Latest Member: Masko4
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  iMeshDrawCallback issues
« previous next »
Pages: [1] Print
Author Topic: iMeshDrawCallback issues  (Read 1427 times)
eventhorizon5
Jr. Member
**
Posts: 53


View Profile WWW
« on: May 08, 2009, 04:18:03 am »

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:
Code:
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:
Code:
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:
Code:
csRef<iDirectionalCallback> a = scfCreateInstance<iDirectionalCallback>("DirectionalCallback");

Code:
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
Logged
eventhorizon5
Jr. Member
**
Posts: 53


View Profile WWW
« Reply #1 on: May 11, 2009, 05:00:40 am »

I just found that the issue was fixed in 1.4 (I was using 1.2.1, which explains why I was confused about the class declaration).

-eventhorizon
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.533 seconds with 13 queries.