class ThreeDViewer.Camera

Overview

A class to represent a camera in 3D Space. Inspired by this : https://opentk.net/learn/chapter1/9-camera.html and this : https://github.com/opentk/LearnOpenTK/blob/master/Common/Camera.cs. More…

class Camera
{
public:
    // properties

    Vector3 Position;
    ProjectionMode ProjectionMode;
    double AspectRatio;
    Vector3 Front;
    Vector3 Up;
    Vector3 Right;
    double Pitch;
    double Yaw;
    double Fov;
    Vector3 LineOfSight;
    Matrix4 ViewMatrix;
    Matrix4 ProjectionMatrix;

    // methods

    Camera(Vector3 position, double aspectRatio);
};

Detailed Documentation

A class to represent a camera in 3D Space. Inspired by this : https://opentk.net/learn/chapter1/9-camera.html and this : https://github.com/opentk/LearnOpenTK/blob/master/Common/Camera.cs.

Properties

Vector3 Position

Gets or sets the position of the camera.

ProjectionMode ProjectionMode

Gets or sets the projection mode of the camera.

double AspectRatio

Sets the aspect ratio of the camera.

Vector3 Front

Gets the front vector of the camera.

Vector3 Up

Gets the up vector of the camera.

Vector3 Right

Gets the right vector of the camera.

double Pitch

Gets or sets the pitch in radians of the camera.

double Yaw

Gets or sets the yaw in radians of the camera.

double Fov

Gets or sets the field of view in radians of the camera.

Vector3 LineOfSight

Gets the line of sight of the camera.

Matrix4 ViewMatrix

Gets the view matrix of the camera. Should be used to use to transform from world space to view space.

Matrix4 ProjectionMatrix

Gets the projection matrix of the camera. It’s a perspective projection.

Methods

Camera(Vector3 position, double aspectRatio)

Initializes a new instance of the Camera class.

Parameters:

position

Position of the camera.

aspectRatio

Aspect ration of the camera.