MiniB3d for FreeBasic

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
angros47
Posts: 1225
Joined: Jun 21, 2005 19:04

MiniB3d for FreeBasic

Postby angros47 » Apr 18, 2010 8:05

This is MiniB3D for FreeBasic:

http://sourceforge.net/projects/minib3d/

Windows and Linux version.

Previous version is:

http://www.file-pasta.com/file/0/miniB3D%200.2%20for%20FB.zip
(Windows)

http://www.file-pasta.com/file/0/MiniB3d%200.2%20linux.tar.gz
(Linux)

(first version at http://www.file-pasta.com/file/0/minib3 ... ebasic.zip)

I took iMiniB3D (that was written in C++ and ObjC), ported it to C++, compiled to a DLL with MingW, and made a simple .bi file.

I've made some changes from original miniB3D:

-this version uses quaternions internally (thanks to warner): so, no more gimbal lock.
-this version uses stb_image.c to load textures: no more OS-specific depandancies.

It supports also terrains, and 3ds files.
Last edited by angros47 on Oct 16, 2010 18:05, edited 3 times in total.
D.J.Peters
Posts: 6988
Joined: May 28, 2005 3:28
Location: Germany

Postby D.J.Peters » Apr 18, 2010 8:52

nice looks simple

Joshy
duke4e
Posts: 717
Joined: Dec 04, 2005 0:16
Location: Varazdin, Croatia, Europe
Contact:

Postby duke4e » Apr 18, 2010 13:12

Awesome work and simple to use!

Here's an updated example:
(note that this is my first contact with minib3d)

Code: Select all

#include "minib3d.bi"
#include "fbgfx.bi"
Using FB

Const xres = 1024
Const yres = 768
Screenres  xres, yres, 32,, GFX_OPENGL
Graphics3d xres, yres, 32, 1, 1


Var camera=createcamera(0)
CameraViewport(camera,0,0,xres,yres)
Var bird=LoadAnimMesh ("bird.b3d",0)
moveentity bird,0,0,15

animate bird,1,.1,0,0

AmbientLight(0, 255, 255)
Do
    EntityAlpha bird, Abs(Cos(Timer))
   
    If Multikey(SC_W) Then turnentity bird, -1,  0,  0, 0
    If Multikey(SC_S) Then turnentity bird,  1,  0,  0, 0
    If Multikey(SC_A) Then turnentity bird,  0, -1,  0, 0
    If Multikey(SC_D) Then turnentity bird,  0,  1,  0, 0
    If Multikey(SC_Q) Then turnentity bird,  0,  0, -1, 0
    If Multikey(SC_E) Then turnentity bird,  0,  0,  1, 0
   
    If Multikey(SC_RIGHT) Then TranslateEntity bird,  1,  0, 0, 0
    If Multikey(SC_LEFT)  Then TranslateEntity bird, -1,  0, 0, 0
    If Multikey(SC_DOWN)  Then TranslateEntity bird,  0, -1, 0, 0
    If Multikey(SC_UP)    Then TranslateEntity bird,  0,  1, 0, 0
   updateworld 1
   renderworld
   
   Flip
Loop Until Multikey(SC_ESCAPE)
joseywales72
Posts: 206
Joined: Aug 27, 2005 2:02
Location: Istanbul, Turkey

Postby joseywales72 » Apr 19, 2010 8:15

Very very nice and easy. Thank you.

I tried the executables on Linux with Wine, and they both work flawlessly.
I also tried to compile the source, but no use. It gives;

Code: Select all

surface.cpp:10:21: error: gl\GLee.h: No such file or directory

and stops.
I try a simple make command though. I'll try it with headers from Mingw later.

Great job again.
Anil
Last edited by joseywales72 on Apr 20, 2010 9:48, edited 1 time in total.
Prime Productions
Posts: 147
Joined: May 24, 2009 23:13
Location: Texas, United States, Planet Earth
Contact:

Postby Prime Productions » Apr 19, 2010 16:42

Great job. I've been waiting for this. Now FB has Blitz 3D capabilites and more.

David
super_castle
Posts: 288
Joined: Oct 10, 2006 7:19

Postby super_castle » Apr 19, 2010 19:58

I have sometimes tested with SDL and a Screen of FB-Basic with ScreenRes 200,200,32.
On the ScreenRes is with PSet (numberx,numbery), RGB (255,0,0).

Wonderful, 2 Screens with Opengl and Minib3d.


Code: Select all

 #Include "minib3d.bi"
   #Include "SDL/SDL.bi"
   #Include "fbgfx.bi"
   #Include "windows.bi"
   #Include "crt.bi"
   USING FB

   Const SCR_WIDTH = 500
   Const SCR_HEIGHT = 500
   Const BPP = 16

   Dim vpage as SDL_Surface Ptr
   Dim event as SDL_Event
   Dim As Integer result,camera,bird,zahlx,zahly
 
   result = SDL_Init(SDL_INIT_EVERYTHING)
   if result <> 0 then
        end 1
   end If
   
   ScreenRes 200,200,32
   ScreenControl SET_WINDOW_POS, 10,10
   
   vpage = SDL_SetVideoMode(SCR_WIDTH, SCR_HEIGHT, BPP, SDL_OPENGL or SDL_OPENGLBLIT)
   if vpage = 0 Then
      SDL_Quit
      end 1
   end If
   SDL_WM_SetCaption "test", ""

   Graphics3d SCR_WIDTH, SCR_HEIGHT,32,1,1

   camera=createcamera(0)
   CameraViewport(camera,0,0,500,500)
   bird=LoadAnimMesh ("bird.b3d",0)
   moveentity bird,0,0,15

   animate bird,1,.1,0,0

Do   
   Sleep 5
   
   If multikey( FB.SC_q ) Then   
       turnentity bird,1,0,0,0
   End If 
   If multikey( FB.SC_w ) Then   
       turnentity bird,-1,0,0,0
   End If
   If multikey( FB.SC_e ) Then   
       turnentity bird,0,-1,0,0
   End If
   If multikey( FB.SC_s ) Then   
       turnentity bird,0,1,0,0
   End If
   
   zahlx=INT(RND * 199) + 1
   zahly=INT(RND * 199) + 1
   PSet(zahlx,zahly),RGB(255,0,0)
   
   updateworld 1
   renderworld
   SDL_GL_SwapBuffers

   SDL_PumpEvents
loop until( (SDL_PollEvent( @event ) <> 0) and (event.type = SDL_MOUSEBUTTONDOWN))


super_castle
Posts: 288
Joined: Oct 10, 2006 7:19

Postby super_castle » Apr 20, 2010 9:36

Extended version of MiniB3D for Freebasic !!!???

With Terrain.....!!!???

Gruss
angros47
Posts: 1225
Joined: Jun 21, 2005 19:04

Postby angros47 » Apr 20, 2010 11:44

The current version doesn't support terrains; the next version will (I already have the BlitzMax source, but I need to translate it in C++)
super_castle
Posts: 288
Joined: Oct 10, 2006 7:19

Postby super_castle » Apr 20, 2010 12:07

hello, thanks you for the help.

Gruss
super_castle
Posts: 288
Joined: Oct 10, 2006 7:19

Postby super_castle » Apr 22, 2010 15:42

you can read "x" or "3ds" mesh with minib3d ?

gruss
angros47
Posts: 1225
Joined: Jun 21, 2005 19:04

Postby angros47 » Apr 22, 2010 17:41

Not yet, sorry.

There is a modded version of MiniB3d (only for BlitzMax) that supports terrains, quaternions, and 3DS: http://www.hi-toro.com/blitz/sidesign.zip

I'm porting it in C++: I've already ported quaternions, and now I'm working on terrains; after that, I'll give a look at 3ds loader.

Of course, if someone wants to help, I'll appreciate it.
angros47
Posts: 1225
Joined: Jun 21, 2005 19:04

Postby angros47 » May 01, 2010 10:37

I'm getting closer to have working terrains; in C++, they works!
super_castle
Posts: 288
Joined: Oct 10, 2006 7:19

Postby super_castle » May 04, 2010 16:36

that's wonderful.

gruss
angros47
Posts: 1225
Joined: Jun 21, 2005 19:04

Postby angros47 » Jun 02, 2010 15:12

Finally, a new version!

This one supports LOD terrains. You can use an heightmap, or manually draw/modify the terrain with ModifyTerrain.

Demo included.

Download it at:
http://www.file-pasta.com/file/0/Minib3d%200.1%20for%20FB.zip
super_castle
Posts: 288
Joined: Oct 10, 2006 7:19

Postby super_castle » Jun 02, 2010 21:08

he, thanks for the new version !

gruss
peter

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 0 guests