MaterialX 1.39.1
Loading...
Searching...
No Matches
Camera Class Reference

A simple camera class, supporting transform matrices and arcball functionality for object-viewing applications. More...

#include <Camera.h>

Public Member Functions

Transform Matrices
void setWorldMatrix (const Matrix44 &mat)
 Set the world matrix.
 
const Matrix44getWorldMatrix () const
 Return the world matrix.
 
void setViewMatrix (const Matrix44 &mat)
 Set the view matrix.
 
const Matrix44getViewMatrix () const
 Return the view matrix.
 
void setProjectionMatrix (const Matrix44 &mat)
 Set the projection matrix.
 
const Matrix44getProjectionMatrix () const
 Return the projection matrix.
 
Matrix44 getWorldViewProjMatrix () const
 Compute our full model-view-projection matrix.
 
Vector3 getViewPosition () const
 Derive viewer position from the view matrix.
 
Vector3 getViewDirection () const
 Derive viewer direction from the view matrix.
 
Viewport
void setViewportSize (const Vector2 &size)
 Set the size of the viewport window.
 
const Vector2getViewportSize () const
 Return the size of the viewport window.
 
Vector3 projectToViewport (Vector3 v)
 Project a position from object to viewport space.
 
Vector3 unprojectFromViewport (Vector3 v)
 Unproject a position from viewport to object space.
 
Arcball
void arcballButtonEvent (const Vector2 &pos, bool pressed)
 Indicates a button state change, with pos being the instantaneous location of the mouse.
 
bool applyArcballMotion (const Vector2 &pos)
 Apply mouse motion to the arcball state.
 
Matrix44 arcballMatrix () const
 Return the arcball matrix.
 

Static Public Member Functions

static CameraPtr create ()
 Create a new camera.
 
Utilities
static Matrix44 createViewMatrix (const Vector3 &eye, const Vector3 &target, const Vector3 &up)
 Create a view matrix given an eye position, a target position and an up vector.
 
static Matrix44 createPerspectiveMatrix (float left, float right, float bottom, float top, float nearP, float farP)
 Create a perpective projection matrix given a set of clip planes with [-1,1] projected Z.
 
static Matrix44 createOrthographicMatrix (float left, float right, float bottom, float top, float nearP, float farP)
 Create an orthographic projection matrix given a set of clip planes with [-1,1] projected Z.
 
static Matrix44 createPerspectiveMatrixZP (float left, float right, float bottom, float top, float nearP, float farP)
 Create a perpective projection matrix given a set of clip planes with [0,1] projected Z.
 
static Matrix44 createOrthographicMatrixZP (float left, float right, float bottom, float top, float nearP, float farP)
 Create an orthographic projection matrix given a set of clip planes with [0,1] projected Z.
 
static Vector3 transformPointPerspective (const Matrix44 &m, const Vector3 &v)
 Apply a perspective transform to the given 3D point, performing a homogeneous divide on the transformed result.
 

Protected Attributes

Matrix44 _worldMatrix
 
Matrix44 _viewMatrix
 
Matrix44 _projectionMatrix
 
Vector2 _viewportSize
 
bool _arcballActive
 
Vector2 _arcballLastPos
 
Quaternion _arcballQuat
 
Quaternion _arcballDelta
 
float _arcballSpeed
 

Detailed Description

A simple camera class, supporting transform matrices and arcball functionality for object-viewing applications.


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