Artemka
12-03-2013, 20:59
Hello everybody!
Here is my wrapper of OpenB3D for thinBasic. OpenB3D is based on MiniB3D and use OpenGL for graphics rendering.
Some Features:
Repeats almost all features Blitz3D;
Allows you to load *.b3d files (with animations) and *.3ds (only static) 3D model formats;
Allows you to load *.bmp, *.jpg, *.png, *.tga texture formats;
How to use:
Extract openb3d.dll and openb3d.tbasici in your project folder;
In your main source place the line #INCLUDE "%APP_SOURCEPATH%\openb3d.tbasici";
Sample using TBGL + Openb3D:
Uses "TBGL"
#INCLUDE "%APP_SOURCEPATH%\openb3d.tbasici"
%NO_PARENT = 0 As Byte
Function TBMain()
Local hWnd As DWord
Local CAM, LIGHT, MESH As DWord
' -- Create and show window
hWnd = TBGL_CreateWindowEx("OpenB3D 0.6 - press ESC to quit", 1280, 720, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
Graphics3D(1280, 720, 32, 2, 60)
CAM = CreateCamera(%NO_PARENT)
LIGHT = CreateLight(1, %NO_PARENT)
MESH = CreateCube(%NO_PARENT)
PositionEntity(CAM, 0.0, 0.0, -25.0, %FALSE)
PositionEntity(LIGHT, 0.0, 5.0, 0.0, %FALSE)
' -- Resets status of all keys
TBGL_ResetKeyState()
' -- Main loop
While TBGL_IsWindow(hWnd)
TBGL_ClearFrame
TurnEntity(MESH, 0.3, 0.1, 0.15, %FALSE)
RenderWorld()
TBGL_DrawFrame
' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While
Wend
' -- Clear OpenB3D res
ClearWorld(%TRUE, %TRUE, %TRUE)
TBGL_DestroyWindow
End Function
8154
Here is Keywords list for syntax highlighting in thinAir IDE.
For syntax highlighting replace thinBasic_Keywords_Usr.ini in C:\thinBasic\thinAir\Syntax\thinBasic path with attached thinBasic_Keywords_Usr.ini.
8155
Here is my wrapper of OpenB3D for thinBasic. OpenB3D is based on MiniB3D and use OpenGL for graphics rendering.
Some Features:
Repeats almost all features Blitz3D;
Allows you to load *.b3d files (with animations) and *.3ds (only static) 3D model formats;
Allows you to load *.bmp, *.jpg, *.png, *.tga texture formats;
How to use:
Extract openb3d.dll and openb3d.tbasici in your project folder;
In your main source place the line #INCLUDE "%APP_SOURCEPATH%\openb3d.tbasici";
Sample using TBGL + Openb3D:
Uses "TBGL"
#INCLUDE "%APP_SOURCEPATH%\openb3d.tbasici"
%NO_PARENT = 0 As Byte
Function TBMain()
Local hWnd As DWord
Local CAM, LIGHT, MESH As DWord
' -- Create and show window
hWnd = TBGL_CreateWindowEx("OpenB3D 0.6 - press ESC to quit", 1280, 720, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
Graphics3D(1280, 720, 32, 2, 60)
CAM = CreateCamera(%NO_PARENT)
LIGHT = CreateLight(1, %NO_PARENT)
MESH = CreateCube(%NO_PARENT)
PositionEntity(CAM, 0.0, 0.0, -25.0, %FALSE)
PositionEntity(LIGHT, 0.0, 5.0, 0.0, %FALSE)
' -- Resets status of all keys
TBGL_ResetKeyState()
' -- Main loop
While TBGL_IsWindow(hWnd)
TBGL_ClearFrame
TurnEntity(MESH, 0.3, 0.1, 0.15, %FALSE)
RenderWorld()
TBGL_DrawFrame
' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While
Wend
' -- Clear OpenB3D res
ClearWorld(%TRUE, %TRUE, %TRUE)
TBGL_DestroyWindow
End Function
8154
Here is Keywords list for syntax highlighting in thinAir IDE.
For syntax highlighting replace thinBasic_Keywords_Usr.ini in C:\thinBasic\thinAir\Syntax\thinBasic path with attached thinBasic_Keywords_Usr.ini.
8155