Irrlicht .NET CP

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

wow i should have thought of that

Post by buhatkj »

i think you're right hybrid. ill try that when i get home. :-)
*EDIT* yup that's all it was, performs fantastic now. :-)

I think now I would definitely prefer this ove rthe stock wrapper. should be much easier to customize. If we could make all the scenenodes inheritable, we will have it made :-)
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
szerg
Posts: 15
Joined: Mon Jun 05, 2006 4:23 pm

Post by szerg »

hi
i cant solve a problem with the trimesh & meshbuffer
please have a look at my post @ this thread : http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=12493
thank you
noone88
Posts: 49
Joined: Sat May 27, 2006 3:28 pm

Post by noone88 »

any updates available? :D
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

I'm currently on holiday (in San Francisco hehe !) so I can't work on Irrlicht .NET but soon when I come back, I'll release the 0.4 which is almost ready.
Thanks for being interested :)
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
dmoonfire
Posts: 7
Joined: Sun Aug 06, 2006 4:13 pm

Post by dmoonfire »

I've been playing with this for almost two whole days, great little library. Of course, I mainly love it because it works on Linux too (though it kills my laptop, 3 fps if I'm lucky). And I almost have a working CeGui# working for it too. :)

One thing I noticed is the namespace, Irrlicht.NET. Given a preference, I'd rather see either Irrlicht (which conflicts with the other .NET) or IrrlichtCP, but not the "NET" or an empty namespace. It got really obvious when I was working with the CeGui stuff since both libraries have Rect and a bunch of other things that required me to fully spell out the path (and .NET is slightly redundant).

The second is related to the rect, I'd love to see the library using the standard stuff in System.Drawing like the rectanges, points, if possible. Makes it simplier to write code that links a lot of libraries.

Just two minor, nitpicky things, but other than that, it was very enjoyable to write with. Can't wait for 0.4.
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

Here we are, I'll soon go for one month far from any broadband connection so I decided to release the 0.4 (actually a pre-release unfortunately) which, as a main feature, supports Irrlicht 1.1 !
Change Log wrote:Irrlicht .NET CP 0.4 :
-Corrected F Key enumeration (thanks to Rowan Lewis)
-Added Vector2D structure (thanks to sh1ny)
-Added VideoDriver.DeleteAllDynamicLights (thanks to sh1ny)
-Added ToBCL/FromBCL methods to Color/Colorf and Rect structures. These methods can be used to convert to standard .NET.
-Changed main namespace from "Irrlicht.NET" to "IrrlichtNETCP" due to several issues (thanks to dmoonfire for the idea)
-Improved a lot MeshManipulator wrapper with documentation.
-Now uses Irrlicht 1.1, list of modifications :
-Changed AddTestSceneNode to AddCubeSceneNode.
-Added AddSkyDomeSceneNode
-Added AddSphereSceneNode
-Added Material type : PointCloud
-Added Texture3 and Texture4 on Material class (also corrected GetTexture2 that returned Texture1)
-Added SceneManager.SaveScene/LoadScene
-Added VideoDriver.CreateScreenShot and VideoDriver.WriteImageToFile. Notice that Irrlicht.NET CP's WriteImageToFile supports
a lot of formats whereas Irrlicht's writeImageToFile only supports bmp for now. So you can save screenshots with this wrapper
in bmp, png, jpeg, gif... Whatever !
-Added VideoDriver.TextureCount, VideoDriver.PrimitiveDrawnCount and VideoDriver.GetTextureByIndex
PS : Due to a stupid bug, I had to move the files to a temporary ftp, right here :
http://admin.akavir.free.fr/Irrlicht.NETCP/
(I modified the first post)
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
noone88
Posts: 49
Joined: Sat May 27, 2006 3:28 pm

Post by noone88 »

keep it up... i really like your work.
Iam currently woking on a similar project wrapping Newton. (It takes some time because of the problem with unmanaged delegates and the garbage collector. I saw a solution for that in your project - thx)

8)
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

I just uploaded again the version because I used an DEBUG version of Irrlicht's dll.
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
Shoarc
Posts: 7
Joined: Tue Aug 08, 2006 9:26 pm

Post by Shoarc »

I've been playing around with this a few days and I have to say, great job. However, I tried collision detection without any success. I then partially converted example 7 (c# collision - in Irrlicht 1.1) to see if something was wrong in my code. The new example 7 didn't work either.

Code: Select all

					Vector3D intersection; 
					Triangle3D tri; 
					if (smgr.CollisionManager.GetCollisionPoint( 
						line,selector,out intersection, out tri)) 
					{
                        Console.WriteLine("intersection :  " + intersection);
                        Console.WriteLine("tri A:  " + tri.PointA);
                        Console.WriteLine("tri B:  " + tri.PointB);
                        Console.WriteLine("tri C:  " + tri.PointC);
                        
                        counter++;
						bill.Position=intersection;

                        tracer2.Position = intersection;
						//driver.SetTransform(TransformationState.WORLD, new Matrix4()); 
						//driver.SetMaterial(material); 
						driver.Draw3DTriangle(tri,new Color(0,255,0,0)); 
                        
					} 
The code went into the if statement but the intersections and triangle vectors were all still (0,0,0).

A portion of the output:

Code: Select all

intersection :  "Type = IrrlichtNETCP.Vector3D; X = 0; Y = 0; Z = 0"
tri A:  "Type = IrrlichtNETCP.Vector3D; X = 0; Y = 0; Z = 0"
tri B:  "Type = IrrlichtNETCP.Vector3D; X = 0; Y = 0; Z = 0"
tri C:  "Type = IrrlichtNETCP.Vector3D; X = 0; Y = 0; Z = 0"
I don't know if there is something with my code or the wrapper so here is the code I used:

Code: Select all

using System; 
using System.Text; 
using System.IO; 


using IrrlichtNETCP;

namespace _07._Collisions 
{ 
	class Program 
	{
        int counter;

		string path=""; 
		IrrlichtDevice device;       
		/// <summary> 
		/// Main entry point for the program. 
		/// </summary> 
		/// <param name="args">Arguments to pass the software.</param> 
		[STAThread] 
		static void Main(string[] args) 
		{ 
			Program prog = new Program(); 
			prog.run(); 
		} 

		public void run() 
		{ 
			DriverType driverType; 

			StringBuilder sb = new StringBuilder(); 
			sb.Append("Please select the driver you want for this example:\n"); 
			sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5"); 
			sb.Append("\n(d) Software Renderer\n(e) Apfelbaum Software Renderer"); 
			sb.Append("\n(f) Null Device\n(otherKey) exit\n\n"); 

            driverType = DriverType.Direct3D9; 

			// Create device and exit if creation fails: 
			device = new IrrlichtDevice(driverType, new Dimension2D(800, 600), 32, false, true, false,false); 

			if (device == null) 
			{ 
				//tOut.Write("Device creation failed."); 
				return; 
			} 

          
			SceneManager smgr=device.SceneManager; 
			VideoDriver driver=device.VideoDriver; 

			device.FileSystem.AddZipFileArchive(path+"map-20kdm2.pk3",true,true); 

			AnimatedMesh q3levelmesh = smgr.GetMesh("20kdm2.bsp"); 
			SceneNode q3node = null; 
			if (q3levelmesh!=null) 
				q3node=smgr.AddOctTreeSceneNode(q3levelmesh.GetMesh(0),null,0,128); 


			TriangleSelector selector = null; 
			if (q3node!=null) 
			{ 
				q3node.Position= new Vector3D(-1370,-130,-1400); 
				selector=smgr.CreateOctTreeTriangleSelector( 
					q3levelmesh.GetMesh(0),q3node,128); 
				// not implemented but not necessary 
				//q3node.TriangleSelector=selector; 
			} 

			CameraSceneNode camera = smgr.AddCameraSceneNodeFPS(null,100,300,false); 
			camera.Position=new Vector3D(-100,50,-150);
            Animator anim = smgr.CreateCollisionResponseAnimator( 
				selector,camera,new Vector3D(30,50,30), 
				new Vector3D(0,-3,0),new Vector3D(0,50,0),0); 
			camera.AddAnimator(anim); 

			device.CursorControl.Visible=false; 
          
			// add billboard 
			BillboardSceneNode bill = smgr.AddBillboardSceneNode( 
				null,new Dimension2Df(20,20),0); 
			bill.SetMaterialType(MaterialType.TransparentAddColor); 
			bill.SetMaterialTexture(0,driver.GetTexture( 
				path+"particle.bmp")); 
			bill.SetMaterialFlag(MaterialFlag.Lighting,false); 
			bill.SetMaterialFlag(MaterialFlag.ZBuffer,false);
			Material material = new Material(); 
			material.Texture1= driver.GetTexture( 
				path+"faerie2.bmp"); 
			material.Lighting=true; 

			/*AnimatedMeshSceneNode node = null; 
			AnimatedMesh faerie = smgr.GetMesh( 
				path+"faerie.md2"); 
			if (faerie!=null) 
			{ 
				node=smgr.AddAnimatedMeshSceneNode(faerie,null,0); 
				node.Position=new Vector3D(-70,0,-90); 
				node.SetMD2Animation(MD2AnimationType.RUN); 
				node.SetMaterial(0,material); 

				node=smgr.AddAnimatedMeshSceneNode(faerie,null,0); 
				node.Position=new Vector3D(-70,0,-30); 
				node.SetMD2Animation(MD2AnimationType.SALUTE); 
				node.SetMaterial(0,material); 

				node=smgr.AddAnimatedMeshSceneNode(faerie,null,0); 
				node.Position=new Vector3D(-70,0,-60); 
				node.SetMD2Animation(MD2AnimationType.JUMP); 
				node.SetMaterial(0,material); 
			} 

			material.Texture1=null; 
			material.Lighting=false; */

			//Add a light 
			smgr.AddLightSceneNode(null,new Vector3D(-60,100,400), 
				new Colorf(1.0f,1.0f,1.0f,1.0f),600,0); 

			/*For not making it too complicated, I'm doing picking inside the drawing 
			  loop. We take two pointers for storing the current and the last selected 
			  scene node and start the loop.*/ 
			//SceneNode selectedSceneNode =null; 
			//SceneNode lastSelectedSceneNode =null; 

            SceneNode tracer1 = smgr.AddCubeSceneNode(20, null, 0);

            SceneNode tracer2 = smgr.AddCubeSceneNode(20, null, 0);

			int lastFPS=-1;
            counter = 0;
			while (device.Run()) 
			{ 
				if (device.WindowActive) 
				{ 
					device.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200)); 
					device.SceneManager.DrawAll(); 

					Line3D line = new Line3D(); 
					line.Start=camera.Position; 
					line.End=line.Start+ 
						(camera.Target - line.Start).Normalize() * 1000;

                    tracer1.Position = line.Start;
                    

                    //Console.WriteLine("here");

                    driver.Draw3DLine(line, new Color(0, 255, 0, 0));

					Vector3D intersection; 
					Triangle3D tri; 
					if (smgr.CollisionManager.GetCollisionPoint( 
						line,selector,out intersection, out tri)) 
					{
                        Console.WriteLine("intersection :  " + intersection);
                        
                        counter++;
						bill.Position=intersection;

                        tracer2.Position = intersection;
						//driver.SetTransform(TransformationState.WORLD, new Matrix4()); 
						//driver.SetMaterial(material); 
						driver.Draw3DTriangle(tri,new Color(0,255,0,0)); 
                        
					} 

					/*selectedSceneNode=smgr.CollisionManager. 
						GetSceneNodeFromCameraBB(camera,0); 

					if (lastSelectedSceneNode!=null) 
						lastSelectedSceneNode.SetMaterialFlag( 
							MaterialFlag.Lighting, true); 

					if (selectedSceneNode==q3node|| 
						selectedSceneNode==bill) 
						selectedSceneNode=null; 

					if(selectedSceneNode!=null) 
						selectedSceneNode.SetMaterialFlag( 
							MaterialFlag.Lighting,false); 
					lastSelectedSceneNode=selectedSceneNode; */

					/*That's it, we just have to finish drawing.*/ 

					driver.EndScene(); 

					int fps = device.VideoDriver.FPS; 
					if (lastFPS != fps) 
					{ 
						device.WindowCaption = "Irrlicht Engine - Quake 3 Map example [" + 
							device.VideoDriver.ToString() + "] FPS:" + fps.ToString(); 
						lastFPS = fps; 
					} 
				} 
			} 
			/* 
			In the end, delete the Irrlicht device. 
			*/ 
			// Instead of device->drop, we'll use: 
			GC.Collect();    
		} 
	} 
}

// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_7"
// This page has been accessed 220 times. This page was last modified 06:51, 20 Jan 2006. 

Sorry the post is so long. Any solutions for this collision problem?
dmoonfire
Posts: 7
Joined: Sun Aug 06, 2006 4:13 pm

Post by dmoonfire »

I was just playing with this problem myself. The GetCollisionResultPoint() seems to work fine but I never figured out how to get GetCollisionPoint() to work even when things look like they "should" work. I even used Draw3D line to make sure the line was in the right place.

I think I found a typo: MouseInputEvent.RMousePressedDOwn (the DOwn should probably be Down).

Is there a chance of getting this in SVN where we can download and compile it ourselves? Might be easier to send in patches if I fix something (since most SVN programs have a patch util that works nicely with revisions).
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

Shoarc => Thanks for the report, I thought I had converted successfully all examples of Irrlicht but there may be a bug everywhere and anywhere actually. I'll fix it :)

dmoonfire => Thanks for the typo, There must be a lot of problems because I wrote the code really quickly and sometimes, late at night...

For the SVN, I have absolutely no experience in managing this sort of stuff actually but if there are enough people interested, we could perhaps open an Sourceforge account for the wrapper. It really depends on how many are interested actually because I don't have that much time.
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
szerg
Posts: 15
Joined: Mon Jun 05, 2006 4:23 pm

Post by szerg »

hi
is it available now to get the generated terrain's mesh and access its meshbuffer?
- i got empty data in v0.3
tks
ChrisTheAvatar
Posts: 3
Joined: Mon Aug 28, 2006 4:31 am
Contact:

Mono Problem Version (1.1.16.1)

Post by ChrisTheAvatar »

When trying to run the examples under SuSE Linux 10.1 running Mono (1.1.16.1). I get hte following error:

Unhandled Exception: System.DllNotFoundException: IrrlichtW
in (wrapper managed-to-native) IrrlichtNETCP.IrrlichtDevice:CreateDevice (IrrlichtNETCP.DriverType,int[],int,bool,bool,bool,bool)
in <0x00043> IrrlichtNETCP.IrrlichtDevice:.ctor (DriverType type, Dimension2D dim, Int32 bits, Boolean fullscreen, Boolean stencil, Boolean vsync, Boolean antialias)
in <0x0013b> GUIExample.Program:Main (System.String[] args)

I have the IrrlichtW.so in the directory I am running the executable from.... I have tried recompiling the .NET version on Linux just to make sure the references were to the .so but I still get the same error, anyone have any ideas of how to fix this.

BTW very cool project... I have been looking for a cross plat form graphics library for .NET for a long long time.

Thanks For Help
Chris The Avatar
-Believe in Christ With All Your Heart
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

ChrisTheAvatar => That's pretty weird because you don't need to specify ".so" to Mono... He'll use ".dll" on Windows, ".so" on Linux and ".dylib" on MacOS.

Try to get code::blocks and recompile IrrlichtW on Linux. Else, it *may* be a permission error but anyway, that's weird.
BTW, you are running on what kernel ? I mean, i386, x64, ... ?
And last, try to retrieve mono's installer from their official website to be sure you are running the last version of mono (I mean, try "which mono" on a terminal to be sure he's not using an old version).

szerg => I have no idea, it *should* work but if you want, you can send me your code so I can test it and add the needed fixes.
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
dmoonfire
Posts: 7
Joined: Sun Aug 06, 2006 4:13 pm

Post by dmoonfire »

ChrisTheAvatar: Try making sure LD_LIBRARY_PATH is pointed to the direction the .so file is in. Another approach is to see how you refer to the files in the p/invoke (I haven't check myself). When I was packaging the the SDL libraries for Debian, I had to create .config files because the p/invokes point to the .dll and I just remapped them to the SO (it wasn't automatic in that case). Just suggestions.

DeusXL: No problem, I'm just impressed with how much you got done. :) That and I finally got visible progress on my 4E5 contest. And almost got the CeGui# layer for this working perfectly.

As for the SVN, I'll put in a vote for it, but I'm not everyone. SVN itself is fairly easy to learn and manage, but it sometimes takes a bit to get over that initial learning curve.
Post Reply