10 #include <GLFW/glfw3.h> 12 #include "sceneobject.hpp" 23 Camera(GLFWwindow *window_,
const glm::mat4 &matrix_,
float fieldOfView_,
float aspectRatio_,
float nearPlane_,
float farPlane_);
24 Camera(GLFWwindow *window_,
const glm::mat4 &matrix_);
85 const glm::vec3 &target
94 const glm::vec3 &sphereCenterWorldSpace,
95 const glm::vec3 &sphereFarthestPointWorldSpace,
96 const glm::mat4 &viewMat
108 void appendPath(std::vector<std::vector<glm::vec3> > newPath);
113 inline const std::vector<std::vector<glm::vec3> >&
getPath()
const {
return cameraPath; }
130 enum CameraNavigationMode
136 static CameraNavigationMode cameraNavMode;
137 CameraNavigationMode lastNavMode;
138 glm::mat4 lastCamTransform;
140 float timePassed = 0;
141 static double scrollY;
144 void updateBezierPathCamTransform(
const double timeDelta,
const double speed);
146 std::vector<std::vector<glm::vec3>> cameraPath;
147 int currentPathSegment;
148 float pathSegmentLerpFactor;
149 glm::vec3 targetLookAtPos;
155 void handleNavModeChange();
158 static void onScroll(
165 void handleInputFreeCamera(
170 glm::vec3 mix(
const glm::vec3 &a,
const glm::vec3 &b,
float t);
void clearCameraPath()
clears the current camera path
Definition: camera.h:103
float getFieldOfView() const
Get field of view of the viewing frustum.
Definition: camera.cpp:63
const std::vector< std::vector< glm::vec3 > > & getPath() const
returns the current camera path (control points of bezier curve segments).
Definition: camera.h:113
void setNearPlane(float nearPlane_)
Set distance from camera to near plane of the viewing frustum.
Definition: camera.cpp:88
float getNearPlane() const
Get distance from camera to near plane of the viewing frustum.
Definition: camera.cpp:83
void appendPath(std::vector< std::vector< glm::vec3 > > newPath)
appends a number of path segments to current camera path (control points of bezier curve segments)...
Definition: camera.cpp:134
void lookAt(const glm::vec3 &target)
Rotate camera to look at a given target point The target should not be the camera location...
Definition: camera.cpp:103
float getFarPlane() const
Get distance from camera to near plane of the viewing frustum.
Definition: camera.cpp:93
void toggleNavMode()
Toggle the camera navigation mode.
Definition: camera.cpp:243
void setTargetLookAtPos(const glm::vec3 &lookAtPos)
set target look at position for FOLLOW_PATH mode
Definition: camera.h:119
void setAspectRatio(float aspectRatio_)
Set the aspect ratio of the viewing frustum (width / height)
Definition: camera.cpp:78
glm::mat4 getProjMat() const
get the current projection matrix defining the view frustum calculated from the parameters stored ...
Definition: camera.cpp:58
const glm::vec3 & getTargetLookAtPos() const
get target look at position for FOLLOW_PATH mode
Definition: camera.h:116
A base class for all scene objects.
Definition: sceneobject.hpp:15
void setFarPlane(float farPlane_)
Set distance from camera to far plane of the viewing frustum.
Definition: camera.cpp:98
glm::mat4 getViewMat() const
get the view matrix, i.e.
Definition: camera.cpp:53
virtual void update(float timeDelta, float cameraPathSpeed)
Update the state of the Camera.
Definition: camera.cpp:36
bool checkSphereInFrustum(const glm::vec3 &sphereCenterWorldSpace, const glm::vec3 &sphereFarthestPointWorldSpace, const glm::mat4 &viewMat)
Determine whether a sphere with given center and farthest point in world space lies completely within...
Definition: camera.cpp:108
A Camera is a SceneObject that maintains a view matrix, as well as parameters defining the projection...
Definition: camera.h:20
float getAspectRatio() const
Get the aspect ratio of the viewing frustum (width/height)
Definition: camera.cpp:73
void setFieldOfView(float fieldOfView_)
Set field of view of the viewing frustum.
Definition: camera.cpp:68