' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  016  as   Test transparent cubemesh
'   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


 
  
  
Dim cubemesh as Mesh = _CreateCubeMesh(5.0)
Dim hillmesh as Mesh = _CreateHillPlaneMesh()


'----------------------------------------
' Create a first cube And set position
Dim cube as EntityNode = _CreateEntityNode(cubemesh)
_PositionNode(cube, 5,5,6) 
_LoadTextureNode(cube, "media/sp1.png") 
_MaterialTypeNode(cube,  EMT_TRANSPARENT_ALPHA_CHANNEL )



' Create a second cube And set position
cube = _CreateEntityNode(cubemesh)
_PositionNode(cube, 0,5,0) 
_LoadTextureNode(cube, "media/sp1.png") 
_MaterialTypeNode(cube,  EMT_TRANSPARENT_ALPHA_CHANNEL )

 
'----------------------------------------
' quick ground 
Dim hillplane as EntityNode = _CreateEntityNode(hillmesh)
_LoadTextureNode(hillplane, "media/wall.jpg") 



' Create a camera
dim cam As CameraNode = _CreateCameraFPS( )
_PositionNode(cam, 0,10,-30)


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

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


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




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

Wend 
' end
_FreeEngine()

