KrisLibrary  1.0.0
Public Member Functions | Public Attributes | List of all members
Camera::Viewport Class Reference

A class containing viewport / camera information. This uses OpenGL coordinate convention in which x is to the right of the image, y is upward in the image, and z is backward. More...

#include <viewport.h>

Inheritance diagram for Camera::Viewport:
Camera::Camera

Public Member Functions

void setPerspective (bool enabled)
 Sets the viewport as a perspective or orthographic viewport.
 
void setLensAngle (float rads)
 Sets the absolute field of view in the width direction (deprecated name)
 
void setFOV (float rads)
 Sets the absolute field of view in the width direction.
 
float getFOV () const
 Returns the absolute field of view in the width direction.
 
float getHFOV () const
 Returns the absolute field of view in the height direction.
 
bool clicked (int mx, int my) const
 Returns true if the point (mx,my) is within the viewport.
 
void zoom (float s)
 Multiplies the camera's zoom by the factor s.
 
void scroll (float x, float y, float z=0)
 
void getViewVector (Vector3 &) const
 Returns the forward direction in world coordinates.
 
void getMovementVector (float dx, float dy, Vector3 &) const
 
void getMovementVectorAtDistance (float dx, float dy, float dist, Vector3 &) const
 
void getClickVector (float mx, float my, Vector3 &) const
 
void getClickSource (float mx, float my, Vector3 &) const
 
bool project (const Vector3 &pt, float &mx, float &my, float &mz) const
 
- Public Member Functions inherited from Camera::Camera
const Real * xDir () const
 
const Real * yDir () const
 
const Real * zDir () const
 
const Vector3position () const
 
void setFree (const Vector3 &pos, const Vector3 &rot, Orientation o=XYZ)
 
void setTarget (const Vector3 &pos, const Vector3 &tgt, const Vector3 &up)
 
void setOrbit (const Vector3 &rot, const Vector3 &target, Real dist, Orientation o=XYZ)
 
void setCameraMatrix (const Matrix4 &)
 
void getCameraMatrix (Matrix4 &) const
 
void getFree (Vector3 &pos, Vector3 &rot, Orientation o=XYZ) const
 
void getTarget (Vector3 &pos, Vector3 &tgt, Vector3 &up, Real tgtdist=One) const
 
void getOrbit (Vector3 &rot, Vector3 &target, Real tgtdist=One, Orientation o=XYZ) const
 

Public Attributes

bool perspective
 
float scale
 
int x
 
int y
 
int w
 
int h
 
float n
 
float f
 
- Public Attributes inherited from Camera::Camera
RigidTransform xform
 

Additional Inherited Members

- Public Types inherited from Camera::Camera
enum  Orientation { XYZ, XYnZ, XZY, XZnY }
 
- Static Public Member Functions inherited from Camera::Camera
static void GetOrientationMatrix (Orientation o, Matrix3 &mat)
 
static void Orient (Orientation o, Matrix3 &mat)
 
static void Unorient (Orientation o, Matrix3 &mat)
 

Detailed Description

A class containing viewport / camera information. This uses OpenGL coordinate convention in which x is to the right of the image, y is upward in the image, and z is backward.

Member Function Documentation

void Camera::Viewport::getClickVector ( float  mx,
float  my,
Vector3 v 
) const

find the point/direction on the image plane corresponding to a screen space point

Referenced by setLensAngle().

void Camera::Viewport::getMovementVector ( float  dx,
float  dy,
Vector3 v 
) const

Returns a screen-parallel world-space vector for a screen-space displacement of dx,dy

Referenced by setLensAngle().

void Camera::Viewport::getMovementVectorAtDistance ( float  dx,
float  dy,
float  dist,
Vector3 v 
) const

Returns a screen-parallel world-space vector that displaces a point at distance dist by dx in the screen's x direction and dy in the y direction

Referenced by setLensAngle().

bool Camera::Viewport::project ( const Vector3 pt,
float &  mx,
float &  my,
float &  mz 
) const

Computes the screen coordinates of a point pt in world space. Returns true if the point is within the view frustum.

Referenced by setLensAngle().

void Camera::Viewport::scroll ( float  x,
float  y,
float  z = 0 
)

Scrolls the viewport by the vector x,y in a screen-parallel local camera frame.

Referenced by setLensAngle().


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