; CameraProjMode Example ; ---------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,2,-8 light=CreateLight() RotateEntity light,45,45,0 ; A corridor of columns - perspective makes the far ones shrink, ; orthographic draws every column the same size on screen For i=0 To 5 column=CreateCylinder() ScaleEntity column,0.5,2,0.5 PositionEntity column,-2,1,i*3 column=CreateCylinder() ScaleEntity column,0.5,2,0.5 PositionEntity column,2,1,i*3 Next mode=1 zoom#=1 CameraProjMode camera,mode While Not KeyDown(1) ; 1: perspective 2: orthographic 0: camera off If KeyHit(2) mode=1 CameraProjMode camera,mode zoom=1 CameraZoom camera,zoom EndIf If KeyHit(3) mode=2 CameraProjMode camera,mode ; Ortho views are very zoomed in - scale out with CameraZoom zoom=0.2 CameraZoom camera,zoom EndIf If KeyHit(11) mode=0 CameraProjMode camera,mode EndIf ; + / - adjust the zoom (best seen in orthographic mode) If KeyDown(13) zoom=zoom+0.005 CameraZoom camera,zoom EndIf If KeyDown(12) If zoom>0.05 zoom=zoom-0.005 CameraZoom camera,zoom EndIf EndIf ; 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 ; With the camera off nothing is rendered, so clear by hand If mode=0 Then Cls name$="perspective" If mode=2 Then name$="orthographic" If mode=0 Then name$="off - nothing is rendered" Text 0,0,"1/2: projection 0: camera off +/-: zoom Esc: exit" Text 0,20,"CameraProjMode camera,"+mode+" ("+name$+") zoom "+zoom Flip Wend End