'' ----------------------------------------------------------------------------
'' Irrlicht Wrapper For Imperative Languages - Freebasic Examples
'' Frank Dodd (2006-2010)
'' ----------------------------------------------------------------------------
'' Blitz-Irrlicht 1.8.3 Interface by Ed Musolino (AquaLung 2015)
'' ----------------------------------------------------------------------------
'' Example 06: Billboards
'' This example demonstrates Billboards. A billboard is a single rectangular
'' polygon that always faces the camera. It is often referred To as a 3D sprite
'' And is especially good For spherical effects like glowing floating lights
'' ----------------------------------------------------------------------------

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


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

' irrlicht objects
Global Billboard:Int
Global BillboardTexture:Int
Global Camera:Int

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

' send the window caption
iAppTitle( "Example 06: Billboards" )

' Load the texture resource For the billboard
BillboardTexture = iLoadTexture( "./media/BlitzLogo_Big.jpg" )

' add the billboard To the scene, the first two parameters are the size of the
' billboard in this instance they match the pixel size of the bitmap To give
' the correct aspect ratio. the last three parameters are the position of the
' billboard Object
Billboard = iCreateBillBoard( 200.0,102, 0.0,0.0,100.0 )

' now we apply the loaded texture To the billboard using node material index 0
iNodeTexture( Billboard, BillboardTexture, 0 )

' rather than have the billboard lit by light sources in the scene we can
' switch off lighting effects on the model And have it render as If it were
' Self illuminating
iNodeMaterialFlag( Billboard, IRR_EMF_LIGHTING, False )

' add a first person perspective camera into the scene so we can move around
' the billboard And see how it reacts
Camera = iCreateFPSCamera( 0,100.0,0.5,-1,0,0,0,0.0 )

' hide the mouse pointer
iHideMouse()

', erasing the canvas with sky-blue before rendering
iCameraCLSColor( 128, 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