C# Класс world3D.Camera

Represents a camera - an imaginary observer of a scene in 3D space. The camera uses perspective projection.
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
updateMatrices ( ) : void

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

Описание методов

Camera() публичный Метод

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() публичный Метод

Returns the eye vector. That's a normalized vector pointing from the look-at point towards the camera's position.
public getEyeVector ( ) : Vector3
Результат Vector3

getFov() публичный Метод

Returns the field of vision of this camera in radians.
public getFov ( ) : float
Результат float

getLookAt() публичный Метод

Returns the camera's look-at point.
public getLookAt ( ) : Vector3
Результат Vector3

getPosition() публичный Метод

Returns the camera's position.
public getPosition ( ) : Vector3
Результат Vector3

getProjectionMatrix() публичный Метод

Returns the projection matrix of this camera.
public getProjectionMatrix ( ) : Matrix
Результат Matrix

getViewMatrix() публичный Метод

Returns the view matrix of this camera.
public getViewMatrix ( ) : Matrix
Результат Matrix

getViewProjectionMatrix() публичный Метод

Retuns the view matrix multiplied by the projection matrix.
public getViewProjectionMatrix ( ) : Matrix
Результат Matrix

setFov() публичный Метод

Sets the field of vision of the camera in radians.
public setFov ( float newFov ) : void
newFov float Field of vision in radians.
Результат void

setLookAt() публичный Метод

Sets the point the camera looks-at.
public setLookAt ( Vector3 newLookAt ) : void
newLookAt Vector3 The new look-at point.
Результат void

setPosition() публичный Метод

Sets the camera's position.
public setPosition ( Vector3 newPosition ) : void
newPosition Vector3 The camera's new position.
Результат void

update() публичный Метод

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.
Результат void