kryton9

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 IIP as IRR_INSTANCE_PTR

dim mesh(4) as dword

dim node(4) as dword

pIIP = VARPTR(IIP)

' 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).

IRR_AddCameraSceneNode(pIIP,0,30,-40,0,5,0)

' while the scene is still running

WHILE IRR_Run(pIIP)

' begin the scene, erasing the canvas to white before rendering

IRR_BeginScene(pIIP, %true, %true, 255, 100, 101, 140)

' draw the Graphical User Interface

IRR_DrawScene(pIIP)

IRR_DrawGUI(pIIP)

' end drawing the scene and render it

IRR_EndScene(pIIP)

WEND

' Stop the irrlicht engine and release resources

IRR_Drop(pIIP)

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 IIP as IRR_INSTANCE_PTR

dim mesh(4) as dword

dim node(4) as dword

pIIP = VARPTR(IIP)

' 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).

IRR_AddCameraSceneNode(pIIP,0,30,-40,0,5,0)

' while the scene is still running

WHILE IRR_Run(pIIP)

' begin the scene, erasing the canvas to white before rendering

IRR_BeginScene(pIIP, %true, %true, 255, 100, 101, 140)

' draw the Graphical User Interface

IRR_DrawScene(pIIP)

IRR_DrawGUI(pIIP)

' end drawing the scene and render it

IRR_EndScene(pIIP)

WEND

' Stop the irrlicht engine and release resources

IRR_Drop(pIIP)