; CreateLineList Example ; ---------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,4,-10 light=CreateLight() RotateEntity light,45,45,0 ; CreateLineList makes a retained line entity - here an editor-style floor grid lines=CreateLineList() EntityColor lines,30,180,255 LineWidth lines,2 For c=-4 To 4 AddLine lines,c,0,-4,c,0,4 AddLine lines,-4,0,c,4,0,c Next ; A ball bouncing on the grid so the scene lives ball=CreateSphere() ScaleEntity ball,0.5,0.5,0.5 EntityColor ball,255,210,40 While Not KeyDown(1) ; Bounce the ball across the grid angle#=angle+2 PositionEntity ball,2*Sin(angle*0.7),0.5+Abs(2*Sin(angle)),0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Arrow keys: move camera Esc: exit" Text 0,20,"The grid is one line-list entity holding "+CountLines(lines)+" segments" Text 0,40,"Line width stays constant however close the camera gets" Flip Wend End