;; ----------------------------------------------------------------------------
;; Irrlicht Wrapper For Imperative Languages - Purebasic Examples
;; IrrlichtWrapper and FreeBasic-Example by Frank Dodd (2006)
;; Improved IrrlichtWrapper - Michael Taupitz (2007)
;; PureBasic-Examples by Michael Taupitz (neotoma) & Marius Eckardt (Thalius) 
;; ----------------------------------------------------------------------------
;; Example 09 : Skybox
;; This example adds a skybox around the whole scene that makes a backdrop
;; For your scene To be rendered against
;; ----------------------------------------------------------------------------
;;
;; Adapted for PureBasic 4 by Michael Taupitz (neotoma)
;;
;; ////////////////////////////////////////////////////////////////////////////
;; Include the Irr3D-Requester
XIncludeFile "Irr3DRequester.pb"


; irrlicht objects
*SkyBox.irr_node
*camera.irr_camera

; -----------------------------------------------------------------------------
; To Start the Irrlicht-Device we use the Irr3DRequester, to make it more comfortable
; for the Users, and also easier to test different resolutions and devices.
If Irr3DRequester()
  
  ; send the window caption
  IrrSetWindowCaption( "Example 09: Skybox" )
  
  ; the skybox is a simple hollow cube that surrounds the whole scene. textures
  ; are applied to all of the six sides of the cube creating an image around the
  ; entire scene instead of simply the color of the blank canvas
  ; here we load the textures as parameters of the skybox command (they could
  ; of course be loaded seperatly and assigned to irr_texture variables
  
  Dim *textures.irr_texture(6)
  *textures(0) = IrrGetTexture("media\irrlicht2_up.jpg")
  *textures(1) = IrrGetTexture("media\irrlicht2_dn.jpg")
  *textures(2) = IrrGetTexture("media\irrlicht2_rt.jpg")
  *textures(3) = IrrGetTexture("media\irrlicht2_lf.jpg")
  *textures(4) = IrrGetTexture("media\irrlicht2_ft.jpg")
  *textures(5) = IrrGetTexture("media\irrlicht2_bk.jpg")
  
  *SkyBox = IrrAddSkyBoxToScene( *textures(0),*textures(1),*textures(2),*textures(3),*textures(4),*textures(5))
  
  ; we add a first person perspective camera to the scene so you can look about
  *camera = IrrAddFPSCamera()
  
  ; hide the mouse pointer
  IrrHideMouse()
  
  ; -----------------------------------------------------------------------------
  ; while the irrlicht environment is still running
  While IrrRunning()
      ; begin the scene, erasing the canvas with sky-blue before rendering
      IrrBeginScene( 240, 255, 255 )
  
      ; draw the scene
      IrrDrawScene()
  
      ; end drawing the scene and render it
      IrrEndScene()
  Wend
  
  ; -----------------------------------------------------------------------------
  ; Stop the irrlicht engine and release resources
  IrrStop()
EndIf

End

; IDE Options = PureBasic 4.10 Beta 3 (Windows - x86)
; CursorPosition = 42
; FirstLine = 9
; Folding = -