C# Class world3D.Camera

Represents a camera - an imaginary observer of a scene in 3D space. The camera uses perspective projection.
Show file Open project: denniskb/asvo_cuda

Public Methods

Method Description
Camera ( float nearPlane, float farPlane, Vector3 pos, Vector3 lookAt, float ratio )

Constructs a new camera with common properties.

getEyeVector ( ) : Vector3

Returns the eye vector. That's a normalized vector pointing from the look-at point towards the camera's position.

getFov ( ) : float

Returns the field of vision of this camera in radians.

getLookAt ( ) : Vector3

Returns the camera's look-at point.

getPosition ( ) : Vector3

Returns the camera's position.

getProjectionMatrix ( ) : Matrix

Returns the projection matrix of this camera.

getViewMatrix ( ) : Matrix

Returns the view matrix of this camera.

getViewProjectionMatrix ( ) : Matrix

Retuns the view matrix multiplied by the projection matrix.

setFov ( float newFov ) : void

Sets the field of vision of the camera in radians.

setLookAt ( Vector3 newLookAt ) : void

Sets the point the camera looks-at.

setPosition ( Vector3 newPosition ) : void

Sets the camera's position.

update ( GameTime time, int horRes, int vertRes ) : void

Used to animate camera movement which is caused by user input. The user can steer the camera with the mouse: By clicking and holding the left mouse button and then dragging the mouse, the camera will rotate around its look-at point. The scroll wheel can be used to zoom in and out of the scene. Note: Scrolling doesn't change the camera's fov, but its distance from its look-at position.

Private Methods

Method Description
updateMatrices ( ) : void

Caches the view, projection and viewProjection matrices after each change to data which they depend on (like position for example).

Method Details

Camera() public method

Constructs a new camera with common properties.
public Camera ( float nearPlane, float farPlane, Vector3 pos, Vector3 lookAt, float ratio )
nearPlane float Near clipping plane distance.
farPlane float Far clipping plane distance.
pos Vector3 Position of the camera.
lookAt Vector3 Target the camera is pointing at.
ratio float Aspect ratio of the projection (width/height)

getEyeVector() public method

Returns the eye vector. That's a normalized vector pointing from the look-at point towards the camera's position.
public getEyeVector ( ) : Vector3
return Vector3

getFov() public method

Returns the field of vision of this camera in radians.
public getFov ( ) : float
return float

getLookAt() public method

Returns the camera's look-at point.
public getLookAt ( ) : Vector3
return Vector3

getPosition() public method

Returns the camera's position.
public getPosition ( ) : Vector3
return Vector3

getProjectionMatrix() public method

Returns the projection matrix of this camera.
public getProjectionMatrix ( ) : Matrix
return Matrix

getViewMatrix() public method

Returns the view matrix of this camera.
public getViewMatrix ( ) : Matrix
return Matrix

getViewProjectionMatrix() public method

Retuns the view matrix multiplied by the projection matrix.
public getViewProjectionMatrix ( ) : Matrix
return Matrix

setFov() public method

Sets the field of vision of the camera in radians.
public setFov ( float newFov ) : void
newFov float Field of vision in radians.
return void

setLookAt() public method

Sets the point the camera looks-at.
public setLookAt ( Vector3 newLookAt ) : void
newLookAt Vector3 The new look-at point.
return void

setPosition() public method

Sets the camera's position.
public setPosition ( Vector3 newPosition ) : void
newPosition Vector3 The camera's new position.
return void

update() public method

Used to animate camera movement which is caused by user input. The user can steer the camera with the mouse: By clicking and holding the left mouse button and then dragging the mouse, the camera will rotate around its look-at point. The scroll wheel can be used to zoom in and out of the scene. Note: Scrolling doesn't change the camera's fov, but its distance from its look-at position.
public update ( GameTime time, int horRes, int vertRes ) : void
time GameTime Elapsed time since last frame.
horRes int Horizontal resolution of the screen.
vertRes int Vertical resolution of the screen.
return void