IrrlichtWrapper 1.05 (still) beta

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

btw. you speaking german ?
No.

Heh, one more question: How can I set node transparency (like EntityAlpha in B3D) ?
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

Bug Report ?
Using this code:

Code: Select all

XIncludeFile "C:\Program Files\PureBasic\Examples\IrrlichtWrapper\PureBasic\IrrlichtWrapper.pbi"

Global *Camera.irr_camera, *RotPoint.irr_node
Define *Cube.irr_node, Dist = -30
Define *KeyEvent.IRR_KEY_EVENT
Define *Texture.irr_texture
Dim *Cones.irr_node(3)

InitIrrlichtWrapperDll()
OpenWindow(0, 0, 0, 800, 600, "--My Test--",  #PB_Window_ScreenCentered)
IrrStartex(#IRR_EDT_DIRECT3D9, 800, 600, #False, #True, #True, 32, #True, #True, #True, WindowID(0))

Procedure SetCamera(Dist.F)
Define X.F, Y.F, Z.F
IrrGetNodePosition(*RotPoint, @X, @Y, @Z)
IrrSetNodePosition(*Camera, X, Y, Z)
IrrMoveNodeRight(*Camera, Dist)
EndProcedure

Procedure.F Wrap(Angle.F)
If Angle >= 360 : Angle - 360 : EndIf
If Angle < 0 : Angle + 360 : EndIf
ProcedureReturn Angle
EndProcedure

Procedure Rotate(*Node, X.F, Y.F, Z.F)
Define OX.F, OY.F, OZ.F
IrrGetNodeRotation(*Node, @OX, @OY, @OZ)
IrrSetNodeRotation(*Node, Wrap(OX + X), Wrap(OY + Y), Wrap(OZ + Z))
EndProcedure

*Camera = IrrAddCamera(0, 0, 0, 0, 0, 0)
*Cube = IrrAddCubeSceneNode(5)
*RotPoint = IrrAddEmptySceneNode()
For I = 0 To 3
*Cones(I) = IrrAddConeSceneNode(20, 20, 2)
IrrSetNodeScale(*Cones(I), 1, 2, 1)
IrrSetNodeRotation(*Cones(I), 0, 0, I * 90)
IrrMoveNodeUp(*Cones(I), 2.5)
IrrSetNodeAllMaterialEmissiveColor(*Cones(I), 0, 0, 180, 0)
IrrAddChildToParent(*Cones(I), *Cube)
Next I
IrrSetNodeAllMaterialEmissiveColor(*Cube, 0, 255, 0, 0)

Define Rot.f, NOP.F, X.F, Y.F, Z.F

SetCamera(Dist)
IrrAddChildToParent(*Camera, *RotPoint)

While IrrRunning()
If IrrKeyEventAvailable() 
*KeyEvent = IrrReadKeyEvent()
If *KeyEvent\direction = #IRR_KEY_DOWN
Select *KeyEvent\key
Case #IRR_KEY_ARROW_LEFT : Rotate(*RotPoint, 0, -5, 0)
Case #IRR_KEY_ARROW_RIGHT : Rotate(*RotPoint, 0, 5, 0)
Case #IRR_KEY_ARROW_UP : Rotate(*RotPoint, 5.001, 0, 0)
Case #IRR_KEY_ARROW_DOWN : Rotate(*RotPoint, -5.001, 0, 0)
Case #IRR_KEY_ADD : If Dist < -10 : Dist + 1 : SetCamera(Dist) : EndIf
Case #IRR_KEY_SUBTRACT : If Dist > -50 : Dist - 1 : SetCamera(Dist) : EndIf
Case #IRR_KEY_ESCAPE : End
EndSelect
EndIf
EndIf

Rotate(*Cube, 0, 0, 1)

IrrBeginScene(0, 0, 0)
IrrDrawScene()
IrrEndScene()

Wend
IrrStop()
FreeIrrlichtWrapperDll()
Try, using DOWN key, rotate camera to position straight under my figure: you will see some weird things...
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

AP ?
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

Any progress ?
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
Godai
Enthusiast
Enthusiast
Posts: 171
Joined: Thu Oct 05, 2006 8:13 pm

Post by Godai »

Anyone ported the pixel lighting example btw?
Godai
Enthusiast
Enthusiast
Posts: 171
Joined: Thu Oct 05, 2006 8:13 pm

Post by Godai »

Can use vertex transparency without lighting being on? Is this a bug or?
JoRo
User
User
Posts: 70
Joined: Sat May 10, 2003 2:03 pm
Location: Essen, Germany
Contact:

Post by JoRo »

Just a might be stupid question:
Why do we need a Irrlicht wrapper?
As I could see, Irrlicht comes with a dll. Why not simply load the dll als lib and that is all?
Godai
Enthusiast
Enthusiast
Posts: 171
Joined: Thu Oct 05, 2006 8:13 pm

Post by Godai »

It's an object oriented engine, so it needs a wrapper to work it's best with PureBasic. That being said, the integration could be better ;)
JoRo
User
User
Posts: 70
Joined: Sat May 10, 2003 2:03 pm
Location: Essen, Germany
Contact:

Post by JoRo »

Hm, I do not really understand, what that means.

I want to use the irrlicht engine for rendering terrains, landscapes, produced with my terrain generator GeoControl.
So, the user interactions would be solved with PB. that then gives the commands to the irrlicht engine.

Is this not possible, or is it more, that I have to think more objectorientated?

I need the functions for loading a 16bit raw terrain, resolution up to 8192, but 4096 would be enough, for textures for those terrains, shadows and lightning and may be GI. Also a inifinte water plane and water shaders.

Can your wrapper do this?

It is really urgent. I want to release the second version in the first half, and if the 3D engine works good, I will have to recode some things, to work in 3D.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

JoRo wrote:As I could see, Irrlicht comes with a dll. Why not simply load the dll als lib and that is all?
While it's absolutely possible to directly use the DLL using interfaces
(COM) up to a certain extent, there're still too many things that had to be
changed inside the DLL in order to make it properly work from PureBasic.

For example, a lot of functions return byVal which leads to crashes as
PB can't handle this. Other (necessary) functions aren't exported at all,
meaning you'd have to re-code them in PB or change the DLL accordingly.

Whatever you look at it, the original DLL or LIB can't be used so there
are only two options left: Write a C-ish wrapper and surrender OOP or
change the DLL.
Good programmers don't comment their code. It was hard to write, should be hard to read.
JoRo
User
User
Posts: 70
Joined: Sat May 10, 2003 2:03 pm
Location: Essen, Germany
Contact:

Post by JoRo »

Thanks for that explanation, now I see the problems.
That seems to be a bit a weak point of PB. The Ogre engine does not have a wrapper to PB, and the implementation in PB itself is .............

So, it looks like buying ColdSteel, if it is far enough or using the wrapper here.
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

JoRo wrote:The Ogre engine does not have a wrapper to PB, and the implementation in PB itself is .............
No, the Ogre PB Engine is going that way:
traumatic wrote: [ ] Write a C-ish wrapper and surrender OOP
[x] change the DLL.
:wink:
User avatar
Rings
Moderator
Moderator
Posts: 1427
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

JoRo wrote:So, it looks like buying ColdSteel, if it is far enough or using the wrapper here.
and fact is that the 'coldsteel' is not more than a wrapper for irrlicht,
as its based on that sources.
SPAMINATOR NR.1
JoRo
User
User
Posts: 70
Joined: Sat May 10, 2003 2:03 pm
Location: Essen, Germany
Contact:

Post by JoRo »

Well, just tested the wrapper.
Seems, like only the silly 8 bit terrains can be loaded.
I have read that there is a patch for support of 16 bit terrains in Irrlicht.
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

I could watch Ring's new signature for hours... :P
Post Reply