[B3D] CameraZoom -> FOV / FOV -> CameraZoom
Übersicht

ChristianKBetreff: [B3D] CameraZoom -> FOV / FOV -> CameraZoom |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Zwei Funktionen zum Umrechnen von CameraZoom und Field of View:
Code: [AUSKLAPPEN] Function CameraZoomToFOV#( zoom# )
Return ( 2 * ATan( 1 / zoom# ) ) End Function Function FOVToCameraZoom#( fov# ) Return( 1.0 / Tan( fov# / 2.0 ) ) End Function ; Beispiel Graphics3D 800, 600, 32, 2 SetBuffer BackBuffer( ) Local fov# = 90 Local cam = CreateCamera( ) PositionEntity( cam, 0, 0, -10 ) Local light = CreateLight( ) LightColor( light, 100, 100, 100 ) Local cube = CreateCube( ) RotateEntity( cube, 45, 45, 0 ) While Not KeyDown( 1 ) If KeyDown( 200 ) fov# = fov# + 1 EndIf If KeyDown( 208 ) fov# = fov# - 1 EndIf CameraZoom( cam, FOVToCameraZoom( fov# ) ) RenderWorld Text 10, 10, "Field of View: " + fov# Text 10, 30, "CameraZoom: " + FOVToCameraZoom( fov ) Flip Wend End |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group