AGL
A graphics library
agl::Camera Class Reference

Implements orbit and pan camera movement. More...

#include <camera.h>

Public Member Functions

virtual void print ()
 
virtual void set (const glm::vec3 &eyepos, const glm::vec3 &look=glm::vec3(0, 0, 0), const glm::vec3 &up=glm::vec3(0, 1, 0))
 
Camera state
virtual const glm::mat4 & viewMatrix () const
 
virtual const glm::vec3 & position () const
 
virtual const glm::vec3 & look () const
 
virtual const glm::vec3 & up () const
 
virtual const glm::vec3 & backward () const
 
virtual const glm::vec3 & right () const
 
virtual float heading () const
 
virtual float pitch () const
 
Respond to user input
void onMouseMotion (int x, int y)
 
void onMouseButton (int button, int state, int x, int y)
 
void onKeyboard (int key, int scancode, int action, int mods)
 
void onScroll (float dx, float dy)
 
Relative movement commands
void moveLeft (float scale=1.0)
 
void moveRight (float scale=1.0)
 
void moveUp (float scale=1.0)
 
void moveDown (float scale=1.0)
 
void moveForward (float scale=1.0)
 
void moveBack (float scale=1.0)
 
void turnLeft (float scale=1.0)
 
void turnRight (float scale=1.0)
 
void turnUp (float scale=1.0)
 
void turnDown (float scale=1.0)
 
void orbitLeft (float scale=1.0)
 
void orbitRight (float scale=1.0)
 
void orbitUp (float scale=1.0)
 
void orbitDown (float scale=1.0)
 
void setTurnRate (float rate)
 
float turnRate () const
 
void setMoveSpeed (float rate)
 
float moveSpeed () const
 

Protected Member Functions

virtual void turn (glm::vec3 *v, glm::vec3 *n, float amount)
 
virtual void move (float dU, float dV, float dN)
 
virtual void orbit (float h, float p)
 
virtual void reset ()
 
virtual void _set (const glm::vec3 &eyepos, const glm::vec3 &look, const glm::vec3 &up)
 

Protected Attributes

float mSpeed
 
float mTurnRate
 
glm::vec3 mEye
 
glm::vec3 mLook
 
glm::vec3 mUp
 
float mHeading
 
float mPitch
 
float mRadius
 
glm::vec3 mResetEye
 
glm::vec3 mResetLook
 
glm::vec3 mResetUp
 
glm::vec3 mU
 
glm::vec3 mV
 
glm::vec3 mN
 
glm::mat4 mCameraMatrix
 
int mLastX
 
int mLastY
 
int mButtonState
 
int mModifierState
 

Detailed Description

Implements orbit and pan camera movement.

Default controls

  • Click-drag the left mouse button to orbit
  • Click-drag the middle mouse button to zoom
  • Click-drag the right mouse button to pan
  • Press spacebar to reset the view

The documentation for this class was generated from the following files: