![]() |
Cinder
0.9.1
|
#include <Camera.h>
Inherited by cinder::CameraOrtho, and cinder::CameraPersp.
Public Member Functions | |
virtual | ~Camera () |
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) |
virtual void | getNearClipCoordinates (vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight) const |
virtual void | getFarClipCoordinates (vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight) const |
void | getFrustum (float *left, float *top, float *right, float *bottom, float *near, float *far) const |
virtual bool | isPersp () const =0 |
virtual const mat4 & | getProjectionMatrix () const |
virtual const mat4 & | getViewMatrix () const |
virtual const mat4 & | getInverseViewMatrix () 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 | |
Camera () | |
void | calcMatrices () const |
virtual void | calcViewMatrix () const |
virtual void | calcInverseView () const |
virtual void | calcProjection () const =0 |
virtual Ray | calcRay (float u, float v, float imagePlaneAspectRatio) const |
Protected Attributes | |
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 |
Base Camera class, which manages the projection and view matrices for a 3-dimensional scene, as well as providing mapping functionality.
|
virtual |
|
protected |
vec3 cinder::Camera::getEyePoint | ( | ) | const |
Returns the position in world-space from which the Camera is viewing.
void cinder::Camera::setEyePoint | ( | const vec3 & | eyePoint | ) |
Sets the position in world-space from which the Camera is viewing.
vec3 cinder::Camera::getWorldUp | ( | ) | const |
Returns the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )
void cinder::Camera::setWorldUp | ( | const vec3 & | worldUp | ) |
Sets the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )
void cinder::Camera::lookAt | ( | const vec3 & | target | ) |
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 | ||
) |
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 | ||
) |
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 |
Returns the world-space vector along which the camera is oriented.
void cinder::Camera::setViewDirection | ( | const vec3 & | viewDirection | ) |
Sets the world-space vector along which the camera is oriented.
quat cinder::Camera::getOrientation | ( | ) | const |
Returns the world-space quaternion that expresses the camera's orientation.
void cinder::Camera::setOrientation | ( | const quat & | orientation | ) |
Sets the camera's orientation with world-space quaternion orientation.
float cinder::Camera::getFov | ( | ) | const |
Returns the camera's vertical field of view measured in degrees.
void cinder::Camera::setFov | ( | float | verticalFov | ) |
Sets the camera's vertical field of view measured in degrees.
float cinder::Camera::getFovHorizontal | ( | ) | const |
Returns the camera's horizontal field of view measured in degrees.
void cinder::Camera::setFovHorizontal | ( | float | horizontalFov | ) |
Sets the camera's horizontal field of view measured in degrees.
float cinder::Camera::getFocalLength | ( | ) | const |
Returns the camera's focal length, calculating it based on the field of view.
float cinder::Camera::getPivotDistance | ( | ) | const |
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 | ) |
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 |
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 |
Returns the aspect ratio of the image plane - its width divided by its height.
void cinder::Camera::setAspectRatio | ( | float | aAspectRatio | ) |
Sets the aspect ratio of the image plane - its width divided by its height.
float cinder::Camera::getNearClip | ( | ) | const |
Returns the distance along the view direction to the Near clipping plane.
void cinder::Camera::setNearClip | ( | float | nearClip | ) |
Sets the distance along the view direction to the Near clipping plane.
float cinder::Camera::getFarClip | ( | ) | const |
Returns the distance along the view direction to the Far clipping plane.
void cinder::Camera::setFarClip | ( | float | farClip | ) |
Sets the distance along the view direction to the Far clipping plane.
|
virtual |
Returns the four corners of the Camera's Near clipping plane, expressed in world-space.
Reimplemented in cinder::CameraStereo.
|
virtual |
Returns the four corners of the Camera's Far clipping plane, expressed in world-space.
Reimplemented in cinder::CameraStereo.
void cinder::Camera::getFrustum | ( | float * | left, |
float * | top, | ||
float * | right, | ||
float * | bottom, | ||
float * | near, | ||
float * | far | ||
) | const |
Returns the coordinates of the camera's frustum, suitable for passing to glFrustum
.
|
pure virtual |
Returns whether the camera represents a perspective projection instead of an orthographic.
Implemented in cinder::CameraOrtho, and cinder::CameraPersp.
|
virtual |
Returns the Camera's Projection matrix, which converts view-space into clip-space.
Reimplemented in cinder::CameraStereo.
|
virtual |
Returns the Camera's View matrix, which converts world-space into view-space.
Reimplemented in cinder::CameraStereo.
|
virtual |
Returns the Camera's Inverse View matrix, which converts view-space into world-space.
Reimplemented in cinder::CameraStereo.
Ray cinder::Camera::generateRay | ( | float | u, |
float | v, | ||
float | imagePlaneAspectRatio | ||
) | const |
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 |
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 |
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 |
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 |
Converts a eye-space coordinate eyeCoord to screen coordinates as viewed by the camera.
vec3 cinder::Camera::worldToEye | ( | const vec3 & | worldCoord | ) | const |
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 |
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 |
Converts a world-space coordinate worldCoord to normalized device coordinates.
float cinder::Camera::calcScreenArea | ( | const Sphere & | sphere, |
const vec2 & | screenSizePixels | ||
) | const |
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 |
Calculates the screen-space elliptical projection of sphere, putting the results in outCenter, outAxisA and outAxisB.
|
protected |
|
protectedvirtual |
Reimplemented in cinder::CameraStereo.
|
protectedvirtual |
Reimplemented in cinder::CameraStereo.
|
protectedpure virtual |
Implemented in cinder::CameraStereo, cinder::CameraOrtho, and cinder::CameraPersp.
|
protectedvirtual |
Reimplemented in cinder::CameraPersp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |