PDA

View Full Version : Irrlicht module: 2nd unofficial preview



ErosOlmi
07-05-2007, 18:25
Hi all.

2nd unofficial preview Irrlicht module wrapper for thinBasic.

Get attached file and unzip in thinBasic directory maintaining directory structure.
Then go under thinBasic\SampleScripts\Irrlicht\ andexecute thinBasic script samples. If not working let us know.

Attention:

irrlicht.DLL MUST be located into thinBasic.EXE executable folder in order to work. We are thinking how to avoid this but for the moment that is the way


Some thinBasic_Irrlicht module info:

developer: Roberto
module is developed using MS C/C++
thinBasic module wrapper is under development using thinBasic SDK for MS C/C++
irrlicht.DLL is compressed using UPX 3.00w original is about 1.4Mb while the one we distribute is about 510Kb
due to under development status and dll size, we will not deliver this module with official thinBasic release but we will keep a parallel temp project.
Later, when quite stable, we will decide how to go on


Have fun and please let us know if all is working fine on your box.
If not working, please tell us your OS and hardware config.

Ciao
Eros

Michael Hartlef
07-05-2007, 18:54
I think this distribution is incomplete. There is an include file missing

Petr Schreiber
07-05-2007, 19:28
Hi,

same problem here - "ChooseDevice.inc" not found


Bye,
Petr

P.S. I like the image with monster party :D

ErosOlmi
07-05-2007, 20:39
Oops, sorry.
I will update when at home this night.
Try to comment it out. It should not be necessary for the current examples.

Added: file updated. Hope now they will work.

ErosOlmi
07-05-2007, 23:04
Attached files fixed

kryton9
08-05-2007, 01:47
Came home and found another cool example.

Did a slight mod to show that other animations are in there, used different one for each model.

' 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, "media\corpse.md2")
node(1) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(1))
mesh(2) = IRR_GetMesh(pIIP, "media\solo.md2")
node(2) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(2))
mesh(3) = IRR_GetMesh(pIIP, "media\super.md2")
node(3) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(3))
mesh(4) = IRR_GetMesh(pIIP, "media\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_DEATH_FALLBACK)
IRR_SetNodeMaterialTexture(node(1), 0, IRR_GetTexture(pIIP, "media\corpse.png"))
IRR_SetNodeMaterialFlag(node(1), %IRR_EMF_LIGHTING, %FALSE)
IRR_SetNodePosition(node(1), -40,-2,20)
end if
If node(2) then
' IRR_SetNodeFrameLoop(node, 0, 310)
IRR_SetNodeMD2Animation(node(2), %IRR_EMAT_WAVE)
IRR_SetNodeMaterialTexture(node(2), 0, IRR_GetTexture(pIIP, "media\solo.bmp"))
IRR_SetNodeMaterialFlag(node(2), %IRR_EMF_LIGHTING, %FALSE)
IRR_SetNodePosition(node(2), -20,0,0)
end if
If node(3) then
' IRR_SetNodeFrameLoop(node, 0, 310)
IRR_SetNodeMD2Animation(node(3), %IRR_EMAT_JUMP)
IRR_SetNodeMaterialTexture(node(3), 0, IRR_GetTexture(pIIP, "media\super.bmp"))
IRR_SetNodeMaterialFlag(node(3), %IRR_EMF_LIGHTING, %FALSE)
IRR_SetNodePosition(node(3), 20,2,0)
end if
If node(4) then
' IRR_SetNodeFrameLoop(node, 0, 310)
IRR_SetNodeMD2Animation(node(4), %IRR_EMAT_RUN)
IRR_SetNodeMaterialTexture(node(4), 0, IRR_GetTexture(pIIP, "media\sydney.bmp"))
IRR_SetNodeMaterialFlag(node(4), %IRR_EMF_LIGHTING, %FALSE)
IRR_SetNodePosition(node(4), 50,0,0)
'IRR_SetNodeRotation(node(4), 0,0.75,0)
end if

'To look at the mesh, we place a camera into 3d space at the position (0, 30, -50).
'The camera looks from there to (0,5,0).
IRR_AddCameraSceneNode(pIIP,0,30,-80,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)

Michael Hartlef
08-05-2007, 07:15
Thanks Kent.

kryton9
08-05-2007, 07:29
Roberto is making irrlicht as easy to use as Petr did openGl and you did with tbdi. Fun to tinker with all yours guys great work!!

I tried to make an md2 file, just a simple animated cube in blender, it export to md2 format ok, but I couldn't do anything with it or see it. So I must have done something wrong. Let me know if you make an md2 model in blender and figure out how to see it with irrlicht module. I will tinker with it more too as I never made md2's before.

RobertoBianchi
08-05-2007, 08:48
making irrlicht as easy to use
Well, this is exactly the ThinBASIC's great ambition, make things easy to do, in particular make the programming quick and easy.
Thanks for your post Kryton9.

Ciao,
Roberto

kryton9
08-05-2007, 09:05
THANKS for what you are doing Roberto, really impressive how this is coming along and in such a very nice way, thanks again!!

Petr Schreiber
08-05-2007, 10:28
Hi,

new download works ok ;)
Really nice!

kryton, I have checked Google for Blender and MD2 but no success. There is lot of bugreports/troubles. Some say to export to 3DS and then convert to MD2... don't know.

Here (http://tfc.duke.free.fr/old/models/md2.htm) is nice description of MD2 file format. I have found some editor (http://www.misfitcode.com/misfitmodel3d/main.html) to do MD2 files too, but it is XPs only ( I have purchased XPs but still not installed them :) ).


Bye,
Petr

kryton9
08-05-2007, 10:31
THanks Petr for the links, I will study when feel like that kind of stuff. Blender does export to it, so it will be nice to use it to make test models.