Using AutoWrap with Ogre add-ons

Spanky

11-06-2009 04:10:17

Hey,

Has anyone ever thought about the idea of using the AutoWrap and cpp2java tools to create wrappers for things other than MOGRE? For example, wrapping the terrain managers or something automatically. I could see a few issues with this like handling certain things like the spawning of the plugins, etc. I would actually like to look into this as I am writing an editor and would like to be able to support more add-ons than are currently wrapped. And potentially without too much manual intervention.

If anyone has thought about this before, please post your thoughts. Or if you have some ideas as to why this might/might not work, please post those as well.

Thanks
Shawn

Zonder

11-06-2009 18:10:39

It is a good point bekas would be able to say if it's possible

It does make me wonder whats best as well porting plugins or wrapping them. Did anyone ever test performance with this?

Spanky

05-07-2009 23:56:36

Hey,

I've actually been making progress with this. I've had to modify the base AutoWrap a bit to allow for multiple workspaces existing and a few other things. I've got it to the point where I actually have Caelum specific files being displayed without crashing inside of AutoWrap. The next phase of wbork is to allow certain files to e exported while ignoring others [the Ogre headers are in there as well]. Once I have that, I should at least be able to test whether I can get Caelum wrapped automatically. I'm using a local perforce server to keep revisioned history of everything I do but maybe I can talk to one of the maintainers and get svn access or something. I have been modifying other parts of AutoWrap to pre-generate some values to make debugging easier as well as commenting things as I learn them which might be a help to other people.

As far as performance, it would have the same impact that Mogre itself does since it will use the exact same process. Essentially, a managed class gets created whenever the native one does from what I gather. Beyond that, it's straight calls into the native C++ stuff which should be fine.

smiley80

06-07-2009 19:05:10

It does make me wonder whats best as well porting plugins or wrapping them. Did anyone ever test performance with this?
I haven't seen that much difference in performance between the native Caelum and CaelumSharp (except script loading, because of the way it's implemented).

The main reason for me to port stuff is, that you don't need to have knowledge in C++ if want to modify it later.
On the other side, wrappers are generally easier to maintain , since you only have to worry about changed headers. And there are some addons you can't port, mainly because of the limitations regarding class inheritance at the moment.

Spanky

07-07-2009 06:33:12

The main reason for me to port stuff is, that you don't need to have knowledge in C++ if want to modify it later.

I'm fairly comfortable in either C# or C++. I grew up learning C++ and work as a game developer doing C++ on a daily basis so I'm rather ok with it. I can understand the argument for porting though to bring stuff across. Personally, I don't have that kind of time and don't want to be up the creek if someone in the future decides not to port something.

I have most of Caelum being output now without problem. I am getting tons of compile errors that are due to MCaelum requiring some of the Mogre types. I haven't setup automatic header includes for that but that should resolve a lot of the problems. It was brought up in another thread but I'm having some problems with the Wrapper class as well as the macros that are used. I'll probably work on resolving that conflict soon.

Are there any devs that have access to SVN that are reading this? The changes that I'm making are rather large and might not be suitable for a patch. I can either work with you to get some changes integrated or I can do it myself. Just give me a shout and we can work something out. I think it'd be amazing if we could get a ton of plugins to be automatically wrapped by AutoWrap for use with Mogre.

PS - I haven't had to add any options to Attributes.xml yet to wrap Caelum. It's just happened out of the box. I'll post some more info soon. I might try and grab Hydrax or something and see if it can generate code right out of the box.

GantZ

07-07-2009 11:26:11

i have myself access to the Mogre svn, but it's better to ask Bekas directly, sending him a pm. this way, he could enable you to have access to the svn.

Still, i can help you getting some of your changes commited, feel free to pm me.

Zonder

10-07-2009 17:20:03

I would suggest slapping a label or branching autowrap before commiting large changes :)
It is good to hear you have made progress on this it will push mogre ahead alot been able to wrap all the plugins.

Next thing I think is needed is a auto build tool basically perform all the steps of downloading ogre from SVN in a particular branch and build mogre. I did have a brief look at doing this but I got bogged down with RL work :(

Spanky

11-07-2009 17:53:31

I would suggest slapping a label or branching autowrap before commiting large changes :)
I think that's actually probably the best idea. I probably won't start committing anything until I actually get it working with at least Caelum which is my test bed for now. I'll definitely make a zip file of all my stuff in it once I'm done so that people can take a peek at it while I am committing it to SVN.

Next thing I think is needed is a auto build tool basically perform all the steps of downloading ogre from SVN in a particular branch and build mogre. I did have a brief look at doing this but I got bogged down with RL work :(
The only problem that I can see with that is that you do indeed need to slightly modify the ogre sources by deriving objects from CLRObject and adding the DECLARE_INIT_CLROBJECT_METHOD_OVERRIDE and related macros. I know there was some discussion a while ago about finding a way to not modify the Ogre sources but unless they got anywhere with that, we're stilling going to have to do it. It'd be nice if we had a way that a tool could automatically analyse the sources and add the required parent classes so that we didn't have to do it manually. I think that is an achievable goal which would be a step towards the single click build process. I don't have the time to tackle that bit right now so I'll leave it up to someone else if they want.

Spanky

14-07-2009 04:06:36

I can now confirm that yes, the process does indeed work. I successfully wrapped up Caelum 0.4.0 [using the existing tools heavily modified] and used it in a demo all from within C#. It still requires some manual work right now but some of this is due to errors in Caelum which I will post in their forum. I've got another week or two of cleaning up my projects [I'm also starting to work a bit of overtime at work which is going to chew into my time] but it'll get done. This is something I really need to work for my editor so no worries about it being dropped any time soon :)

I will fix up the demo I made to actually fire events into Caelum to update it and get it rendering properly tomorrow hopefully. Once I have this, I will post a screenshot of it working. After that, I will try to clean everything up and possibly enhance the UI of AutoWrap to support multiple projects even better than it currently does.

YAHOO! Sorry. I'm just really excited as I've been working towards this for about 3-4 weeks now without knowing whether it was going to fully work or not. I also want to take a stab at Hydrax as well so that at least I'll have some nice looking scenes to present with the tool.

What this means is that Mogre should start seeing a bunch of the plugins wrapped up in the coming months more so than it ever has!

Shawn

Spanky

14-07-2009 05:34:35

The following shots are of the C# demo that I created with an automatically wrapped version of Mogre and Caelum.







In regards to when the tool will be updated so everyone has this, all I can say is "when its done" which will hopefully be soon.

Shawn

*Edit: Fixed the image links

TeaBag

27-08-2009 13:30:30

In regards to when the tool will be updated so everyone has this, all I can say is "when its done" which will hopefully be soon.


Hi, I know you said "when its done" but just wondering if you have any news for us.

Although my spare time is quite limited... can I help in any way?

Best,
Luís

Vectrex

06-03-2010 05:04:23

This sounded like it was coming along really well. Did anything come of this? I want to try and use AutoWrap to wrap some other libs, perhaps even non-ogre ones. Is it up to wrapping stuff like raknet? ogreoggsound? etc

hedphelym

06-03-2010 09:40:24

congratulations :) big step forward for us who use Mogre!
keep up the good work!