blob: 37314c56e883b9c317c0a4f3cf7822dcfe3e6221 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#pragma once
#include "utils/scenedata.h"
#include <glm/glm.hpp>
// A class representing a virtual camera.
// Feel free to make your own design choices for Camera class, the functions below are all optional / for your convenience.
// You can either implement and use these getters, or make your own design.
// If you decide to make your own design, feel free to delete these as TAs won't rely on them to grade your assignments.
class Camera {
public:
Camera(SceneCameraData cameraData);
// Returns the view matrix for the current camera settings.
// You might also want to define another function that return the inverse of the view matrix.
glm::mat4 getViewMatrix() const;
glm::mat4 getInverseViewMatrix() const;
glm::vec4 getTranslationVector() const;
glm::vec4 getInverseTranslationVector() const;
// Returns the aspect ratio of the camera.
float getAspectRatio() const;
// Returns the height angle of the camera in RADIANS.
float getHeightAngle() const;
// Returns the focal length of this camera.
// This is for the depth of field extra-credit feature only;
// You can ignore if you are not attempting to implement depth of field.
float getFocalLength() const;
// Returns the focal length of this camera.
// This is for the depth of field extra-credit feature only;
// You can ignore if you are not attempting to implement depth of field.
float getAperture() const;
glm::vec4 getPos() const;
float cameraDepth = -1.f;
std::vector<glm::vec3> m_controlPoints;
void updateViewMatrix(SceneCameraData cameraData);
private:
glm::mat4 m_viewMatrix{};
glm::mat4 m_inverseViewMatrix{};
float m_heightAngle;
glm::vec4 m_pos;
float m_focalLength;
float m_aperture;
glm::vec4 m_translationVector{};
glm::vec4 m_inverseTranslationVector{};
};
|