; CameraRange Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,2,0 light=CreateLight() RotateEntity light,45,45,0 ; Textured ground plane gives a sense of distance plane=CreatePlane() ground_tex=LoadTexture("media/MossyGround.BMP") ScaleTexture ground_tex,4,4 EntityTexture plane,ground_tex ; An avenue of pillars marching into the distance shows where the far plane clips For z=10 To 150 Step 10 pillar=CreateCylinder() ScaleEntity pillar,0.5,3,0.5 PositionEntity pillar,-4,3,z pillar=CreateCylinder() ScaleEntity pillar,0.5,3,0.5 PositionEntity pillar,4,3,z Next far_range#=50 While Not KeyDown(1) ; Press [ / ] to pull the far clipping plane closer or push it away If KeyDown(26) And far_range>5 Then far_range=far_range-0.5 If KeyDown(27) And far_range<300 Then far_range=far_range+0.5 ; Apply the near and far clipping range to the camera CameraRange camera,1,far_range ; 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 [ / ]: change far range Esc: exit" Text 0,20,"Distant pillars vanish once they pass the far clipping plane" Text 0,40,"CameraRange camera,1,"+far_range Flip Wend End