#ifndef __CAMERA_H__ #define __CAMERA_H__ /* Generic camera class by Nghia Ho */ class Camera { public: Camera() { Init(); } ~Camera(){} enum class Target { FORWARD, POINT, }; void Init(); void Refresh(); void SetPos(float x, float y, float z); void GetPos(float &x, float &y, float &z); void GetDirectionVector(float &x, float &y, float &z); void SetYaw(float angle); void SetPitch(float angle); // 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); // Navigation void Move(float incr); void Strafe(float incr); void Fly(float incr); void RotateYaw(float angle); void RotatePitch(float angle); private: float m_x, m_y, m_z; // Position float m_lx, m_ly, m_lz; // Direction vector of where we are looking at float m_yaw, m_pitch; // Various rotation angles 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; }; #endif