sync on : sync rate 0
hide mouse : disable escapekey
 
make memblock 1,444
write memblock dword 1,0,338
write memblock dword 1,4,36
write memblock dword 1,8,12
 
type Vertex
   XPos As float
   YPos As float
   ZPos As float
   XNor As float
   YNor As float
   ZNor As float
   Diff As dword
   UCor As float
   VCor As float
endtype
 
global dim VertexData(12) As Vertex
 
` Set the vertex data
setVertex(0,0,10,0,0,10.1,0,4294901760,15,0)
setVertex(1,15,-10,-15,15.1,-10.1,-15.1,4294901760,30,10)
setVertex(2,-15,-10,-15,-15.1,-10.1,-15.1,4294901760,0,10)
setVertex(3,0,-10,15,0,-10.1,15.1,4294901760,15,20)
setVertex(4,0,10,0,0,10.1,0,4294901760,15,0)
setVertex(5,-15,-10,-15,-15.1,-10.1,-15.1,4294901760,0,10)
setVertex(6,0,-10,15,0,-10.1,15.1,4294901760,15,20)
setVertex(7,15,-10,-15,15.1,-10.1,-15.1,4294901760,30,10)
setVertex(8,0,10,0,0,10.1,0,4294901760,15,0)
setVertex(9,0,-10,15,0,-10.1,15.1,4294901760,15,20)
setVertex(10,-15,-10,-15,-15.1,-10.1,-15.1,4294901760,0,10)
setVertex(11,15,-10,-15,15.1,-10.1,-15.1,4294901760,30,10)
 
for i=0 to 11
   write memblock float 1,(12+(36*i)),VertexData(i).XPos
   write memblock float 1,(16+(36*i)),VertexData(i).YPos
   write memblock float 1,(20+(36*i)),VertexData(i).ZPos
   write memblock float 1,(24+(36*i)),VertexData(i).XNor
   write memblock float 1,(28+(36*i)),VertexData(i).YNor
   write memblock float 1,(32+(36*i)),VertexData(i).ZNor
   write memblock dword 1,(36+(36*i)),VertexData(i).Diff
   write memblock float 1,(40+(36*i)),VertexData(i).UCor
   write memblock float 1,(44+(36*i)),VertexData(i).VCor
next i
 
make mesh from memblock 1,1
save mesh "lol.x",1
delete memblock 1
delete mesh 1
load object "lol.x",1
xrotate object 1,289.6
 
position camera 0,20,-45
point camera 0,0,0
 
Framerate=timer()
repeat
   A$ = inkey$()
   if timer()-Framerate >= 15
      yrotate object 1,object angle y(1)+2
      sync
   endif
until A$<>"" or escapekey()=1
delete object 1
delete file "lol.x"
 
function setVertex(index as integer,xp as float,yp as float,zp as float,xn as float,yn as float,zn as float,dif as dword,uc as float,vc as float)
   VertexData(index).XPos = xp
   VertexData(index).YPos = yp
   VertexData(index).ZPos = zp
   VertexData(index).XNor = xn
   VertexData(index).YNor = yn
   VertexData(index).ZNor = zn
   VertexData(index).Diff = dif
   VertexData(index).UCor = uc
   VertexData(index).VCor = vc
endfunction