Class Camera

class Camera

Public Functions

Camera()
CLASS_NO_COPY_MOVE(Camera)
~Camera()
void update(float deltaTime)
void attach()
inline void reApplyScissor()

Re-applies the scissor-area defined via the viewport.

This can be useful if you changed the scissor-area and now wish to reset it.

void setScreenArea(int x, int y, int width, int height)
void setLookAt(
const fm_vec3_t &newPos,
const fm_vec3_t &newTarget,
const fm_vec3_t &newUp = {0, 1, 0}
)

Sets new camera values based on a look-at transform.

If you have an arbitrary rotation based camera prefer using ‘setPosRot’.

Parameters:
  • newPos – camera eye

  • newTarget – camera target

  • newUp – camera up vector (+Y by default)

void setPosRot(const fm_vec3_t &newPos, const fm_quat_t &rot)

Sets a new camera by position and rotation.

If you have a look-at based camera prefer using ‘setLookAt’.

Parameters:
  • pos – camera eye

  • rot – rotation

inline const fm_vec3_t &getTarget() const
inline const fm_vec3_t &getPos() const
inline fm_vec3_t getViewDir() const
inline const fm_mat4_t &getViewMatrix() const
inline const fm_vec3_t &getUp() const
fm_vec3_t getScreenPos(const fm_vec3_t &worldPos)

Public Members

float fov = {}
float near = {}
float far = {}
float aspectRatio = {}