' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample 004  :  load a simple 3D object ad set mesh
'   Historique  :
'     29/03/09  19:16    TMyke
'
' ------------------------------------------------------------

' Includes libraries
#include "N3xtD.bi"

' Globales
Dim app As any Ptr
Dim Quit As Integer


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

_AmbientLight(&hffffff00) 

' load an 3D object 
  DIM obj As Mesh = _LoadMesh("media/earth.x")
' create a mesh with one of the 3D object loaded
  DIM sphere As EntityNode = _CreateEntityNode(obj)
' set debug information
  _DebugModeNode(sphere, DEBUG_BBOX )




' create a camera
DIM cam As CameraNode = _CreateCamera()
_PositionNode(cam, 0,0,-5)




' ---------------------------------------
'           main loop
' ---------------------------------------
While Quit=0
 

' just turn our sphere
 _TurnNode(sphere, 0,0.5,0)

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


  	' ---------------
  	'      Render
  	' ---------------
  _BeginScene(20,20,50)
     _DrawScene()
  _EndScene()


Wend 
' end
_FreeEngine()
