PDA

View Full Version : Irrlicht Development



kryton9
08-05-2007, 02:05
I couldn't reply to Roberto's last post as the thread was locked. Here is his quote:

Hi Kryton9,

in order to handle multi device but in the same time keep easy the module use and speed up the calls I choose to create a structure that holds device, video driver, scene manager, GUI environment and event receiver and pass a pointer it during module API calls.
The side effect is that for each device you can have only one video driver, scene manager, GUI environment and event receiver, but actually this seems not be a limitation.
Please let me know what you think.

Regards,
Roberto

Roberto, I think the structure is a really clever idea and it does really simplify the code from the hello world example I studied. That was a brilliant idea you came up with for sure. About it being a limit in the future or not, I have no idea. Right now I can't see it being one, but with multi-core cpu's and sli type video systems, if this will be a problem in the future? You would know more about it. Does the OS see those cpu's and video cards as one?

Anyways, thanks for this work. It looks monumental, but I think a very good engine you picked to bring into the thinBasic world!!!

kryton9
08-07-2007, 10:59
Roberto, I was studying Irrlicht example 14 in the irrlicht examples folder. I think it holds the key to allowing us to use irrlicht and tbgl together.

We can just set device to render in opengl. I was going to tinker with it, but I figured why waste time and just ask.

He uses:

HWND hIrrlichtWindow = CreateWindow("BUTTON", "", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
50, 80, 400, 400, hWnd, NULL, hInstance, NULL);

This opens the opengl device there. I also changed Button to Static as there is a static control too in there, it worked the same.

But if you and Petr can get his hWnd = TBGL_CreateWindowEx ( Caption, XRes, YRes, BitDepth, FullscreenFlag ) to send to the handle of the irrlicht child window on a form, or to full screen irrlicht window, then we could use tbgl with irrlicht.

Irrlicht has so much built in, it from a wide variety of file format support to all the tools available and examples. Tie that in with tbgl and we have it all.

I was trying to figure it out with your thinBasic Irrlicht Hello World and his example 14, but I think it should be doable and probably not hard for you.

Thanks pretty exciting stuff I think :)

kryton9
08-07-2007, 11:37
I got this far. The irrlicht window command I don't think is available yet as I tried it. This is not what we want, but the reverse.

I can run irrlicht in a tbgl window sort of. It takes a second to load, but you see the black just blank tbgl window and then the irrlicht device draws on it.


' Example 01: Hello World - The GUI

uses "Irrlicht"
uses "tbgl"
#include "Irrlicht.inc"

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

pIIP = tbgl_createwindowex ( "", 1024, 768, 32, 1 )
tbgl_showcursor 1

' Create the device
IRR_CreateDevice(pIIP, %IRR_EDT_OPENGL, 200, 200, 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(%IRR_IAnimatedMesh, pIIP, ".\media\corpse.md2")
node(1) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(1))
mesh(2) = IRR_GetMesh(%IRR_IAnimatedMesh, pIIP, ".\media\solo.md2")
node(2) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(2))
mesh(3) = IRR_GetMesh(%IRR_IAnimatedMesh, pIIP, ".\media\super.md2")
node(3) = IRR_AddAnimatedMeshSceneNode(pIIP, mesh(3))
mesh(4) = IRR_GetMesh(%IRR_IAnimatedMesh, 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_STAND)
IRR_SetNodeMaterialTexture(node(1), 0, IRR_GetTexture(pIIP, ".\media\corpse.png"))
IRR_SetNodeMaterialFlag(node(1), %IRR_EMF_LIGHTING, %FALSE)
IRR_SetNodePosition(node(1), -50,-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, ".\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_STAND)
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_STAND)
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)
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,0,-10,0,0,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)

Petr Schreiber
08-07-2007, 14:56
What a diiirty hacks ! :D

kryton, I am not sure if it does the same on my PC, I can see black background ( my TBGL ) and little one over it ( Irrlicht ).

Few thoughts - I do TBGL for shorter time than Irrlicht exists, but I am sure Irrlicht team does lot of internal, very specific optimizations as well as I do. So trying to graft this two systems in one could have seriously unpleasant side effect, especially speed and stability wise.

Now for example the script ( after few runs ! ) produces GPF immediately.

I am also not sure if IIP is the same as TBGL window handle. It might be, it might be handle of device and it might be something else.

So I would be careful about it

But thanks for your experiment !

Bye,
Petr

kryton9
08-07-2007, 22:56
That example was just a test and not going in the direction it should but the opposite.

The goal would be to have irrlicht give you the handle of where to draw, whatever this way your tbgl commands can send to the correct handle.

Then the clearscreen and drawscreen could be handled by irrlicht or not use the irrlicht ones and use tbgl's the ideal would be to make them interchangeable as you do with opengl commands.

But if there is more to it than that and it won't work, that is another story.

That GPF is nothing compared to the ones I got with my other tests :) I tried to use the irrlicht createwindow as in example 14 instead of create device. I tried to guess how Roberto might have created the wrapper but I was wrong or as I think it is not there yet.

One thing that amazed me is. I tried to get an idea of what commands are in thinBasic Irrlicht, so i downloaded this great program named dependency walker. It goes in dll's and gives you the names of the functions and lots of other info. The way Roberto did the dll it is protected. I never saw that before. So he is doing some cool things.
He has a lot of knowledge and I am sure he can come up with something if it is at all possible.

Can you imagine the power of 2 engines in thinBasic, tbgl and irrlicht.

ErosOlmi
08-07-2007, 23:12
Ken,

the way we develop thinBasic commands is all internal to thinBasic and called module. The trick is done in "LoadLocalSymbols" exported function. In that function Core module and called modules exchange each other the names of the new keywords and the procedure address to link to. In thinBasic SDK fo C it is called "_LoadLocalSymbols". So you will never see thinBasic keywords using Dependancy Walker.

Just to give you an idea of already developed irrlicht keywords and equates, here it is the C code (just as reference):



/*----------------------------------------------------------------------------
FUNCTION LoadLocalSymbolsC()
This function is automatically called by thinCore whenever this DLL is loaded.
This function MUST be present in every external DLL you want to use
with thinBasic
Use this function to initialize every variable you need and for loading the
new symbol (read Keyword) you have created.
----------------------------------------------------------------------------*/
DWORD __declspec(dllexport) __cdecl _LoadLocalSymbols(char * AppPath)
{

//////////////////////////////////////////////////////////////////////
// Function SYSTEM
thinBasic_LoadSymbol("Irr_CreateDevice", thinBasic_ReturnNumber, &Exec_Irr_CreateDevice, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_Run", thinBasic_ReturnNumber, &Exec_Irr_Run, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_DrawScene", thinBasic_ReturnNone, &Exec_Irr_DrawScene, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_DrawGUI", thinBasic_ReturnNone, &Exec_Irr_DrawGUI, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_EndScene", thinBasic_ReturnNone, &Exec_Irr_EndScene, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_Drop", thinBasic_ReturnNone, &Exec_Irr_Drop, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_GetFPS", thinBasic_ReturnNumber, &Exec_Irr_GetFPS, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_GetPrimitiveCountDrawn", thinBasic_ReturnNumber, &Exec_Irr_GetPrimitiveCountDrawn, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_SetWindowCaption", thinBasic_ReturnNone, &Exec_Irr_SetWindowCaption, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_BeginScene", thinBasic_ReturnNone, &Exec_Irr_BeginScene, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_IsWindowActive", thinBasic_ReturnNumber, &Exec_Irr_IsWindowActive, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_CloseDevice", thinBasic_ReturnNone, &Exec_Irr_CloseDevice, thinBasic_ForceOverWrite);
// Function SCENE
thinBasic_LoadSymbol("Irr_GetMesh", thinBasic_ReturnNumber, &Exec_Irr_GetMesh, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_CreateMesh", thinBasic_ReturnNumber, &Exec_Irr_CreateMesh, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_RemoveMesh", thinBasic_ReturnNone, &Exec_Irr_RemoveMesh, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_GetMeshIndexCount", thinBasic_ReturnNumber, &Exec_Irr_GetMeshIndexCount, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_GetMeshIndices", thinBasic_ReturnNone, &Exec_Irr_GetMeshIndices, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_SetMeshIndices", thinBasic_ReturnNone, &Exec_Irr_SetMeshIndices, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_GetMeshVertexCount", thinBasic_ReturnNumber, &Exec_Irr_GetMeshVertexCount, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_GetMeshVertices", thinBasic_ReturnNumber, &Exec_Irr_GetMeshVertices, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_AddAnimatedMeshSceneNode",thinBasic_ReturnNumber, &Exec_Irr_AddAnimatedMeshSceneNode,thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_AddOctTreeSceneNode", thinBasic_ReturnNumber, &Exec_Irr_AddOctTreeSceneNode, thinBasic_ForceOverWrite);

// Function GUI
thinBasic_LoadSymbol("Irr_AddStaticText", thinBasic_ReturnNone, &Exec_Irr_AddStaticText, thinBasic_ForceOverWrite);

// Function NODE
thinBasic_LoadSymbol("Irr_SetNodeMaterialTexture", thinBasic_ReturnNone, &Exec_Irr_SetNodeMaterialTexture, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_SetNodeMaterialFlag", thinBasic_ReturnNone, &Exec_Irr_SetNodeMaterialFlag, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_SetNodePosition", thinBasic_ReturnNone, &Exec_Irr_SetNodePosition, thinBasic_ForceOverWrite);

// Function 2D
thinBasic_LoadSymbol("Irr_GetTexture", thinBasic_ReturnNumber, &Exec_Irr_GetTexture, thinBasic_ForceOverWrite);

// Function ANIMATION
thinBasic_LoadSymbol("Irr_SetNodeFrameLoop", thinBasic_ReturnNone, &Exec_Irr_SetNodeFrameLoop, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_SetNodeMD2Animation", thinBasic_ReturnNone, &Exec_Irr_SetNodeMD2Animation, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_CreateRotationAnimator", thinBasic_ReturnNumber, &Exec_Irr_CreateRotationAnimator, thinBasic_ForceOverWrite);

// Function CAMERA
thinBasic_LoadSymbol("Irr_AddCameraSceneNodeFPS", thinBasic_ReturnNumber, &Exec_Irr_AddCameraSceneNodeFPS, thinBasic_ForceOverWrite);
thinBasic_LoadSymbol("Irr_AddCameraSceneNode", thinBasic_ReturnNumber, &Exec_Irr_AddCameraSceneNode, thinBasic_ForceOverWrite);

// Function FILLING
thinBasic_LoadSymbol("Irr_AddZipFileArchive", thinBasic_ReturnNone, &Exec_Irr_AddZipFileArchive, thinBasic_ForceOverWrite);

// Function KEYBOARD & MOUSE
thinBasic_LoadSymbol("Irr_SetMouseVisible", thinBasic_ReturnNone, &Exec_Irr_SetMouseVisible, thinBasic_ForceOverWrite);

// Function VIDEO
thinBasic_LoadSymbol("Irr_GetWindowHandle", thinBasic_ReturnNumber, &Exec_Irr_GetWindowHandle, thinBasic_ForceOverWrite);


//////////////////////////////////////////////////////////////////////
// Equates DRIVER TYPE
thinBasic_AddEquate("%IRR_EDT_NULL", "", EDT_NULL, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EDT_SOFTWARE", "", EDT_SOFTWARE, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EDT_BURNINGSVIDEO", "", EDT_BURNINGSVIDEO, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EDT_DIRECT3D8", "", EDT_DIRECT3D8, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EDT_DIRECT3D9", "", EDT_DIRECT3D9, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EDT_OPENGL", "", EDT_OPENGL, thinBasic_ConstTypeAuto);
// Equates MATERIAL TYPE
thinBasic_AddEquate("%IRR_EMT_SOLID", "", EMT_SOLID, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_SOLID_2_LAYER", "", EMT_SOLID_2_LAYER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_LIGHTMAP", "", EMT_LIGHTMAP, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_LIGHTMAP_ADD", "", EMT_LIGHTMAP_ADD, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_LIGHTMAP_M2", "", EMT_LIGHTMAP_M2, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_LIGHTMAP_M4", "", EMT_LIGHTMAP_M4, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_LIGHTMAP_LIGHTING", "", EMT_LIGHTMAP_LIGHTING, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_LIGHTMAP_LIGHTING_M2", "", EMT_LIGHTMAP_LIGHTING_M2, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_LIGHTMAP_LIGHTING_M4", "", EMT_LIGHTMAP_LIGHTING_M4, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_DETAIL_MAP", "", EMT_DETAIL_MAP, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_SPHERE_MAP", "", EMT_SPHERE_MAP, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_REFLECTION_2_LAYER", "", EMT_REFLECTION_2_LAYER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_TRANSPARENT_ADD_COLOR", "", EMT_TRANSPARENT_ADD_COLOR, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_TRANSPARENT_ALPHA_CHANNEL", "", EMT_TRANSPARENT_ALPHA_CHANNEL, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_TRANSPARENT_ALPHA_CHANNEL_REF", "", EMT_TRANSPARENT_ALPHA_CHANNEL_REF, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_TRANSPARENT_VERTEX_ALPHA", "", EMT_TRANSPARENT_VERTEX_ALPHA, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_TRANSPARENT_REFLECTION_2_LAYER", "", EMT_TRANSPARENT_REFLECTION_2_LAYER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_NORMAL_MAP_SOLID", "", EMT_NORMAL_MAP_SOLID, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR", "", EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA", "", EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_PARALLAX_MAP_SOLID", "", EMT_PARALLAX_MAP_SOLID, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR", "", EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA", "", EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_ONETEXTURE_BLEND", "", EMT_ONETEXTURE_BLEND, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMT_FORCE_32BIT", "", EMT_FORCE_32BIT, thinBasic_ConstTypeAuto);
// Equates MATERIAL FLAGS
thinBasic_AddEquate("%IRR_EMF_WIREFRAME", "", EMF_WIREFRAME, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_POINTCLOUD", "", EMF_POINTCLOUD, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_GOURAUD_SHADING", "", EMF_GOURAUD_SHADING, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_LIGHTING", "", EMF_LIGHTING, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_ZBUFFER", "", EMF_ZBUFFER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_ZWRITE_ENABLE", "", EMF_ZWRITE_ENABLE, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_BACK_FACE_CULLING", "", EMF_BACK_FACE_CULLING, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_BILINEAR_FILTER", "", EMF_BILINEAR_FILTER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_TRILINEAR_FILTER", "", EMF_TRILINEAR_FILTER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_ANISOTROPIC_FILTER", "", EMF_ANISOTROPIC_FILTER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_FOG_ENABLE", "", EMF_FOG_ENABLE, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_NORMALIZE_NORMALS", "", EMF_NORMALIZE_NORMALS, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_TEXTURE_WRAP", "", EMF_TEXTURE_WRAP, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMF_MATERIAL_FLAG_COUNT", "", EMF_MATERIAL_FLAG_COUNT, thinBasic_ConstTypeAuto);
// Equates ANIMATION TYPE
thinBasic_AddEquate("%IRR_EMAT_STAND", "", EMAT_STAND, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_RUN", "", EMAT_RUN, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_ATTACK", "", EMAT_ATTACK, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_PAIN_A", "", EMAT_PAIN_A, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_PAIN_B", "", EMAT_PAIN_B, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_PAIN_C", "", EMAT_PAIN_C, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_JUMP", "", EMAT_JUMP, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_FLIP", "", EMAT_FLIP, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_SALUTE", "", EMAT_SALUTE, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_FALLBACK", "", EMAT_FALLBACK, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_WAVE", "", EMAT_WAVE, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_POINT", "", EMAT_POINT, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_CROUCH_STAND", "", EMAT_CROUCH_STAND, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_CROUCH_WALK", "", EMAT_CROUCH_WALK, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_CROUCH_ATTACK", "", EMAT_CROUCH_ATTACK, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_CROUCH_PAIN", "", EMAT_CROUCH_PAIN, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_CROUCH_DEATH", "", EMAT_CROUCH_DEATH, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_DEATH_FALLBACK", "", EMAT_DEATH_FALLBACK, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_DEATH_FALLFORWARD", "", EMAT_DEATH_FALLFORWARD, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_DEATH_FALLBACKSLOW", "", EMAT_DEATH_FALLBACKSLOW, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_EMAT_BOOM", "", EMAT_BOOM, thinBasic_ConstTypeAuto);
// Equates OTHERS
thinBasic_AddEquate("%IRR_WINDOWED", "", IRR_WINDOWED, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_SHADOWS", "", IRR_SHADOWS, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_IGNORE_EVENTS", "", IRR_IGNORE_EVENTS, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_GUI_BORDER", "", IRR_GUI_BORDER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_GUI_WRAP", "", IRR_GUI_WRAP, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_GUI_NO_BORDER", "", IRR_GUI_NO_BORDER, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_GUI_NO_WRAP", "", IRR_GUI_NO_WRAP, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_IMesh", "", IRR_IMesh, thinBasic_ConstTypeAuto);
thinBasic_AddEquate("%IRR_IAnimatedMesh", "", IRR_IAnimatedMesh, thinBasic_ConstTypeAuto);

return 1;

}

kryton9
09-07-2007, 04:30
Thanks Eros for the code, the command Petr could possibly use to assign where to put his tbgl output would be:
Irr_GetWindowHandle

Then maybe with a new command he could give us tbgl_UseDisplayHandle or maybe even better for multiple displays in the future or screens:
tbgl_SetScreenHandle = Irr_GetWindowHandle

then all of our tbgl commands would output to that screen.

I guess Roberto and Petr have to go back and forth on it. Or do the reverse, that is Petr gives a handle to his opengl screen and then irrlicht uses that.

kryton9
22-07-2007, 08:23
I was studying lots of things tonight and they all sort of tie into each other. Anyways, by asking this question, I am not in anyway questioning how things are done, just trying to better understand how it all works.

Roberto, in looking at the code we have so far, it seems that you figured a way around, perhaps simplified, or even gotten rid of the need for the irrlicht scene manager. Can you discuss your thinking process as I would like to understand how you are doing such a complicated job so well. Seeing how you looked at something as big and complicated as Irrlicht and figured away around all the OOP and make is so easily accessible via thinBasic is just boggling my mind.

RobertoBianchi
23-07-2007, 09:07
Kryton9,

the Irrlicht module's first design goal is keep things simple, otherwise why use a BASIC like language with Irrlicht?
Thus the Object Oriented nature of Irrlicht should stay (at least let me say) hidden, here is why I create a IRR_INSTANCE structure for collet Irrlichts' instance object pointers.
The difficulties come with the Irrlicht's event receiver forasmuch as until now ThinBASIC isn't able to create true callback function.
In any case there is still much to do and I'm quite sure that an Event Receiver work around could be found.

Ciao,
Roberto

kryton9
23-07-2007, 21:11
Thanks Roberto, I think you are really meeting your objectives in making it simple as can be with this approach!