WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
OrbitCamera Class Reference

Orbit camera that revolves around a target point. More...

#include <OrbitCamera.h>

Public Member Functions

 OrbitCamera ()
 
glm::mat4 getViewMatrix () const
 Compute the current view matrix from yaw, pitch, and radius.
 
void reset ()
 Reset all parameters to defaults.
 
void resetFromBounds (float zMin, float zMax, float fovDegrees)
 Reset the camera to frame a model whose bounding box spans [zMin, zMax].
 
void setPosition (const glm::vec3 &position)
 Set the camera world position directly.
 
glm::vec3 position () const
 Current camera world position.
 
glm::vec3 right () const
 Camera right vector (perpendicular to view direction and up).
 
void setYaw (float yaw)
 Set the yaw angle (horizontal rotation around the target).
 
void setPitch (float pitch)
 Set the pitch angle (vertical elevation).
 
void setYawAndPitch (float yaw, float pitch)
 Set both yaw and pitch simultaneously.
 
float yaw () const
 Current yaw angle in radians.
 
float pitch () const
 Current pitch angle in radians.
 
void setLookAt (const glm::vec3 &target)
 Set the point the camera orbits around.
 
glm::vec3 lookAt () const
 Current orbit target position.
 
void setRadius (float radius)
 Set the distance from the camera to the target.
 
float radius () const
 Current orbit radius (distance to target).
 

Private Member Functions

void updatePosition ()
 

Private Attributes

glm::vec3 pos_
 
glm::vec3 target_
 
glm::vec3 up_
 
glm::vec3 right_
 
float yaw_
 
float pitch_
 
float radius_
 

Detailed Description

Orbit camera that revolves around a target point.

Controlled by yaw, pitch, and radius parameters. The view matrix is recomputed from these each time getViewMatrix() is called.

Definition at line 9 of file OrbitCamera.h.

Constructor & Destructor Documentation

◆ OrbitCamera()

OrbitCamera::OrbitCamera ( )

Definition at line 10 of file OrbitCamera.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ getViewMatrix()

glm::mat4 OrbitCamera::getViewMatrix ( ) const

Compute the current view matrix from yaw, pitch, and radius.

Definition at line 22 of file OrbitCamera.cpp.

Here is the caller graph for this function:

◆ lookAt()

glm::vec3 OrbitCamera::lookAt ( ) const
inline

Current orbit target position.

Definition at line 54 of file OrbitCamera.h.

Here is the caller graph for this function:

◆ pitch()

float OrbitCamera::pitch ( ) const
inline

Current pitch angle in radians.

Definition at line 48 of file OrbitCamera.h.

Here is the caller graph for this function:

◆ position()

glm::vec3 OrbitCamera::position ( ) const
inline

Current camera world position.

Definition at line 30 of file OrbitCamera.h.

Here is the caller graph for this function:

◆ radius()

float OrbitCamera::radius ( ) const
inline

Current orbit radius (distance to target).

Definition at line 60 of file OrbitCamera.h.

Here is the caller graph for this function:

◆ reset()

void OrbitCamera::reset ( )

Reset all parameters to defaults.

Definition at line 27 of file OrbitCamera.cpp.

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

◆ resetFromBounds()

void OrbitCamera::resetFromBounds ( float  zMin,
float  zMax,
float  fovDegrees 
)

Reset the camera to frame a model whose bounding box spans [zMin, zMax].

Parameters
zMinMinimum Z of the bounding box.
zMaxMaximum Z of the bounding box.
fovDegreesVertical field-of-view in degrees.

Definition at line 38 of file OrbitCamera.cpp.

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

◆ right()

glm::vec3 OrbitCamera::right ( ) const
inline

Camera right vector (perpendicular to view direction and up).

Definition at line 33 of file OrbitCamera.h.

Here is the caller graph for this function:

◆ setLookAt()

void OrbitCamera::setLookAt ( const glm::vec3 &  target)

Set the point the camera orbits around.

Definition at line 51 of file OrbitCamera.cpp.

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

◆ setPitch()

void OrbitCamera::setPitch ( float  pitch)

Set the pitch angle (vertical elevation).

Definition at line 88 of file OrbitCamera.cpp.

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

◆ setPosition()

void OrbitCamera::setPosition ( const glm::vec3 &  position)

Set the camera world position directly.

Definition at line 63 of file OrbitCamera.cpp.

Here is the call graph for this function:

◆ setRadius()

void OrbitCamera::setRadius ( float  radius)

Set the distance from the camera to the target.

Definition at line 57 of file OrbitCamera.cpp.

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

◆ setYaw()

void OrbitCamera::setYaw ( float  yaw)

Set the yaw angle (horizontal rotation around the target).

Definition at line 82 of file OrbitCamera.cpp.

Here is the call graph for this function:

◆ setYawAndPitch()

void OrbitCamera::setYawAndPitch ( float  yaw,
float  pitch 
)

Set both yaw and pitch simultaneously.

Definition at line 68 of file OrbitCamera.cpp.

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

◆ updatePosition()

void OrbitCamera::updatePosition ( )
private

Definition at line 94 of file OrbitCamera.cpp.

Here is the caller graph for this function:

◆ yaw()

float OrbitCamera::yaw ( ) const
inline

Current yaw angle in radians.

Definition at line 45 of file OrbitCamera.h.

Here is the caller graph for this function:

Member Data Documentation

◆ pitch_

float OrbitCamera::pitch_
private

Definition at line 71 of file OrbitCamera.h.

◆ pos_

glm::vec3 OrbitCamera::pos_
private

Definition at line 65 of file OrbitCamera.h.

◆ radius_

float OrbitCamera::radius_
private

Definition at line 72 of file OrbitCamera.h.

◆ right_

glm::vec3 OrbitCamera::right_
private

Definition at line 68 of file OrbitCamera.h.

◆ target_

glm::vec3 OrbitCamera::target_
private

Definition at line 66 of file OrbitCamera.h.

◆ up_

glm::vec3 OrbitCamera::up_
private

Definition at line 67 of file OrbitCamera.h.

◆ yaw_

float OrbitCamera::yaw_
private

Definition at line 70 of file OrbitCamera.h.


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