Engine
Camera Class Reference

A Camera is used to view a scene from a particular vantage point. More...

#include <camera.h>

Public Member Functions

 Camera (Vector3Gf position=Vector3Gf(0.0f, 0.0f, 0.0f), Vector3Gf up=Vector3Gf(0.0f, 1.0f, 0.0f), GLfloat yaw=-90.0f, GLfloat pitch=0.0f)
 
Eigen::Matrix< GLfloat, 4, 4 > GetViewMatrix ()
 
void ProcessKeyboard (Camera_Movement direction, GLfloat deltaTime)
 
void ProcessMouseMovement (GLfloat xoffset, GLfloat yoffset, GLboolean constrainPitch=true)
 
void ProcessMouseScroll (GLfloat yoffset)
 

Public Attributes

Vector3Gf m_position
 
Vector3Gf m_front
 
Vector3Gf m_up
 
Vector3Gf m_right
 
Vector3Gf m_world_up
 
GLfloat m_yaw
 
GLfloat m_pitch
 
GLfloat m_movement_speed
 
GLfloat m_mouse_sensitivity
 
GLfloat m_zoom
 

Detailed Description

A Camera is used to view a scene from a particular vantage point.

A Camera requires a position,orientation, and direction to look in space. These things together define a camera centered coordinate system. This camera system is based on the camera system from here

Constructor & Destructor Documentation

Camera::Camera ( Vector3Gf  position = Vector3Gf(0.0f, 0.0f, 0.0f),
Vector3Gf  up = Vector3Gf(0.0f, 1.0f, 0.0f),
GLfloat  yaw = -90.0f,
GLfloat  pitch = 0.0f 
)

Constructs a Camera

Parameters
positionposition of the camera in world coordinates
upup direction in world cordinates for the camera. This is used to define up in the Camera coordinate system
yawyaw value for the camera
pitchpitch value for the camera

Member Function Documentation

Eigen::Matrix< GLfloat, 4, 4 > Camera::GetViewMatrix ( )
Returns
the view matrix calculated using Eular Angles and the LookAt Matrix
void Camera::ProcessKeyboard ( Camera_Movement  direction,
GLfloat  deltaTime 
)

Processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM

Parameters
directiondirection to move the camera in
deltaTimetime in seconds between rendering cycles. Helps smooth camera movement
void Camera::ProcessMouseMovement ( GLfloat  xoffset,
GLfloat  yoffset,
GLboolean  constrainPitch = true 
)

Processes input received from a mouse input system. Expects the offset value in both the x and y direction.

Parameters
xoffsetchange in x position of mouse
yoffsetchange in y position of mouse
constrainPitchcontrols if pitch is constrained within [-89,89] degrees
void Camera::ProcessMouseScroll ( GLfloat  yoffset)

Processes input received from a mouse scroll-wheel event. Only requires input on the vertical wheel-axis

Parameters
yoffsetchange in scroll value

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