Bug Report ?
Using this code:
Code:
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...