Irrlicht Lime is a .NET wrapper for Irrlicht Engine

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

roxaz,

Personally i never wrote implementation of ISceneNodeAnimator, so if you have some short and good example and you can post it here -- that would help a lot.

P.S.: I learned Irrlicht from its examples, and if some feature not lighted in examples, i may even do not know if it really has it.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

I almost made this work. Got bit stuck on animateNode, ISceneNode is passed to it, but managed callback expects managed SceneNode type so i am lost a bit.

For examples you could just take a look at irrlicht\source\Irrlicht\CSceneNodeAnimatorCameraFPS.[h/cpp]. This is my ripoff (http://pastebin.com/iGKm7ThC) of fps camera, dunno which one suits you better.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

I know that Irrlicht sources contains a lot of implementations of the interfaces which are public to implement for ordinary users. But i think that 300+ lines is not a short example.

Anyway, once good example will come to my mind, i will take it and implement required feature for it to work in Irrlicht Lime. After that, i will include that example to Lime' examples folders, so it will demonstrate how to use this feature. :roll:

P.S.: nevertheless i put "ability to be able to implement SceneNodeAnimator" to my todo list.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

you dont need to read all 300 lines tho. hell, all you need is a header, who cares what contents of cpp file are? :] well maybe you would also like to peek at constructor definition in cpp, that is all :]
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

also it seems there are issues with rendering to win32 form.. or its something i dont know. Anyway - camera does not receive any user input.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

roxaz wrote:also it seems there are issues with rendering to win32 form.. or its something i dont know. Anyway - camera does not receive any user input.
Yes. I know that, but as i checked it is not a bug of a wrapper, in c++ win32 example the same behavior. And i still didn't managed how to solve it -- simply send user events on each click or mouse move -- don't think this is good idea.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

i see.. maybe its because windows messages are received and handled by GUI thread, not irrlicht thread..

regarding inheritance of animators - i looked at problem at hand. looks like inheritor trick would not be enough this time. I made inheritor class like you did, and animateNode of inheritor object gets called like it should, however ISceneNode* is passed to that call. Now if we create scene nodes ourselves then node pointer really points to SceneNodeInheritor* object. That object can store managed SceneNode^ that it is tied to. However there is a problem. And problem is adding scene node to say camera, or any scene node that is created inside irrlicht. What happens is that object passed to animateNode is ISceneNode* that does not have member with its managed object stored.

So any thoughts how we could match ISceneNode* to its managed object counterpart? I thought it would work out if there was ability to store user-chosen pointer in CSceneNode, but that would require engine modification, and if modification would not make to the engine release then its not an option to use..
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

question regarding inheritance - have you seen Irrlicht.NET (discontinued wrapper)? It does not use any of these tricky inheritor classes. It seems rather simple solution.
grunt
Posts: 96
Joined: Tue Aug 17, 2004 9:14 pm
Contact:

Post by grunt »

Can someone recompile irrlicht lime in release mode for me. I cant run the examples because I dont have the debug runtimes. I tried installing the vcredist package and same problem. I was reading compiling in release mode will fix the problem. Tried to open the project and recompile using sharpdevelop but it looks like irrlicht lime is c++ .net and i get an error message.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

roxaz wrote:question regarding inheritance - have you seen Irrlicht.NET (discontinued wrapper)? It does not use any of these tricky inheritor classes. It seems rather simple solution.
As i remember Irrlicht.NET simply re-implement all in .NET so inheritance made in natural way. But i believe support of this kind of implementation is even harder than Irrlicht.NETCP. Inheritance and the extensibility in general is a week point of the Irrlicht Lime.

grunt,
I will compile release wrapper and examples and pack to ZIP and upload somewhere and PM you the link, tomorrow at morning.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

oh no no, Irrlicht.NET was also a wrapper. you still needed irrlicht.dll along with irrlicht.NET.dll to use engine in c#
grunt
Posts: 96
Joined: Tue Aug 17, 2004 9:14 pm
Contact:

Post by grunt »

I want to get a list of indices and vertices from a mesh. meshbuffer.indices and meshbuffer.vertices are of type object. What am I supposed to cast these to to make use of them. I tried to cast it to an array of ushort but was getting errors.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

grunt,

You have to cast to proper type of Vertex3Dxxx[], for example:

Code: Select all

Vertex3D[] v = (Vertex3D[])meshBuffer.Vertices; // this is OK only if meshBuffer.VertexType == VertexType.Standard
Same for indices.

Please take a look on my post bolded with "Version 0.7 has been released." at 4th page here, start reading from "MeshBuffer class has been extended...".
grunt
Posts: 96
Joined: Tue Aug 17, 2004 9:14 pm
Contact:

Post by grunt »

How come the array lengths are returning 0 for this?

Code: Select all

For z As Integer = 0 To mesh.MeshBufferCount - 1
			Dim mb As MeshBuffer = mesh.GetMeshBuffer(z)
			
			dim indlist() as ushort = ctype(mb.Indices, ushort())
			Dim vertlist() as vertex3d = ctype(mb.vertices, vertex3d())
			dev.Logger.Log(vertlist.length.ToString)
			'loop through vertlist and convert to jvectors
			'For Each vert As Vertex3D  In vertlist
			'	dev.Logger.Log(vertlist.Length.tostring)
			'	dim vec as New JVector(vert.Position.x, vert.position.y, vert.Position.z)
			'	physverts.Add(vec)
			'Next
			
			'dim trivert as New JOctree.TriangleVertexIndices(indlist(0), indlist(1), indlist(2))
			'physinds.Add(trivert)
		Next
grunt
Posts: 96
Joined: Tue Aug 17, 2004 9:14 pm
Contact:

Post by grunt »

Apparently I was getting the meshbuffer on an animated mesh. Get the mesh of the animated mesh like below and now it returns the correct amount of vertices and indices.

Code: Select all

dim plainmesh as Mesh = mesh.GetMesh(0)
			
			Dim mb As MeshBuffer = plainmesh.GetMeshBuffer(0)
			
			dev.Logger.Log(mb.VertexCount.ToString)
Post Reply