GPX-Visualizer/camera/Camera.h

48 lines
1.0 KiB
C
Raw Permalink Normal View History

2021-06-15 21:13:59 -04:00
#ifndef __CAMERA_H__
#define __CAMERA_H__
/*
2022-06-16 15:11:58 -04:00
Generic camera class by Nghia Ho
2021-06-15 21:13:59 -04:00
*/
class Camera
{
public:
Camera() { Init(); }
~Camera(){}
2021-06-21 23:11:21 -04:00
enum class Target {
FORWARD,
POINT,
};
2021-06-15 21:13:59 -04:00
void Init();
void Refresh();
void SetPos(float x, float y, float z);
2022-06-16 15:11:58 -04:00
void GetPos(float &x, float &y, float &z);
void GetDirectionVector(float &x, float &y, float &z);
2021-06-15 21:13:59 -04:00
void SetYaw(float angle);
void SetPitch(float angle);
2021-06-21 23:11:21 -04:00
// NOTE(dev): x,y,z is only set if target is POINT
void SetTarget(Target target, float x = 0.0f, float y = 0.0f, float z = 0.0f);
2021-06-15 21:13:59 -04:00
// Navigation
void Move(float incr);
void Strafe(float incr);
void Fly(float incr);
void RotateYaw(float angle);
void RotatePitch(float angle);
private:
2021-06-21 23:11:21 -04:00
float m_x, m_y, m_z; // Position
float m_lx, m_ly, m_lz; // Direction vector of where we are looking at
2021-06-15 21:13:59 -04:00
float m_yaw, m_pitch; // Various rotation angles
2021-06-21 23:11:21 -04:00
float m_strafe_lx, m_strafe_ly; // Always 90 degree to direction vector
float t_x, t_y, t_z; // when in TARGET mode, look at this x,y,z coordinate
Target target;
2021-06-15 21:13:59 -04:00
};
#endif