Topic: IrrB3D

Hi Gman smile

I getting a look for IrrB3D seem very good smile but can you post an example to use ?
because i can't compile my tests hmm

ib3d_Graphics3D(640,480,32,2)

While Not ib3d_KeyDown(1)
ib3d_RenderWorldBegin()
ib3d_RenderWorld()
ib3d_RenderWorldEnd()
Wend

ib3d_EndGraphics()



The program say : identifier ib3d_Graphics3D not found

Note : I have correctly paste the mod under the good directory.
C:\BlitzMax1.24\mod\irrlicht.mod\b3d.mod

Cheers

Re: IrrB3D

import irrlicht.b3d

wink

Re: IrrB3D

greetings Filax smile  i think the framework statement has changed since you last tried it out.  here is the main test program ive been running of late.  please note it uses some of the media from Irrlicht.

SuperStrict 
Framework Irrlicht.B3D

ib3d_Graphics3D(640,480)
Local cam:CAMERA=ib3d_CreateCamera()
ib3d_PositionEntity(cam,80,30,30)

Local syd:MESH=ib3d_LoadAnimMesh("sydney.md2")
Local tex:TEXTURE=ib3d_LoadTexture("sydney.bmp")
ib3d_EntityTexture(syd,tex)
ib3d_PositionEntity(syd,10,0,30)

Local LIGHT:LIGHT=ib3d_CreateLight()

ib3d_CameraClsColor(0,0,0)
ib3d_EntityDebugDataVisible(syd,True)
ib3d_NameEntity(syd,"SYD")
ib3d_NameEntity(cam,"CAM")

ib3d_EntityRadius(cam,30)
ib3d_EntityOffset(cam,0,10,0)
ib3d_EntityType(cam,1)
ib3d_EntityType(syd,2)
ib3d_EntityType(syd,1)

Local done:Int=False 
Local current:Int=0

Local zoom:Float=1.0
Local controlled:ib3d_Entity=cam
Local projmode:Int=1
Local cnt:Int=0

Local cube:PRIMITIVE=ib3d_CreateCube()
ib3d_PositionEntity(cube,10,80,30)
'ib3d_EntityPickMode(cube,PM_BOX)
ib3d_NameEntity(cube,"CUBE")

cube._node.setID(2)

Local sphere:PRIMITIVE=ib3d_CreateSphere()
ib3d_EntityPickMode(sphere,PM_BOX)
ib3d_PositionEntity(sphere,10,125,30)
ib3d_NameEntity(sphere,"SPHERE")

Local speed:Float=.05

ib3d_PointEntity(cam,sphere)

Local fnt:FONT=ib3d_LoadImageFont("fonthaettenschweiler.bmp",18)
ib3d_SetImageFont(fnt)
ib3d_SetFontColor(255,0,0)

While Not ib3d_KeyDown(EKEY_ESCAPE)

    If ib3d_KeyDown(EKEY_KEY_Z) Then zoom:+0.005
    If ib3d_KeyDown(EKEY_KEY_X) Then zoom:-0.005
    
    If ib3d_KeyDown(EKEY_LEFT) Then ib3d_TurnEntity(controlled,0,-speed,0)
    If ib3d_KeyDown(EKEY_RIGHT) Then ib3d_TurnEntity(controlled,0,speed,0)
    If ib3d_KeyDown(EKEY_UP) Then ib3d_TurnEntity(controlled,speed,0,0)
    If ib3d_KeyDown(EKEY_DOWN) Then ib3d_TurnEntity(controlled,-speed,0,0)
    If ib3d_KeyDown(EKEY_SPACE) Then ib3d_TurnEntity(controlled,0,0,speed)
    If ib3d_KeyDown(EKEY_NUMPAD9) Then ib3d_MoveEntity(controlled,0,speed,0)
    If ib3d_KeyDown(EKEY_NUMPAD3) Then ib3d_MoveEntity(controlled,0,-speed,0)
    If ib3d_KeyDown(EKEY_NUMPAD6) Then ib3d_MoveEntity(controlled,speed,0,0)
    If ib3d_KeyDown(EKEY_NUMPAD4) Then ib3d_MoveEntity(controlled,-speed,0,0)
    If ib3d_KeyDown(EKEY_NUMPAD8) Then ib3d_MoveEntity(controlled,0,0,speed)
    If ib3d_KeyDown(EKEY_NUMPAD2) Then ib3d_MoveEntity(controlled,0,0,-speed)
    If ib3d_KeyDown(EKEY_KEY_U) Then ib3d_TurnEntity(controlled,0,0,-speed)
    If ib3d_KeyDown(EKEY_KEY_Y) Then ib3d_TurnEntity(controlled,0,0,speed)
    
    If ib3d_KeyDown(EKEY_KEY_T) Then ib3d_TrackEntity(cam)
    'If ib3d_KeyHit(EKEY_KEY_V) Then ib3d_PointEntity(cam,syd)
    'If ib3d_KeyDown(EKEY_KEY_V) Then ib3d_PointEntity(syd,cam)
    'If ib3d_KeyDown(EKEY_KEY_V) Then ib3d_PointEntity(syd,cube)
    If ib3d_KeyDown(EKEY_KEY_V) Then ib3d_PointEntity(syd,sphere)

    If ib3d_KeyHit(EKEY_KEY_O) Then
        If projmode=1 Then projmode=2 Else projmode=1
        ib3d_CameraProjMode(cam,projmode)
    EndIf

    Local picked:ib3d_Entity=ib3d_EntityPick(syd)

    If picked Then 
        DebugLog(MilliSecs()+" | "+ib3d_EntityName(picked))
    EndIf

    If ib3d_KeyHit(EKEY_KEY_C) Then 
        If current=0 Then 
            current=1 
            controlled=syd
        Else 
            current=0
            controlled=cam
        EndIf
    EndIf

    ib3d_DrawText("This is my test text",10,10)
    ib3d_DrawLine3df(ib3d_LastPickRay(),255,0,0)
    ib3d_DrawTriangle3df(ib3d_PickedTriangle(),255,0,0)
                
    ib3d_UpdateWorld()
    ib3d_RenderWorld()
    
    cnt:+1    
Wend

ib3d_FreeEntity(syd)
ib3d_EndGraphics()

4 (edited by H&K 2007-03-20 10:47:13)

Re: IrrB3D

I would also like to say that IrrB3d is at base OOP so

Import irrlicht.b3d

Global TheEngine:ib3d_engine = _g_ib3d_engine
TheEngine.Graphics3D(800,600,32)

Global MyCamera:CAMERA = TheEngine.createCamera()
Global MyCube:PRIMITIVE = TheEngine.createCube()
Global MyLight:LIGHT = TheEngine.createLight()
 
MyLight.SetColor(200,200,200)

MyCamera.Position(0,0,15)
MyCube.Position (0,0,0)

MyCamera.TrackEntity(Mycube)

While (Not TheEngine.KeyDown(KEY_SPACE))
     TheEngine.UpdateWorld
     TheEngine.RenderWorld()
     MyCube.Turn(.1,.2,.3)
Wend

End

as an example.

(Thats not to say the B3D wrapper functions are uneeded, but .. well you know what I mean

Re: IrrB3D

Many thanks smile !!

PS : Nice job Gman ! i like it smile

Re: IrrB3D

Hi Gman smile

Can you explain me why the sphere is not colored by my light ?

Import irrlicht.b3d

Global TheEngine:ib3d_engine = _g_ib3d_engine
TheEngine.Graphics3D(800,600,32,2)

ib3d_AmbientLight(0,0,0)

Global MyCamera:CAMERA = TheEngine.createCamera()
Global MyCube:PRIMITIVE = TheEngine.createsphere(20)
Global MyLight:LIGHT = TheEngine.createLight()
 
MyLight.SetColor(30,130,30)
MyLight.Position(-10,10,10)


MyCamera.Position(0,0,2)
ib3d_CameraClsColor(0,0,0)

MyCube.Position (0,0,0)
'ib3d_EntityDiffuseColor(MyCube,10,10,10)
'ib3d_EntityEmissiveColor(MyCube,100,0,0)
ib3d_EntityFX(MyCube,EMF_LIGHTING,1,-1)

Local tex:TEXTURE=ib3d_LoadTexture("./media/awall_color.jpg")
ib3d_EntityTexture(MyCube,tex)

MyCamera.TrackEntity(Mycube)

While (Not TheEngine.KeyDown(KEY_escape))
     TheEngine.UpdateWorld
     TheEngine.RenderWorld()
     MyCube.Turn(.01,.01,.01)
Wend

End

Re: IrrB3D

greetings Filax smile  i believe i have found an issue with the setcolor of light.  until i get a new version out, substitute MyLight.SetColor(30,130,30) with MyLight.setDiffuseColor(30,130,30).

thanks and looking forward to hearing more from you smile

8 (edited by Filax 2007-03-21 10:16:22)

Re: IrrB3D

Hum ok smile didn't work but i cant wait for the fix update smile

Re: IrrB3D

hmm..  what is the expected look?  do you need to maybe add the entitydiffusecolor call back in there?  here is the code im running.  i didnt have your wall texture so i used the wall from Irrlicht.  i uncommented your entitycolor commands.

Framework irrlicht.b3d

Global TheEngine:ib3d_engine = _g_ib3d_engine
TheEngine.Graphics3D(800,600,32,2)

ib3d_AmbientLight(0,0,0)

Global MyCamera:CAMERA = TheEngine.createCamera()
Global MyCube:PRIMITIVE = TheEngine.createsphere(20)
Global MyLight:LIGHT = TheEngine.createLight()
 
'MyLight.SetColor(30,130,30)
MyLight.setDiffuseColor(30,130,30)
MyLight.Position(-10,10,10)
'MyLight.Position(0,0,-50)

MyCamera.Position(0,0,2)
ib3d_CameraClsColor(0,0,0)

MyCube.Position (0,0,0)
ib3d_EntityDiffuseColor(MyCube,10,10,10)
ib3d_EntityEmissiveColor(MyCube,100,0,0)
ib3d_EntityFX(MyCube,EMF_LIGHTING,1,-1)

Local tex:TEXTURE=ib3d_LoadTexture("wall.jpg")
ib3d_EntityTexture(MyCube,tex)

MyCamera.TrackEntity(Mycube)

While (Not TheEngine.KeyDown(KEY_escape))
     TheEngine.UpdateWorld
     TheEngine.RenderWorld()
     MyCube.Turn(.01,.01,.01)
Wend

End

10 (edited by Filax 2007-03-21 17:24:00)

Re: IrrB3D

On my graphics card (NVidia) the last example give me a fullbright textured sphere on a black screen
nothing for lightning. Just fullbright (like enfityFX full bright of blitz)