Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
Loading...
Searching...
No Matches
Camera Class Reference

#include <Camera.h>

Public Member Functions

 Camera (glm::vec3 initPosition)
 
glm::mat4 getViewMatrix () const
 
glm::mat4 getRenderViewMatrix () const
 
glm::mat4 getProjMatrix () const
 
void setAspectRatio (float ratio)
 
void setClipRange (float nearPlane, float farPlane)
 
void setView (const glm::vec3 &newPosition, double newYaw, double newPitch)
 
void resetView (const glm::vec3 &newPosition=glm::vec3(0.0f, 10.0f, 30.0f))
 
void setTarget (SceneObject *obj)
 
void focusOn (SceneObject *obj)
 
void clearTarget ()
 
bool hasTarget () const
 
const SceneObjectgetTarget () const
 
void update (const glm::vec3 *renderTargetPosition=nullptr)
 
void resetMouse ()
 
void processMouseMovement (float xoffset, float yoffset)
 
void processScroll (float wheelSteps)
 
void processKeyboard (Movement direction, float deltaTime)
 

Data Fields

glm::vec3 position
 
glm::vec3 front
 
glm::vec3 up
 
glm::vec3 right
 
glm::vec3 worldUp
 
double yaw = -90.0f
 
double pitch = 0.0f
 
float movementSpeed = kDefaultMovementSpeed
 
float mouseSensitivity = kDefaultMouseSensitivity
 
float fov = kDefaultFov
 
bool firstMouse = true
 

Static Public Attributes

static constexpr float kDefaultMovementSpeed = 3.0f
 
static constexpr float kDefaultMouseSensitivity = 0.05f
 
static constexpr float kDefaultFov = 45.0f
 
static constexpr float kDefaultNearClip = 0.1f
 
static constexpr float kDefaultFarClip = 300000.0f
 

Detailed Description

Definition at line 13 of file Camera.h.

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( glm::vec3  initPosition)

Definition at line 30 of file Camera.cpp.

Member Function Documentation

◆ clearTarget()

void Camera::clearTarget ( )

Definition at line 112 of file Camera.cpp.

Here is the caller graph for this function:

◆ focusOn()

void Camera::focusOn ( SceneObject obj)

Definition at line 89 of file Camera.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getProjMatrix()

glm::mat4 Camera::getProjMatrix ( ) const

Definition at line 46 of file Camera.cpp.

Here is the caller graph for this function:

◆ getRenderViewMatrix()

glm::mat4 Camera::getRenderViewMatrix ( ) const

Definition at line 42 of file Camera.cpp.

Here is the caller graph for this function:

◆ getTarget()

const SceneObject * Camera::getTarget ( ) const
inline

Definition at line 49 of file Camera.h.

Here is the caller graph for this function:

◆ getViewMatrix()

glm::mat4 Camera::getViewMatrix ( ) const

Definition at line 38 of file Camera.cpp.

Here is the caller graph for this function:

◆ hasTarget()

bool Camera::hasTarget ( ) const
inline

Definition at line 48 of file Camera.h.

Here is the caller graph for this function:

◆ processKeyboard()

void Camera::processKeyboard ( Movement  direction,
float  deltaTime 
)

Definition at line 192 of file Camera.cpp.

Here is the caller graph for this function:

◆ processMouseMovement()

void Camera::processMouseMovement ( float  xoffset,
float  yoffset 
)

Definition at line 134 of file Camera.cpp.

◆ processScroll()

void Camera::processScroll ( float  wheelSteps)

Definition at line 169 of file Camera.cpp.

Here is the call graph for this function:

◆ resetMouse()

void Camera::resetMouse ( )

Definition at line 226 of file Camera.cpp.

Here is the caller graph for this function:

◆ resetView()

void Camera::resetView ( const glm::vec3 &  newPosition = glm::vec3(0.0f, 10.0f, 30.0f))

Definition at line 74 of file Camera.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAspectRatio()

void Camera::setAspectRatio ( float  ratio)
inline

Definition at line 40 of file Camera.h.

◆ setClipRange()

void Camera::setClipRange ( float  nearPlane,
float  farPlane 
)

Definition at line 58 of file Camera.cpp.

Here is the caller graph for this function:

◆ setTarget()

void Camera::setTarget ( SceneObject obj)

Definition at line 78 of file Camera.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setView()

void Camera::setView ( const glm::vec3 &  newPosition,
double  newYaw,
double  newPitch 
)

Definition at line 63 of file Camera.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void Camera::update ( const glm::vec3 *  renderTargetPosition = nullptr)

Definition at line 118 of file Camera.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ firstMouse

bool Camera::firstMouse = true

Definition at line 58 of file Camera.h.

◆ fov

float Camera::fov = kDefaultFov

Definition at line 32 of file Camera.h.

◆ front

glm::vec3 Camera::front

Definition at line 16 of file Camera.h.

◆ kDefaultFarClip

constexpr float Camera::kDefaultFarClip = 300000.0f
staticconstexpr

Definition at line 28 of file Camera.h.

◆ kDefaultFov

constexpr float Camera::kDefaultFov = 45.0f
staticconstexpr

Definition at line 26 of file Camera.h.

◆ kDefaultMouseSensitivity

constexpr float Camera::kDefaultMouseSensitivity = 0.05f
staticconstexpr

Definition at line 25 of file Camera.h.

◆ kDefaultMovementSpeed

constexpr float Camera::kDefaultMovementSpeed = 3.0f
staticconstexpr

Definition at line 24 of file Camera.h.

◆ kDefaultNearClip

constexpr float Camera::kDefaultNearClip = 0.1f
staticconstexpr

Definition at line 27 of file Camera.h.

◆ mouseSensitivity

float Camera::mouseSensitivity = kDefaultMouseSensitivity

Definition at line 31 of file Camera.h.

◆ movementSpeed

float Camera::movementSpeed = kDefaultMovementSpeed

Definition at line 30 of file Camera.h.

◆ pitch

double Camera::pitch = 0.0f

Definition at line 22 of file Camera.h.

◆ position

glm::vec3 Camera::position

Definition at line 15 of file Camera.h.

◆ right

glm::vec3 Camera::right

Definition at line 18 of file Camera.h.

◆ up

glm::vec3 Camera::up

Definition at line 17 of file Camera.h.

◆ worldUp

glm::vec3 Camera::worldUp

Definition at line 19 of file Camera.h.

◆ yaw

double Camera::yaw = -90.0f

Definition at line 21 of file Camera.h.


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