diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-12-07 16:23:20 -0500 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-12-07 16:23:20 -0500 |
commit | caa765bff49d54217b75aaf0e7acf4e5392a11e4 (patch) | |
tree | 9b92914dfb88b99599e8e60e4512e9e9ea9a25db /src/camera/camera.h | |
parent | a9274459443f1d560d7580a162deb581549980cb (diff) |
upload base code
Diffstat (limited to 'src/camera/camera.h')
-rw-r--r-- | src/camera/camera.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/camera/camera.h b/src/camera/camera.h new file mode 100644 index 0000000..e0cd013 --- /dev/null +++ b/src/camera/camera.h @@ -0,0 +1,49 @@ +#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; + + // 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::vec3 getPos() const; + + float cameraDepth = -1.f; + +private: + glm::mat4 m_viewMatrix; + glm::mat4 m_inverse; + float m_heightAngle; + glm::vec3 m_pos; + + float m_focalLength; + float m_aperture; +}; + |