' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  039   as  Animate Texture.
'   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


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


 
  
Dim texturelist as NArray = _CreateListTexture("media/ball2.png", 64,64) 
'dim texturelist as NArray = _CreateListTexture("media/canvas.bmp", 32,32)
 
dim anim as NNodeAnimator = _CreateTextureAnimator( texturelist,  50)
'   ' add inside the node  the animator Texture animator)
_AddAnimatorTexture(cube, anim)
 
  
 
'-----------------------------------------
' Create first  camera
dim cam As CameraNode = _CreateCameraFPS( )
_PositionNode(cam,0,0,-10)



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

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

	_TurnNode(cube, 0.3,0.3,0)

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



Wend 
' end
_FreeEngine()

