; EntityOrder Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() AmbientLight 200,200,200 ; A red cube near the camera and a blue cube behind it near_cube=CreateCube() PositionEntity near_cube,0,0,4 EntityColor near_cube,255,0,0 far_cube=CreateCube() PositionEntity far_cube,0.75,0.75,6 EntityColor far_cube,0,100,255 order=0 While Not KeyDown(1) ; Space cycles the blue cube's draw order: -1, 0, +1 If KeyHit(57) order=order+1 If order>1 Then order=-1 EndIf ; Apply the order: <0 = drawn last (in front), 0 = normal z-buffered ; drawing, >0 = drawn first (behind everything) EntityOrder far_cube,order TurnEntity near_cube,0,1,0 TurnEntity far_cube,0,-1,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,"Space: cycle draw order Arrow keys: move camera Esc: exit" Text 0,20,"EntityOrder far_cube,"+order If order<0 Text 0,40,"-1: drawn last - the far blue cube appears IN FRONT" ElseIf order=0 Text 0,40,"0: normal z-buffered drawing" Else Text 0,40,"+1: drawn first - the blue cube appears BEHIND everything" EndIf Flip Wend End