Tubulii
11-05-2012 11:08:54
I played a bit with c++/cli to implement inheritance and override support into Mogre. And I had some success.
Problem: Mogre does not support inheritance, only a few classes can be overriden but the most important classes (e.g. SimpleRenderable) have no public constructor (that's only a small part of he problem ).
Theory: Bind a managed class (with abstract methods) on a native class and the other way around (circualar dependency!). Both inherit their eqivalent (e.g. Mogre::Archive and Ogre::Archive) (more here).
The problem is that autowrapper does not support this. Maybe there is a way to "unlock" this "feature" but I have not found it yet. Therefore I added some custom files (/classes) to Mogre and compiled it.
It seems to run. Here is an extract of my log:
I wrapped two classes by hand: "Archive" and "ArchiveFactory" into "ArchiveOR" and "ArchiveFactoryOR" (OR= overrideable; ArchiveOR inherits Mogre::Archive and ArchiveFactoryOR inherits Mogre::Wrapper).
I guess my approach is buggy and I have no idea if there are any memory leaks or invalid pointer. A quick test does not revealed any serious problems. I was able to load a mesh and display it.
Now I will try to improve my wrapper code and to do more testing. I will upload the source and maybe a compiled test project if its small enough (currently >400MB)
Edit: "Sorry, the board attachment quota has been reached." -> I will upload it to dropbox...
Edit2:
Problem: Mogre does not support inheritance, only a few classes can be overriden but the most important classes (e.g. SimpleRenderable) have no public constructor (that's only a small part of he problem ).
Theory: Bind a managed class (with abstract methods) on a native class and the other way around (circualar dependency!). Both inherit their eqivalent (e.g. Mogre::Archive and Ogre::Archive) (more here).
The problem is that autowrapper does not support this. Maybe there is a way to "unlock" this "feature" but I have not found it yet. Therefore I added some custom files (/classes) to Mogre and compiled it.
It seems to run. Here is an extract of my log:
11:32:58: ArchiveFactory for archive type vfs registered.
11:32:59: Added resource location 'C:[...]\Mogre Tests\Overridable\bin\Debug\models' of type 'vfs' to resource group 'General'
(side note: Usually ogre has no "vfs" ArchiveFactory)I wrapped two classes by hand: "Archive" and "ArchiveFactory" into "ArchiveOR" and "ArchiveFactoryOR" (OR= overrideable; ArchiveOR inherits Mogre::Archive and ArchiveFactoryOR inherits Mogre::Wrapper).
I guess my approach is buggy and I have no idea if there are any memory leaks or invalid pointer. A quick test does not revealed any serious problems. I was able to load a mesh and display it.
Now I will try to improve my wrapper code and to do more testing. I will upload the source and maybe a compiled test project if its small enough (currently >400MB)
Edit: "Sorry, the board attachment quota has been reached." -> I will upload it to dropbox...
Edit2:
- Experimental build (54MB) ( resource paths need to be corrected!)
Wrapper source code (4KB) (needs to be compiled with mogre source, see autobuilder)[/list:u]