'' ----------------------------------------------------------------------------
'' Irrlicht Wrapper For Imperative Languages - Freebasic Examples
'' Frank Dodd (2006-2010)
'' ----------------------------------------------------------------------------
'' Blitz-Irrlicht 1.8.3 Interface by Ed Musolino (AquaLung 2015)
'' ----------------------------------------------------------------------------
'' Example 09 : Skybox
'' This example adds a skybox around the whole scene that makes a backdrop
'' For your scene To be rendered against
'' ----------------------------------------------------------------------------

'' ////////////////////////////////////////////////////////////////////////////
'' Includes For extension libraries
Framework usr.birrlicht

'' ////////////////////////////////////////////////////////////////////////////
'' Global variables

' irrlicht objects
Global SkyBox:Int
Global Camera:Int

'' ////////////////////////////////////////////////////////////////////////////
' start the irrlicht interface
iIrr3D( 1280, 720, 32, False )

' send the window caption
iAppTitle( "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
Local SB_Front:Int = iLoadTexture("./media/irrlicht2_ft.jpg")
Local SB_Back:Int = iLoadTexture("./media/irrlicht2_bk.jpg")
Local SB_Left:Int = iLoadTexture("./media/irrlicht2_lf.jpg")
Local SB_Right:Int = iLoadTexture("./media/irrlicht2_rt.jpg")
Local SB_Up:Int = iLoadTexture("./media/irrlicht2_up.jpg")
Local SB_Down:Int = iLoadTexture("./media/irrlicht2_dn.jpg")
SkyBox = iCreateSkybox(SB_Up,SB_Down,SB_Right,SB_Left,SB_Front,SB_Back)

' we add a first person perspective camera To the scene so you can look about
Camera = iCreateFPSCamera(0,100.0,0.5,-1,0,0,0,0.0)

' hide the mouse pointer
iHideMouse()

' erase the canvas with sky-blue before rendering
iCameraCLSColor( 240, 255, 255 )

' -----------------------------------------------------------------------------
' While the irrlicht environment is still running
While iRun() And (Not iKeyHit( KEY_ESCAPE ))

    ' begin the scene
    iBeginScene()

    ' draw the scene
    iDrawScene()

    ' End drawing the scene And render it
    iEndScene()

Wend

' -----------------------------------------------------------------------------
' Stop the irrlicht engine And Release resources
iEndIrr3D()

End