'' ----------------------------------------------------------------------------
'' Irrlicht Wrapper For Imperative Languages - Freebasic Examples
'' Frank Dodd (2006-2010)
'' ----------------------------------------------------------------------------
'' Blitz-Irrlicht 1.8.3 Interface by Ed Musolino (AquaLung 2015)
'' ----------------------------------------------------------------------------
'' Example 52 : Lens Flare
'' A representation of the camera optics effect known as Lens Flare
'' ----------------------------------------------------------------------------

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

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

' irrlicht objects
Global MD2Mesh:Int
Global MeshTexture:Int
Global SceneNode:Int
Global OurCamera:Int


'' ////////////////////////////////////////////////////////////////////////////
' start the irrlicht interface
iIrr3D( 1024, 768, 32, False )

' set the window caption
iAppTitle( "Example 52: Lens Flare - Camera Optics caught in the light" )

' Load texture resources For texturing the scene nodes
MeshTexture = iLoadTexture( "./media/flares.jpg" )

' simply add the lens flare Object And Then move it To the position of the
' lightsource that causes the effect, you may have To cast a ray out To this
' point And see If it strikes a node that might be obscuring the light. in this
' Case you would make the lens flare invisible
SceneNode = iCreateFlare( MeshTexture )
iPositionNode( SceneNode, 300,100,1000 )

' add a first person camera into the scene, And hide the mouse
iCreateFPSCamera(0,100.0,0.5,-1,0,0,0,0.0)
iHideMouse()

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

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

    ' begin the scene
    iBeginScene()

    ' draw the scene
    iDrawScene()
    
    ' draw the GUI
    iDrawGUI()

    ' End drawing the scene And render it
    iEndScene()
Wend

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

End