71 lines
2.1 KiB
C++
71 lines
2.1 KiB
C++
#pragma once
|
|
#include "../inc/glm/glm.hpp"
|
|
|
|
class Camera {
|
|
public:
|
|
static void Create();
|
|
static void Destroy();
|
|
static Camera* Instance();
|
|
|
|
void UpdateMouse(glm::vec2 mouseChange, float dTime);
|
|
void UpdateKeys(glm::vec3 movement, float dTime);
|
|
void UpdateScroll(glm::vec2 offset, float dTime);
|
|
void ToggleMode();
|
|
bool IsFree();
|
|
void Compute();
|
|
void Reset();
|
|
|
|
glm::vec3 GetPosition() const;
|
|
void SetPosition(glm::vec3 position);
|
|
glm::vec3 GetDirection() const;
|
|
void SetDirection(glm::vec3 direction);
|
|
glm::vec3 GetTarget() const;
|
|
void SetTarget(glm::vec3 target);
|
|
glm::vec3 GetPivot() const;
|
|
void SetPivot(glm::vec3 pivot);
|
|
double GetAltitude() const;
|
|
void SetAltitude(double altitude);
|
|
float GetFOV() const;
|
|
void SetFOV(float fov);
|
|
float GetNear() const;
|
|
void SetNear(float near);
|
|
float GetFar() const ;
|
|
void SetFar(float far);
|
|
|
|
void SetMovingSpeed(float speed);
|
|
float GetMovingSpeed();
|
|
void SetRotationSpeed(float speed);
|
|
float GetRotationSpeed();
|
|
|
|
protected:
|
|
|
|
private:
|
|
Camera();
|
|
~Camera();
|
|
|
|
static Camera* mInstance;
|
|
|
|
bool mFreeCam; // camera mode; free-moving mode or trackball
|
|
|
|
glm::vec3 mPosition;
|
|
|
|
glm::vec3 mDirection; // direction, negative z-axis, used for free camera mode
|
|
glm::vec3 mRight; // right vector, x-axis, used for free camera mode
|
|
glm::vec3 mUp; // up vector, y-axis, used for free camera mode
|
|
|
|
float mHorizontalRotation; // rotation around y-axis, used for free camera mode
|
|
float mVerticalRotation; // rotation around x-axis, used for free camera mode
|
|
|
|
float mAltitude; // camera altitude/elevation, used for trackball camera mode
|
|
float mAzimuth; // camera azimuth, used for trackball camera mode
|
|
glm::vec3 mPivot; // pivot point, used for trackball camera mode
|
|
|
|
float mFOV; // field of view in y-direction
|
|
float mNear;
|
|
float mFar;
|
|
|
|
float mMovingSpeed; // free camera moving speed
|
|
float mRotationSpeed; // free camera rotation speed
|
|
float mSurfingSpeed; // trackball camera surfing speed
|
|
float mZoomSpeed; // scrolling speed/sensitivity, used for zooming
|
|
}; |