; LineDepthMode Example ; --------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-7 light=CreateLight() RotateEntity light,45,45,0 ; A spinning crate with a targeting line passing straight through it crate=CreateCube() PositionEntity crate,0,0,2 EntityColor crate,180,130,70 lines=CreateLineList() AddLine lines,-4,0,2,4,0,2 EntityColor lines,255,210,40 LineWidth lines,4 mode=1 While Not KeyDown(1) ; [ and ] cycle through the four depth modes If KeyHit(26) Then mode=(mode+3) Mod 4 If KeyHit(27) Then mode=(mode+1) Mod 4 ; LineDepthMode controls how the line interacts with scene depth LineDepthMode lines,mode TurnEntity crate,0,1,0 ; A short label for each documented mode Select mode Case 0 label$="overlay - ignores depth, always on top" Case 1 label$="default - hidden inside the crate, drawn after the scene" Case 2 label$="early - depth tested and written before the scene" Case 3 label$="grid - always passes, writes depth for later geometry" End Select ; 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 [ / ] : depth mode Esc: exit" Text 0,20,"LineDepthMode lines,"+mode+" ("+label+")" Flip Wend End