' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  006   as   Load a simple 3D Object And set multiple mesh
'   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
 
  
  
' Load an 3D Object 
  Dim obj as Mesh = _LoadMesh("media/earth.x")



' Create several mesh
dim i as Integer
Dim sphere as EntityNode
For  i = 0 To 3
  '; Create a mesh with one of the 3D Object loaded
    sphere = _CreateEntityNode(obj)
    ' set position
    _PositionNode(sphere, 3*i,0,0)
Next




' create a camera
  dim cam as CameraNode = _CreateCamera()
_PositionNode(cam, 6,0,-10)


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

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


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



  	' ---------------
  	'      Render
  	' ---------------
  _BeginScene()
     _DrawScene()
  _EndScene()

Wend 
' end
_FreeEngine()
