View Full Version : Irrlicht test

05-05-2007, 08:21
Having fun, if you downloaded the other md2 files I had put up and have them all in the same directory as Roberto's model, this script will load all 4.

I tried to guess the command as it would be in thinBasic based on what Roberto did, but either I am wrong about it, or it is not ready yet. I commented those lines out. But they are where I think they should be to position each model in its own spot, at least not all on top of each other as they are now.

This is fun!!

' Example 01: Hello World - The GUI

uses "Irrlicht"

#include "Irrlicht.inc"

DIM pIIP as dword
dim mesh(4) as dword
dim node(4) as dword


' Create the device
IRR_CreateDevice(pIIP, %IRR_EDT_SOFTWARE, 640, 480, 32, %FALSE, %FALSE, %FALSE, 0)

' Set the title of the display
IRR_SetWindowCaption(pIIP, "Hello World! - Irrlicht Engine Demo from ThinBASIC")

' add a static text object to the graphical user interface, at the moment
' this is the only interface object we support. The text will be drawn inside
' the defined rectangle, the box will not have a border and the text will not
' be wrapped around if it runs off the end
IRR_AddStaticText(pIIP, "Hello World! This is the Irrlicht Software engine from ThinBASIC!", 10, 10, 260, 22, %TRUE, %FALSE)

' To display something interesting, we load a Quake 2 model and display it.
'mesh = IRR_GetMesh(pIIP, "C:\irrlicht-1.3\media\sydney.md2")
mesh(1) = IRR_GetMesh(pIIP, "corpse.md2")
node(1) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(1))
mesh(2) = IRR_GetMesh(pIIP, "solo.md2")
node(2) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(2))
mesh(3) = IRR_GetMesh(pIIP, "super.md2")
node(3) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(3))
mesh(4) = IRR_GetMesh(pIIP, "sydney.md2")
node(4) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(4))

' If everything worked, add a texture and disable lighting
If node(1) then
' IRR_SetNodeFrameLoop(node, 0, 310)
IRR_SetNodeMD2Animation(node(1), %IRR_EMAT_STAND)
IRR_SetNodeMaterialTexture(node(1), 0, IRR_GetTexture(pIIP, "corpse.png"))
IRR_SetNodeMaterialFlag(node(1), %IRR_EMF_LIGHTING, %FALSE)
'IRR_SetNodePosition(node(1), -5,-2,0)
end if
If node(2) then
' IRR_SetNodeFrameLoop(node, 0, 310)
IRR_SetNodeMD2Animation(node(2), %IRR_EMAT_STAND)
IRR_SetNodeMaterialTexture(node(2), 0, IRR_GetTexture(pIIP, "solo.bmp"))
IRR_SetNodeMaterialFlag(node(2), %IRR_EMF_LIGHTING, %FALSE)
'IRR_SetNodePosition(node(2), -2,0,0)
end if
If node(3) then
' IRR_SetNodeFrameLoop(node, 0, 310)
IRR_SetNodeMD2Animation(node(3), %IRR_EMAT_STAND)
IRR_SetNodeMaterialTexture(node(3), 0, IRR_GetTexture(pIIP, "super.bmp"))
IRR_SetNodeMaterialFlag(node(3), %IRR_EMF_LIGHTING, %FALSE)
'IRR_SetNodePosition(node(3), 1,2,0)
end if
If node(4) then
' IRR_SetNodeFrameLoop(node, 0, 310)
IRR_SetNodeMD2Animation(node(4), %IRR_EMAT_STAND)
IRR_SetNodeMaterialTexture(node(4), 0, IRR_GetTexture(pIIP, "sydney.bmp"))
IRR_SetNodeMaterialFlag(node(4), %IRR_EMF_LIGHTING, %FALSE)
'IRR_SetNodePosition(node(4), 4,5,0)
end if

'To look at the mesh, we place a camera into 3d space at the position (0, 30, -40).
'The camera looks from there to (0,5,0).

' while the scene is still running
' begin the scene, erasing the canvas to white before rendering
IRR_BeginScene(pIIP, %true, %true, 255, 100, 101, 140)

' draw the Graphical User Interface

' end drawing the scene and render it

' Stop the irrlicht engine and release resources

05-05-2007, 08:25

sorry but I've splitted you post in order not to have a big mammut thread talking on too many different things.
I'm happy you are having fun with this. New functions, examples and documentation will come in next weeks.


05-05-2007, 08:27
Maybe a general purpose MD2 viewer can be easily created :D

05-05-2007, 20:57
THanks for splitting it Eros. I was going to make one last night, but don't know enough of the new commands.

Also IrrEdit is the free level editor, particle maker, lightmapper and model viewer for irrlicht. I will play with it later this week. This way we can work on tools we need and not reinvent the wheel. It has script support to write plugins it seems. I guess can't decide till we play with it.

07-05-2007, 13:16
Hi Kryton9,

I'm not able to find yours md2 files, did you removed them?


Petr Schreiber
07-05-2007, 17:50
Hi Roberto,

I think they were never attached.
But it would be nice to see them in action, kryton - bring'em ! :)


07-05-2007, 17:53
Maybe when I moved this post they were deleted.
Here they are in any case.

08-05-2007, 02:07
This post just showed up today in my new, it is Monday May the 7th. Anyways, it looks like Eros got it covered. Thanks Eros.