' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  026   as   SkyDome Test.
'   Historique   as 
'     29/03/09  19 as 16    TMyke
'
' ------------------------------------------------------------

' Includes libraries
#include "N3xtD.bi"

' Dimes
Dim app As any Ptr
Dim Quit As Integer


'----------------------------------------------------------
' open n3xt-D screen
app = _CreateGraphics3D(800,600)
If app=NULL Then
  End
End If



'-----------------------------------------
' set ambient light
 _AmbientLight(&hffaaaaaa)


'-----------------------------------------
' Create a cube And set position
Dim cubemesh as Mesh = _CreateCubeMesh(1.0)

Dim cube as EntityNode = _CreateEntityNode(cubemesh)
_PositionNode(cube, 0,0,0) 
_LoadTextureNode(cube, "media/glass.bmp")  


'Create skydome
Dim sky as EntityNode = _CreateSkydome( _LoadTexture("media/env_sky.jpg"), 16, 8, 0.95, 1.3)



'-----------------------------------------
' Create first  camera
dim cam as CameraNode = _CreateCameraFPS( )
_PositionNode(cam, 0,1,-10)


'-----------------------------------
' simple text inside the scene area 
_LoadFont("media/courriernew.png")
dim font As IGUIFont = _GetFont()



' ---------------------------------------
'           Main loop
' ---------------------------------------
While Quit=0
 

' If Escape Key, Exit	
  If _GetKeyDown(KEY_ESCAPE) then
    Quit=1
  EndIf
  
  _TurnNode(cube, 0,1,0)
  

  ' ---------------
  '      Render
  ' ---------------
  _BeginScene(128,128,128)
     _DrawScene()
    _DrawText(font, "SkyDome demo",  10,10,0,0, &hff00ffff)
  _EndScene()


Wend 
' end
_FreeEngine()

