C# Class VoxelTerrain.Camera

Allows observing the scene with the mouse and keyboard.
Show file Open project: barograf/VoxelTerrain Class Usage Examples

Public Methods

Method Description
Camera ( Device graphicsDevice, System.Vector3 position, System.Vector3 look, float nearPlane, float farPlane ) : System

Creates a camera with specified values.

FixVectors ( ) : void

Fixes camera sphere point and look vector. Sphere point is fixed by camera look vector spherical unmapping. Look vector is fixed by putting it at a distance of one unit away from position vector.

MoveLook ( System.Vector2 mousePositionDelta, float speed ) : void

Moves camera look vector around a sphere.

MovePosition ( MoveDirection moveDirection, double deltaTime ) : void

Moves a camera position vector.

UpdateProjection ( ) : void

Updates camera projection matrix.

Private Methods

Method Description
ExtractPlanesFromFrustum ( ) : void

Computes plane equations used in frustum culling.

UpdateView ( ) : void

Updates camera view matrix.

Method Details

Camera() public method

Creates a camera with specified values.
public Camera ( Device graphicsDevice, System.Vector3 position, System.Vector3 look, float nearPlane, float farPlane ) : System
graphicsDevice Device Virtual adapter used to perform rendering.
position System.Vector3 Position of a camera.
look System.Vector3 A point the camera look at.
nearPlane float A near plane of a camera frustum.
farPlane float A far plane of a camera frustum.
return System

FixVectors() public method

Fixes camera sphere point and look vector. Sphere point is fixed by camera look vector spherical unmapping. Look vector is fixed by putting it at a distance of one unit away from position vector.
public FixVectors ( ) : void
return void

MoveLook() public method

Moves camera look vector around a sphere.
public MoveLook ( System.Vector2 mousePositionDelta, float speed ) : void
mousePositionDelta System.Vector2 Mouse position change.
speed float Desired moving speed.
return void

MovePosition() public method

Moves a camera position vector.
public MovePosition ( MoveDirection moveDirection, double deltaTime ) : void
moveDirection MoveDirection Movement direction.
deltaTime double Performance timer delta time.
return void

UpdateProjection() public method

Updates camera projection matrix.
public UpdateProjection ( ) : void
return void