OpenGL perspective camera supporting Look-At, Yaw/Pitch/Roll, and Ortho modes.
More...
#include <glCamera.h>
|
| ~glCamera () |
| Free the camera. More...
|
|
void | Activate () |
| Activate GL_PROJECTION and GL_MODELVIEW matrices. More...
|
|
void | Activate (CameraMode mode) |
| Activate GL_PROJECTION and GL_MODELVIEW matrices. More...
|
|
void | Deactivate () |
| Restore previous GL_PROJECTION and GL_MODELVIEW matrices. More...
|
|
CameraMode | GetCameraMode () const |
| Get the camera mode. More...
|
|
void | SetCameraMode (CameraMode mode) |
| Set the camera mode. More...
|
|
void | SetFOV (float fov) |
| Set the field of view (FOV), in degrees. More...
|
|
void | SetClippingPlane (float near, float far) |
| Set the near/far z-clipping plane. More...
|
|
void | SetNear (float near) |
| Set the distance to the near clipping plane. More...
|
|
void | SetFar (float far) |
| Set the distance to the far clipping plane. More...
|
|
void | SetEye (float x, float y, float z) |
| Set the eye position. More...
|
|
void | SetLookAt (float x, float y, float z) |
| Set the look-at point. More...
|
|
void | SetRotation (float yaw, float pitch, float roll) |
| Set the yaw/pitch/roll angles, in radians. More...
|
|
void | SetYaw (float yaw) |
| Set the yaw angle, in radians. More...
|
|
void | SetPitch (float pitch) |
| Set the pitch angle, in radians. More...
|
|
void | SetRoll (float roll) |
| Set the roll angle, in radians. More...
|
|
void | SetMovementSpeed (float speed) |
| Set the movement speed (in world units) More...
|
|
void | SetMovementEnabled (bool enabled) |
| Enable or disable movement from user input. More...
|
|
void | StoreDefaults () |
| Store the current configuration as defaults. More...
|
|
void | Reset () |
| Reset camera orientation to defaults. More...
|
|
void | RegisterEvents (uint32_t display=0) |
| Register to recieve input events (enable movement) More...
|
|
OpenGL perspective camera supporting Look-At, Yaw/Pitch/Roll, and Ortho modes.
◆ CameraMode
Enum specifying the camera mode.
Enumerator |
---|
LookAt | LookAt (orbit)
|
YawPitchRoll | YawPitchRoll (first person.
|
Ortho | Ortho (2D)
|
◆ ~glCamera()
◆ Activate() [1/2]
void glCamera::Activate |
( |
| ) |
|
Activate GL_PROJECTION and GL_MODELVIEW matrices.
◆ Activate() [2/2]
Activate GL_PROJECTION and GL_MODELVIEW matrices.
◆ Create() [1/2]
Create OpenGL camera object with the specified CameraMode.
- Parameters
-
registerEvents | the ID of the glDisplay window to register with to recieve input events (for moving the camera around with keyboard/mouse), or -1 to not register for input events. |
◆ Create() [2/2]
static glCamera* glCamera::Create |
( |
int |
registerEvents = 0 | ) |
|
|
static |
Create OpenGL camera object.
- Parameters
-
registerEvents | the ID of the glDisplay window to register with to recieve input events (for moving the camera around with keyboard/mouse), or -1 to not register for input events. |
◆ Deactivate()
void glCamera::Deactivate |
( |
| ) |
|
Restore previous GL_PROJECTION and GL_MODELVIEW matrices.
◆ GetCameraMode()
◆ RegisterEvents()
void glCamera::RegisterEvents |
( |
uint32_t |
display = 0 | ) |
|
Register to recieve input events (enable movement)
◆ Reset()
Reset camera orientation to defaults.
◆ SetCameraMode()
◆ SetClippingPlane()
void glCamera::SetClippingPlane |
( |
float |
near, |
|
|
float |
far |
|
) |
| |
|
inline |
Set the near/far z-clipping plane.
◆ SetEye()
void glCamera::SetEye |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
| |
|
inline |
◆ SetFar()
void glCamera::SetFar |
( |
float |
far | ) |
|
|
inline |
Set the distance to the far clipping plane.
◆ SetFOV()
void glCamera::SetFOV |
( |
float |
fov | ) |
|
|
inline |
Set the field of view (FOV), in degrees.
◆ SetLookAt()
void glCamera::SetLookAt |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
| |
|
inline |
◆ SetMovementEnabled()
void glCamera::SetMovementEnabled |
( |
bool |
enabled | ) |
|
|
inline |
Enable or disable movement from user input.
◆ SetMovementSpeed()
void glCamera::SetMovementSpeed |
( |
float |
speed | ) |
|
|
inline |
Set the movement speed (in world units)
◆ SetNear()
void glCamera::SetNear |
( |
float |
near | ) |
|
|
inline |
Set the distance to the near clipping plane.
◆ SetPitch()
void glCamera::SetPitch |
( |
float |
pitch | ) |
|
|
inline |
Set the pitch angle, in radians.
◆ SetRoll()
void glCamera::SetRoll |
( |
float |
roll | ) |
|
|
inline |
Set the roll angle, in radians.
◆ SetRotation()
void glCamera::SetRotation |
( |
float |
yaw, |
|
|
float |
pitch, |
|
|
float |
roll |
|
) |
| |
|
inline |
Set the yaw/pitch/roll angles, in radians.
◆ SetYaw()
void glCamera::SetYaw |
( |
float |
yaw | ) |
|
|
inline |
Set the yaw angle, in radians.
◆ StoreDefaults()
void glCamera::StoreDefaults |
( |
| ) |
|
Store the current configuration as defaults.
The documentation for this class was generated from the following file: