Linux compatible .Net bindings for irrLicht
-
- Posts: 20
- Joined: Thu Jun 07, 2012 12:35 pm
- Location: Smyrna, TN
- Contact:
Linux compatible .Net bindings for irrLicht
Hello all.
I've started a project on GitHub to create a Linux compatible .Net binding for irrLicht using SWIG.
The GitHub repo at https://github.com/jimmy00784/IrrlichtDotNet
The need for this project arised out of, well, a lack of Linux compatible .Net bindings for irrLicht. What all bindings I found were focused around the MS Windows platform.
Initially, much of the focus of this project will be on creating a Linux centric binding, however, since SWIG is cross platform, if community is interested in the effort, it could become more cross platform than that.
Thanks,
Karim
I've started a project on GitHub to create a Linux compatible .Net binding for irrLicht using SWIG.
The GitHub repo at https://github.com/jimmy00784/IrrlichtDotNet
The need for this project arised out of, well, a lack of Linux compatible .Net bindings for irrLicht. What all bindings I found were focused around the MS Windows platform.
Initially, much of the focus of this project will be on creating a Linux centric binding, however, since SWIG is cross platform, if community is interested in the effort, it could become more cross platform than that.
Thanks,
Karim
Blog: http://karimlalani.blogspot.com
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Re: Linux compatible .Net bindings for irrLicht
irrlicht REALLY needs properly maintained swig wrapper. at the moment we have python irrlicht wrapper which is old and outdated and manually wrapped to c api i believe. then there is irrlichtLime which is really great, but only for windows. having swig wrapper should make it easy enough to keep it updated after initial development is done. check out latest available swig-based wrapper that is for 1.7 i believe: http://sourceforge.jp/projects/irrlichtnet/
-
- Posts: 20
- Joined: Thu Jun 07, 2012 12:35 pm
- Location: Smyrna, TN
- Contact:
Re: Linux compatible .Net bindings for irrLicht
Thanks for the info. I'll certainly take a look at irrlichtnet and if the goals are compatible, I might even consider combining efforts and begin contributing towards keeping irrlichtnet up to date with latest version of irrlicht. So far, I've been able to make available most necessary irrlicht classes and structures in .Net. Operator overloading isn't available yet however I've been able to create working samples of code in .Net for irrlicht. The intention is to proceed with converting the remainder of the functionality with minimum number of SWIG interfaces, proxy and helper classes as necessary to providing a shared library implementation of the binding that doesn't require modifying a single line of irrlicht source code.
Contributors are more than welcome to join their efforts.
Contributors are more than welcome to join their efforts.
Blog: http://karimlalani.blogspot.com
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Re: Linux compatible .Net bindings for irrLicht
I must say what you are saying is impressive! I would advice you against updating irrlichtnet because project is somewhat of a mess. I tried updating it myself but lack of proper organisation and lack of swig experience on my part. however its great for getting some ideas like how to support operators. I'll check out your project tomorrow closer
Re: Linux compatible .Net bindings for irrLicht
Maybe you should contact with Greenya and add support for Linux in great Irrlicht Lime project (of course if it's technically possible). I think that there isn't sense to develop two similar projects.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
-
- Posts: 20
- Joined: Thu Jun 07, 2012 12:35 pm
- Location: Smyrna, TN
- Contact:
Re: Linux compatible .Net bindings for irrLicht
Thanks @Nadro. I'll contact Greenya and see if our goals are compatible.
Blog: http://karimlalani.blogspot.com
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Re: Linux compatible .Net bindings for irrLicht
its not possible to make lime work on Linux because mono can not run mixed mode DLLs.. sadly, because lime is almost perfect
EDIT:
Also check out CppSharp as its supposed to be silver bullet for c++/.net interop.
EDIT:
Also check out CppSharp as its supposed to be silver bullet for c++/.net interop.
-
- Posts: 20
- Joined: Thu Jun 07, 2012 12:35 pm
- Location: Smyrna, TN
- Contact:
Re: Linux compatible .Net bindings for irrLicht
Thanks @roxaz
CppSharp looks interesting. I'll review it and see if it can be used in place of SWIG. It doesn't say anywhere, and LLVM and CLANG are both opensource and available under Linux, so I am hoping this would work under Linux as well. If that is true, that from what I've read in their manuals, CppSharp may be an option worthy of an evaluation for the IrrlichtDotNet project.
CppSharp looks interesting. I'll review it and see if it can be used in place of SWIG. It doesn't say anywhere, and LLVM and CLANG are both opensource and available under Linux, so I am hoping this would work under Linux as well. If that is true, that from what I've read in their manuals, CppSharp may be an option worthy of an evaluation for the IrrlichtDotNet project.
Blog: http://karimlalani.blogspot.com
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Re: Linux compatible .Net bindings for irrLicht
Hi, CppSharp author here, right now the generator will only run on Windows/VS (I will fix this in the coming weeks), but the generated code should work fine in Mono. Overall the project is a bit less mature than SWIG which has been around for years, so expect to hit some bugs while binding a project as big as Irrlicht.jimmy00784 wrote:Thanks @roxaz
CppSharp looks interesting. I'll review it and see if it can be used in place of SWIG. It doesn't say anywhere, and LLVM and CLANG are both opensource and available under Linux, so I am hoping this would work under Linux as well. If that is true, that from what I've read in their manuals, CppSharp may be an option worthy of an evaluation for the IrrlichtDotNet project.
-
- Posts: 20
- Joined: Thu Jun 07, 2012 12:35 pm
- Location: Smyrna, TN
- Contact:
Re: Linux compatible .Net bindings for irrLicht
Thanks @triton
I noticed dependencies on files like vcclr.h (I think) and was wondering if CppSharp has any hard dependencies on Windows only technologies that would make it unsuitable for cross platform development.
I noticed dependencies on files like vcclr.h (I think) and was wondering if CppSharp has any hard dependencies on Windows only technologies that would make it unsuitable for cross platform development.
Blog: http://karimlalani.blogspot.com
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Re: Linux compatible .Net bindings for irrLicht
you may wish to check out my progress https://github.com/umbr4/IrrlichtDotNet
main highlights are make.sh that does all needed to generate wrapper code (does not build anything yet)
and swig is called with -includeall so it includes *ALL* irrlicht headers - no more manual including.
and there are some python scripts to preprocess irlicht headers and stuff generated cs files to csproj
currently generated c# bindings do not build due to 3 errors though, im yet to figure that out.
P.S. i wrecked havok on your project structure, please dont beat me
EDIT:
I suppose we need to turn IEventReceiver into interface and make other cs classes implement it.
main highlights are make.sh that does all needed to generate wrapper code (does not build anything yet)
and swig is called with -includeall so it includes *ALL* irrlicht headers - no more manual including.
and there are some python scripts to preprocess irlicht headers and stuff generated cs files to csproj
currently generated c# bindings do not build due to 3 errors though, im yet to figure that out.
P.S. i wrecked havok on your project structure, please dont beat me
EDIT:
I suppose we need to turn IEventReceiver into interface and make other cs classes implement it.
Last edited by roxaz on Thu Aug 22, 2013 8:36 am, edited 1 time in total.
-
- Posts: 20
- Joined: Thu Jun 07, 2012 12:35 pm
- Location: Smyrna, TN
- Contact:
Re: Linux compatible .Net bindings for irrLicht
You rock @roxaz.
Not upset that you turned the folder structure over its head. I had started working on that myself but you took care of it for me. Power of opensource in action
Also IEventReceiver gets wrapped as an abstract class so no need of an interface. I have a working example. Here it is:
EDIT: IEventReceiver doesn't get wrapped as abstract class however has virtual methods for OnEvent and that does the trick as well.
Not upset that you turned the folder structure over its head. I had started working on that myself but you took care of it for me. Power of opensource in action
Also IEventReceiver gets wrapped as an abstract class so no need of an interface. I have a working example. Here it is:
Code: Select all
using System;
namespace IrrlichtTest
{
class MyEventReceiver : IEventReceiver
{
public override bool OnEvent (SEvent e)
{
Console.WriteLine(string.Format("SEvent: {0}", e.EventType));
SEventProxy sp = irrlichtDotNet.getSEventProxy(e);
Console.Write("SEventType: {0}",sp.EventType);
switch (sp.EventType) {
case EEVENT_TYPE.EET_JOYSTICK_INPUT_EVENT:
Console.Write(", {0}",sp.getJoystickEvent().ButtonStates);
break;
case EEVENT_TYPE.EET_KEY_INPUT_EVENT:
Console.Write(@", {0}, PressedDown: {1}, Ctrl: {2}, Shift: {3}, Char:{4}",
sp.getKeyInput().Key,
sp.getKeyInput().PressedDown,
sp.getKeyInput().Control,
sp.getKeyInput().Shift,
sp.getKeyInput().Char);
break;
case EEVENT_TYPE.EET_LOG_TEXT_EVENT:
Console.Write(", Level: {0}, Text: {1}",sp.getLogEvent().Level,sp.getLogEvent().Text);
break;
case EEVENT_TYPE.EET_MOUSE_INPUT_EVENT:
Console.Write(@", Event: {0}, ButtonStates: {1}, Control: {2}, isLeftPressed: {3}, isMiddlePressed: {4}, isRightPressed: {5},Shift: {6}, Wheel: {7},X: {8},Y: {9}",
sp.getMouseInput().Event,
sp.getMouseInput().ButtonStates,
sp.getMouseInput().Control,
sp.getMouseInput().isLeftPressed(),
sp.getMouseInput().isMiddlePressed(),
sp.getMouseInput().isRightPressed(),
sp.getMouseInput().Shift,
sp.getMouseInput().Wheel,
sp.getMouseInput().X,
sp.getMouseInput().Y);
break;
case EEVENT_TYPE.EET_USER_EVENT:
Console.Write(", {0}, {1}",sp.getUserEvent().UserData1,sp.getUserEvent().UserData2);
break;
case EEVENT_TYPE.EET_GUI_EVENT:
default:
break;
}
Console.WriteLine();
return false;
}
}
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
MyEventReceiver e = new MyEventReceiver();
IrrlichtDevice device = irrlichtDotNet.createDevice(E_DRIVER_TYPE.EDT_OPENGL,new dimension2du(800,600),16,false,false,false,e);
IVideoDriver driver = device.getVideoDriver();
ISceneManager smgr = device.getSceneManager();
IMesh mesh = smgr.getMesh(new stringc_proxy("/home/karim/Projects/Blender/abs2.obj").getStringc());
ISceneNode meshNode = smgr.addMeshSceneNode(mesh);
ILightSceneNode light = smgr.addLightSceneNode();
light.setRadius(10.0f);
ICameraSceneNode cam = smgr.addCameraSceneNodeFPS(null,30.0f,0.05f);
cam.setPosition( cam.getPosition().add(new vector3df(0,0,10)));
cam.setTarget(meshNode.getPosition());
Console.WriteLine("Cube is {0} units away from camera",meshNode.getPosition().getDistanceFrom(cam.getPosition()));
while(device.run())
{
driver.beginScene(true,true,new SColor(0,127,127,127));
light.setPosition(cam.getPosition());
smgr.drawAll();
driver.endScene();
}
}
}
}
Blog: http://karimlalani.blogspot.com
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Re: Linux compatible .Net bindings for irrLicht
real issue is classes like IGUIElement that use multiple inheritance to inherit IEventReceiver. Since it is pure virtual class anyway it could be interface to allow dual inheritance for some classes. atm stuff in my repo won't compile due to overriding nonexistent OnEvent that is lost by discarding all but first inherited class. so that's the problem.
-
- Posts: 20
- Joined: Thu Jun 07, 2012 12:35 pm
- Location: Smyrna, TN
- Contact:
Re: Linux compatible .Net bindings for irrLicht
I see your point with IEventReceiver.
Also, while the C# code compiles after commenting out the problem lines, the C++ code doesn't compile yet. That'll be something that'll need fixing before the library could be used in .Net code.
Also, while the C# code compiles after commenting out the problem lines, the C++ code doesn't compile yet. That'll be something that'll need fixing before the library could be used in .Net code.
Blog: http://karimlalani.blogspot.com
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Twitter: @lalanikarim
IrrlichtDotNet: https://github.com/jimmy00784/IrrlichtDotNet
Re: Linux compatible .Net bindings for irrLicht
could you explain to me what is the point of these proxy classes?