CameraAspectMode camera[,mode]
Parameters
|
camera - camera handle mode (optional) - which frustum dimension stays fixed 0: horizontal fit - horizontal field of view stays fixed (default) 1: vertical fit - vertical field of view stays fixed |
Description
|
Controls which camera frustum dimension remains fixed when the viewport aspect ratio changes. Mode 0 is the classic Blitz3D behaviour: the horizontal field of view stays fixed and the vertical field of view changes with the viewport shape. On a very wide screen this squeezes the vertical view. Mode 1 keeps the vertical field of view fixed instead, so widening the viewport reveals more of the scene horizontally without cutting off any vertical scene area. This is how most modern games treat widescreen, and the better choice if your game supports arbitrary window sizes. The frustum size itself comes from CameraZoom, and the ratio from the viewport or a CameraAspect override; this command just picks which axis the zoom applies to. See also: CameraAspect, CameraZoom, CameraViewport. |
Example
; CameraAspectMode Example ; ------------------------ Graphics3D 800,450,0,2 SetBuffer BackBuffer() camera=CreateCamera() CameraClsColor camera,0,0,64 light=CreateLight() RotateEntity light,30,-30,0 AmbientLight 64,64,64 ; A carousel of cubes spanning the view shows which frustum dimension stays fixed pivot=CreatePivot() PositionEntity pivot,0,0,12 For x=-4 To 4 cube=CreateCube(pivot) PositionEntity cube,x*2,0,0 Next mode=0 While Not KeyDown(1) ; Space toggles between horizontal (0) and vertical (1) aspect fitting If KeyHit(57) Then mode=1-mode ; Apply the aspect fit mode to the camera CameraAspectMode camera,mode TurnEntity pivot,0,0.5,0 RenderWorld Text 0,0,"Space: toggle aspect fit mode Esc: exit" If mode=0 Then Text 0,20,"CameraAspectMode camera,0 (horizontal field of view fixed)" Else Text 0,20,"CameraAspectMode camera,1 (vertical field of view fixed)" EndIf Flip Wend End
Index