Cinder  0.9.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cinder::CameraStereo Class Reference

#include <Camera.h>

Inherits cinder::CameraPersp.

Public Member Functions

 CameraStereo ()
 
 CameraStereo (int pixelWidth, int pixelHeight, float fov)
 
 CameraStereo (int pixelWidth, int pixelHeight, float fov, float nearPlane, float farPlane)
 
float getConvergence () const
 
void setConvergence (float distance, bool adjustEyeSeparation=false)
 
float getEyeSeparation () const
 
void setEyeSeparation (float distance)
 
vec3 getEyePointShifted () const
 
void enableStereoLeft ()
 
bool isStereoLeftEnabled () const
 
void enableStereoRight ()
 
bool isStereoRightEnabled () const
 
void disableStereo ()
 
bool isStereoEnabled () const
 
void getNearClipCoordinates (vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight) const override
 
void getFarClipCoordinates (vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight) const override
 
const mat4 & getProjectionMatrix () const override
 
const mat4 & getViewMatrix () const override
 
const mat4 & getInverseViewMatrix () const override
 
void setPerspective (float verticalFovDegrees, float aspectRatio, float nearPlane, float farPlane)
 
void getLensShift (float *horizontal, float *vertical) const
 
vec2 getLensShift () const
 
void setLensShift (float horizontal, float vertical)
 
void setLensShift (const vec2 &shift)
 
float getLensShiftHorizontal () const
 
void setLensShiftHorizontal (float horizontal)
 
float getLensShiftVertical () const
 
void setLensShiftVertical (float vertical)
 
bool isPersp () const override
 
CameraPersp calcFraming (const Sphere &worldSpaceSphere) const
 
vec3 getEyePoint () const
 
void setEyePoint (const vec3 &eyePoint)
 
vec3 getWorldUp () const
 
void setWorldUp (const vec3 &worldUp)
 
void lookAt (const vec3 &target)
 
void lookAt (const vec3 &eyePoint, const vec3 &target)
 
void lookAt (const vec3 &eyePoint, const vec3 &target, const vec3 &up)
 
vec3 getViewDirection () const
 
void setViewDirection (const vec3 &viewDirection)
 
quat getOrientation () const
 
void setOrientation (const quat &orientation)
 
float getFov () const
 
void setFov (float verticalFov)
 
float getFovHorizontal () const
 
void setFovHorizontal (float horizontalFov)
 
float getFocalLength () const
 
float getPivotDistance () const
 
void setPivotDistance (float distance)
 
vec3 getPivotPoint () const
 
float getAspectRatio () const
 
void setAspectRatio (float aAspectRatio)
 
float getNearClip () const
 
void setNearClip (float nearClip)
 
float getFarClip () const
 
void setFarClip (float farClip)
 
void getFrustum (float *left, float *top, float *right, float *bottom, float *near, float *far) const
 
Ray generateRay (float u, float v, float imagePlaneAspectRatio) const
 
Ray generateRay (const vec2 &posPixels, const vec2 &imageSizePixels) const
 
void getBillboardVectors (vec3 *right, vec3 *up) const
 
vec2 worldToScreen (const vec3 &worldCoord, float screenWidth, float screenHeight) const
 
vec2 eyeToScreen (const vec3 &eyeCoord, const vec2 &screenSizePixels) const
 
vec3 worldToEye (const vec3 &worldCoord) const
 
float worldToEyeDepth (const vec3 &worldCoord) const
 
vec3 worldToNdc (const vec3 &worldCoord) const
 
float calcScreenArea (const Sphere &sphere, const vec2 &screenSizePixels) const
 
void calcScreenProjection (const Sphere &sphere, const vec2 &screenSizePixels, vec2 *outCenter, vec2 *outAxisA, vec2 *outAxisB) const
 

Protected Member Functions

void calcViewMatrix () const override
 
void calcInverseView () const override
 
void calcProjection () const override
 
Ray calcRay (float u, float v, float imagePlaneAspectRatio) const override
 
void calcMatrices () const
 

Protected Attributes

mat4 mProjectionMatrixLeft
 
mat4 mInverseProjectionMatrixLeft
 
mat4 mProjectionMatrixRight
 
mat4 mInverseProjectionMatrixRight
 
mat4 mViewMatrixLeft
 
mat4 mInverseModelViewMatrixLeft
 
mat4 mViewMatrixRight
 
mat4 mInverseModelViewMatrixRight
 
vec2 mLensShift
 
vec3 mEyePoint
 
vec3 mViewDirection
 
quat mOrientation
 
vec3 mWorldUp
 
float mFov
 
float mAspectRatio
 
float mNearClip
 
float mFarClip
 
float mPivotDistance
 
vec3 mU
 
vec3 mV
 
vec3 mW
 
mat4 mProjectionMatrix
 
mat4 mInverseProjectionMatrix
 
bool mProjectionCached
 
mat4 mViewMatrix
 
bool mModelViewCached
 
mat4 mInverseModelViewMatrix
 
bool mInverseModelViewCached
 
float mFrustumLeft
 
float mFrustumRight
 
float mFrustumTop
 
float mFrustumBottom
 

Detailed Description

A Camera used for stereoscopic displays.

Constructor & Destructor Documentation

cinder::CameraStereo::CameraStereo ( )
cinder::CameraStereo::CameraStereo ( int  pixelWidth,
int  pixelHeight,
float  fov 
)
cinder::CameraStereo::CameraStereo ( int  pixelWidth,
int  pixelHeight,
float  fov,
float  nearPlane,
float  farPlane 
)

Member Function Documentation

float cinder::CameraStereo::getConvergence ( ) const

Returns the current convergence, which is the distance at which there is no parallax.

void cinder::CameraStereo::setConvergence ( float  distance,
bool  adjustEyeSeparation = false 
)

Sets the convergence of the camera, which is the distance at which there is no parallax.

float cinder::CameraStereo::getEyeSeparation ( ) const

Returns the distance between the camera's for the left and right eyes.

void cinder::CameraStereo::setEyeSeparation ( float  distance)

Sets the distance between the camera's for the left and right eyes. This affects the parallax effect.

vec3 cinder::CameraStereo::getEyePointShifted ( ) const

Returns the location of the currently enabled eye camera.

void cinder::CameraStereo::enableStereoLeft ( )

Enables the left eye camera.

bool cinder::CameraStereo::isStereoLeftEnabled ( ) const

Returns whether the left eye camera is enabled.

void cinder::CameraStereo::enableStereoRight ( )

Enables the right eye camera.

bool cinder::CameraStereo::isStereoRightEnabled ( ) const

Returns whether the right eye camera is enabled.

void cinder::CameraStereo::disableStereo ( )

Disables stereoscopic rendering, converting the camera to a standard CameraPersp.

bool cinder::CameraStereo::isStereoEnabled ( ) const

Returns whether stereoscopic rendering is enabled.

void cinder::CameraStereo::getNearClipCoordinates ( vec3 *  topLeft,
vec3 *  topRight,
vec3 *  bottomLeft,
vec3 *  bottomRight 
) const
overridevirtual

Returns the four corners of the Camera's Near clipping plane, expressed in world-space.

Reimplemented from cinder::Camera.

void cinder::CameraStereo::getFarClipCoordinates ( vec3 *  topLeft,
vec3 *  topRight,
vec3 *  bottomLeft,
vec3 *  bottomRight 
) const
overridevirtual

Returns the four corners of the Camera's Far clipping plane, expressed in world-space.

Reimplemented from cinder::Camera.

const mat4 & cinder::CameraStereo::getProjectionMatrix ( ) const
overridevirtual

Returns the Camera's Projection matrix, which converts view-space into clip-space.

Reimplemented from cinder::Camera.

const mat4 & cinder::CameraStereo::getViewMatrix ( ) const
overridevirtual

Returns the Camera's View matrix, which converts world-space into view-space.

Reimplemented from cinder::Camera.

const mat4 & cinder::CameraStereo::getInverseViewMatrix ( ) const
overridevirtual

Returns the Camera's Inverse View matrix, which converts view-space into world-space.

Reimplemented from cinder::Camera.

void cinder::CameraStereo::calcViewMatrix ( ) const
overrideprotectedvirtual

Reimplemented from cinder::Camera.

void cinder::CameraStereo::calcInverseView ( ) const
overrideprotectedvirtual

Reimplemented from cinder::Camera.

void cinder::CameraStereo::calcProjection ( ) const
overrideprotectedvirtual

Reimplemented from cinder::CameraPersp.

void cinder::CameraPersp::setPerspective ( float  verticalFovDegrees,
float  aspectRatio,
float  nearPlane,
float  farPlane 
)
inherited

Configures the camera's projection according to the provided parameters.

void cinder::CameraPersp::getLensShift ( float *  horizontal,
float *  vertical 
) const
inherited

Returns both the horizontal and vertical lens shift. A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport. A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport.

vec2 cinder::CameraPersp::getLensShift ( ) const
inherited

Returns both the horizontal and vertical lens shift. A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport. A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport.

void cinder::CameraPersp::setLensShift ( float  horizontal,
float  vertical 
)
inherited

Sets both the horizontal and vertical lens shift. A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport. A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport.

void cinder::CameraPersp::setLensShift ( const vec2 &  shift)
inherited

Sets both the horizontal and vertical lens shift. A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport. A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport.

float cinder::CameraPersp::getLensShiftHorizontal ( ) const
inherited

Returns the horizontal lens shift. A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport.

void cinder::CameraPersp::setLensShiftHorizontal ( float  horizontal)
inherited

Sets the horizontal lens shift. A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport.

float cinder::CameraPersp::getLensShiftVertical ( ) const
inherited

Returns the vertical lens shift. A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport.

void cinder::CameraPersp::setLensShiftVertical ( float  vertical)
inherited

Sets the vertical lens shift. A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport.

bool cinder::CameraPersp::isPersp ( ) const
overridevirtualinherited

Returns whether the camera represents a perspective projection instead of an orthographic.

Implements cinder::Camera.

CameraPersp cinder::CameraPersp::calcFraming ( const Sphere worldSpaceSphere) const
inherited

Returns a Camera whose eyePoint is positioned to exactly frame worldSpaceSphere but is equivalent in other parameters (including orientation). Sets the result's pivotDistance to be the distance to worldSpaceSphere's center.

Ray cinder::CameraPersp::calcRay ( float  u,
float  v,
float  imagePlaneAspectRatio 
) const
overrideprotectedvirtualinherited

Reimplemented from cinder::Camera.

vec3 cinder::Camera::getEyePoint ( ) const
inherited

Returns the position in world-space from which the Camera is viewing.

void cinder::Camera::setEyePoint ( const vec3 &  eyePoint)
inherited

Sets the position in world-space from which the Camera is viewing.

vec3 cinder::Camera::getWorldUp ( ) const
inherited

Returns the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )

void cinder::Camera::setWorldUp ( const vec3 &  worldUp)
inherited

Sets the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )

void cinder::Camera::lookAt ( const vec3 &  target)
inherited

Modifies the view direction to look from the current eyePoint to target. Also updates the pivot distance.

void cinder::Camera::lookAt ( const vec3 &  eyePoint,
const vec3 &  target 
)
inherited

Modifies the eyePoint and view direction to look from eyePoint to target. Also updates the pivot distance.

void cinder::Camera::lookAt ( const vec3 &  eyePoint,
const vec3 &  target,
const vec3 &  up 
)
inherited

Modifies the eyePoint and view direction to look from eyePoint to target with up vector up (to achieve camera roll). Also updates the pivot distance.

vec3 cinder::Camera::getViewDirection ( ) const
inherited

Returns the world-space vector along which the camera is oriented.

void cinder::Camera::setViewDirection ( const vec3 &  viewDirection)
inherited

Sets the world-space vector along which the camera is oriented.

quat cinder::Camera::getOrientation ( ) const
inherited

Returns the world-space quaternion that expresses the camera's orientation.

void cinder::Camera::setOrientation ( const quat &  orientation)
inherited

Sets the camera's orientation with world-space quaternion orientation.

float cinder::Camera::getFov ( ) const
inherited

Returns the camera's vertical field of view measured in degrees.

void cinder::Camera::setFov ( float  verticalFov)
inherited

Sets the camera's vertical field of view measured in degrees.

float cinder::Camera::getFovHorizontal ( ) const
inherited

Returns the camera's horizontal field of view measured in degrees.

void cinder::Camera::setFovHorizontal ( float  horizontalFov)
inherited

Sets the camera's horizontal field of view measured in degrees.

float cinder::Camera::getFocalLength ( ) const
inherited

Returns the camera's focal length, calculating it based on the field of view.

float cinder::Camera::getPivotDistance ( ) const
inherited

Primarily for user interaction, such as with CameraUi. Returns the distance from the camera along the view direction relative to which tumbling and dollying occur.

void cinder::Camera::setPivotDistance ( float  distance)
inherited

Primarily for user interaction, such as with CameraUi. Sets the distance from the camera along the view direction relative to which tumbling and dollying occur.

vec3 cinder::Camera::getPivotPoint ( ) const
inherited

Primarily for user interaction, such as with CameraUi. Returns the world-space point relative to which tumbling and dollying occur.

float cinder::Camera::getAspectRatio ( ) const
inherited

Returns the aspect ratio of the image plane - its width divided by its height.

void cinder::Camera::setAspectRatio ( float  aAspectRatio)
inherited

Sets the aspect ratio of the image plane - its width divided by its height.

float cinder::Camera::getNearClip ( ) const
inherited

Returns the distance along the view direction to the Near clipping plane.

void cinder::Camera::setNearClip ( float  nearClip)
inherited

Sets the distance along the view direction to the Near clipping plane.

float cinder::Camera::getFarClip ( ) const
inherited

Returns the distance along the view direction to the Far clipping plane.

void cinder::Camera::setFarClip ( float  farClip)
inherited

Sets the distance along the view direction to the Far clipping plane.

void cinder::Camera::getFrustum ( float *  left,
float *  top,
float *  right,
float *  bottom,
float *  near,
float *  far 
) const
inherited

Returns the coordinates of the camera's frustum, suitable for passing to glFrustum.

Ray cinder::Camera::generateRay ( float  u,
float  v,
float  imagePlaneAspectRatio 
) const
inherited

Returns a Ray that passes through the image plane coordinates (u, v) (expressed in the range [0,1]) on an image plane of aspect ratio imagePlaneAspectRatio.

Ray cinder::Camera::generateRay ( const vec2 &  posPixels,
const vec2 &  imageSizePixels 
) const
inherited

Returns a Ray that passes through the pixels coordinates posPixels on an image of size imageSizePixels.

void cinder::Camera::getBillboardVectors ( vec3 *  right,
vec3 *  up 
) const
inherited

Returns the right and up vectors suitable for billboarding relative to the Camera.

vec2 cinder::Camera::worldToScreen ( const vec3 &  worldCoord,
float  screenWidth,
float  screenHeight 
) const
inherited

Converts a world-space coordinate worldCoord to screen coordinates as viewed by the camera, based on a screen which is screenWidth x screenHeight pixels.

vec2 cinder::Camera::eyeToScreen ( const vec3 &  eyeCoord,
const vec2 &  screenSizePixels 
) const
inherited

Converts a eye-space coordinate eyeCoord to screen coordinates as viewed by the camera.

vec3 cinder::Camera::worldToEye ( const vec3 &  worldCoord) const
inherited

Converts a world-space coordinate worldCoord to eye-space, also known as camera-space. -Z is along the view direction.

float cinder::Camera::worldToEyeDepth ( const vec3 &  worldCoord) const
inherited

Converts a world-space coordinate worldCoord to the z axis of eye-space, also known as camera-space. -Z is along the view direction. Suitable for depth sorting.

vec3 cinder::Camera::worldToNdc ( const vec3 &  worldCoord) const
inherited

Converts a world-space coordinate worldCoord to normalized device coordinates.

float cinder::Camera::calcScreenArea ( const Sphere sphere,
const vec2 &  screenSizePixels 
) const
inherited

Calculates the area of the screen-space elliptical projection of sphere.

void cinder::Camera::calcScreenProjection ( const Sphere sphere,
const vec2 &  screenSizePixels,
vec2 *  outCenter,
vec2 *  outAxisA,
vec2 *  outAxisB 
) const
inherited

Calculates the screen-space elliptical projection of sphere, putting the results in outCenter, outAxisA and outAxisB.

void cinder::Camera::calcMatrices ( ) const
protectedinherited

Member Data Documentation

mat4 cinder::CameraStereo::mProjectionMatrixLeft
mutableprotected
mat4 cinder::CameraStereo::mInverseProjectionMatrixLeft
mutableprotected
mat4 cinder::CameraStereo::mProjectionMatrixRight
mutableprotected
mat4 cinder::CameraStereo::mInverseProjectionMatrixRight
mutableprotected
mat4 cinder::CameraStereo::mViewMatrixLeft
mutableprotected
mat4 cinder::CameraStereo::mInverseModelViewMatrixLeft
mutableprotected
mat4 cinder::CameraStereo::mViewMatrixRight
mutableprotected
mat4 cinder::CameraStereo::mInverseModelViewMatrixRight
mutableprotected
vec2 cinder::CameraPersp::mLensShift
protectedinherited
vec3 cinder::Camera::mEyePoint
protectedinherited
vec3 cinder::Camera::mViewDirection
protectedinherited
quat cinder::Camera::mOrientation
protectedinherited
vec3 cinder::Camera::mWorldUp
protectedinherited
float cinder::Camera::mFov
protectedinherited
float cinder::Camera::mAspectRatio
protectedinherited
float cinder::Camera::mNearClip
protectedinherited
float cinder::Camera::mFarClip
protectedinherited
float cinder::Camera::mPivotDistance
protectedinherited
vec3 cinder::Camera::mU
mutableprotectedinherited
vec3 cinder::Camera::mV
mutableprotectedinherited
vec3 cinder::Camera::mW
mutableprotectedinherited
mat4 cinder::Camera::mProjectionMatrix
mutableprotectedinherited
mat4 cinder::Camera::mInverseProjectionMatrix
mutableprotectedinherited
bool cinder::Camera::mProjectionCached
mutableprotectedinherited
mat4 cinder::Camera::mViewMatrix
mutableprotectedinherited
bool cinder::Camera::mModelViewCached
mutableprotectedinherited
mat4 cinder::Camera::mInverseModelViewMatrix
mutableprotectedinherited
bool cinder::Camera::mInverseModelViewCached
mutableprotectedinherited
float cinder::Camera::mFrustumLeft
mutableprotectedinherited
float cinder::Camera::mFrustumRight
mutableprotectedinherited
float cinder::Camera::mFrustumTop
mutableprotectedinherited
float cinder::Camera::mFrustumBottom
mutableprotectedinherited

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