- cinder::Camera
- cinder::CameraPersp
A perspective Camera .
Public Member Functions
-
CameraPersp ()
Creates a default camera with eyePoint at ( 28, 21, 28 ), looking at the origin, 35deg vertical field-of-view and a 1.333 aspect ratio.
-
CameraPersp (int pixelWidth, int pixelHeight, float fov)
Constructs screen-aligned camera.
-
CameraPersp (int pixelWidth, int pixelHeight, float fov, float nearPlane, float farPlane)
Constructs screen-aligned camera.
-
voidsetPerspective (float verticalFovDegrees, float aspectRatio, float nearPlane, float farPlane)
Configures the camera's projection according to the provided parameters.
-
voidgetLensShift (float *horizontal, float *vertical) const
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.
-
vec2getLensShift () const
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.
-
voidsetLensShift (float horizontal, float vertical)
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.
-
voidsetLensShift (const vec2 &shift)
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.
-
floatgetLensShiftHorizontal () const
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.
-
voidsetLensShiftHorizontal (float horizontal)
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.
-
floatgetLensShiftVertical () const
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.
-
voidsetLensShiftVertical (float vertical)
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.
-
boolisPersp () const override
Returns whether the camera represents a perspective projection instead of an orthographic.
-
calcFraming (const Sphere &worldSpaceSphere) const
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.
-
subdivide (const glm::uvec2 &gridSize, const glm::uvec2 &gridIndex) const
Returns a subdivided portion of this camera's view frustrum as a new CameraPersp ; useful for multi-gpu or tiled-rendering for instance.
-
vec3getEyePoint () const
Returns the position in world-space from which the Camera is viewing.
-
voidsetEyePoint (const vec3 &eyePoint)
Sets the position in world-space from which the Camera is viewing.
-
vec3getWorldUp () const
Returns the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )
-
voidsetWorldUp (const vec3 &worldUp)
Sets the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )
-
voidlookAt (const vec3 &target)
Modifies the view direction to look from the current eyePoint to target . Also updates the pivot distance.
-
voidlookAt (const vec3 &eyePoint, const vec3 &target)
Modifies the eyePoint and view direction to look from eyePoint to target . Also updates the pivot distance.
-
voidlookAt (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.
-
vec3getViewDirection () const
Returns the world-space vector along which the camera is oriented.
-
voidsetViewDirection (const vec3 &viewDirection)
Sets the world-space vector along which the camera is oriented.
-
quatgetOrientation () const
Returns the world-space quaternion that expresses the camera's orientation.
-
voidsetOrientation (const quat &orientation)
Sets the camera's orientation with world-space quaternion orientation .
-
floatgetFov () const
Returns the camera's vertical field of view measured in degrees.
-
voidsetFov (float verticalFov)
Sets the camera's vertical field of view measured in degrees.
-
floatgetFovHorizontal () const
Returns the camera's horizontal field of view measured in degrees.
-
voidsetFovHorizontal (float horizontalFov)
Sets the camera's horizontal field of view measured in degrees.
-
floatgetFocalLength () const
Returns the camera's focal length, calculating it based on the field of view.
-
floatgetPivotDistance () 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.
-
voidsetPivotDistance (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.
-
vec3getPivotPoint () const
Primarily for user interaction, such as with CameraUi . Returns the world-space point relative to which tumbling and dollying occur.
-
floatgetAspectRatio () const
Returns the aspect ratio of the image plane - its width divided by its height.
-
voidsetAspectRatio (float aAspectRatio)
Sets the aspect ratio of the image plane - its width divided by its height.
-
floatgetNearClip () const
Returns the distance along the view direction to the Near clipping plane.
-
voidsetNearClip (float nearClip)
Sets the distance along the view direction to the Near clipping plane.
-
floatgetFarClip () const
Returns the distance along the view direction to the Far clipping plane.
-
voidsetFarClip (float farClip)
Sets the distance along the view direction to the Far clipping plane.
-
voidgetNearClipCoordinates (vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight) const
Returns the four corners of the Camera 's Near clipping plane, expressed in world-space.
-
voidgetFarClipCoordinates (vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight) const
Returns the four corners of the Camera 's Far clipping plane, expressed in world-space.
-
voidgetFrustum (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
. -
const mat4 &getProjectionMatrix () const
Returns the Camera 's Projection matrix, which converts view-space into clip-space.
-
const mat4 &getViewMatrix () const
Returns the Camera 's View matrix, which converts world-space into view-space.
-
const mat4 &getInverseViewMatrix () const
Returns the Camera 's Inverse View matrix, which converts view-space into world-space.
-
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 .
-
generateRay (const vec2 &posPixels, const vec2 &imageSizePixels) const
Returns a Ray that passes through the pixels coordinates posPixels on an image of size imageSizePixels .
-
voidgetBillboardVectors (vec3 *right, vec3 *up) const
Returns the right and up vectors suitable for billboarding relative to the Camera .
-
vec2worldToScreen (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.
-
vec2eyeToScreen (const vec3 &eyeCoord, const vec2 &screenSizePixels) const
Converts a eye-space coordinate eyeCoord to screen coordinates as viewed by the camera.
-
vec3worldToEye (const vec3 &worldCoord) const
Converts a world-space coordinate worldCoord to eye-space, also known as camera-space. -Z is along the view direction.
-
floatworldToEyeDepth (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.
-
vec3worldToNdc (const vec3 &worldCoord) const
Converts a world-space coordinate worldCoord to normalized device coordinates.
-
floatcalcScreenArea (const Sphere &sphere, const vec2 &screenSizePixels) const
Calculates the area of the screen-space elliptical projection of sphere .
-
voidcalcScreenProjection (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 Member Functions
-
voidcalcProjection () const override
-
calcRay (float u, float v, float imagePlaneAspectRatio) const override
-
voidcalcMatrices () const
-
voidcalcViewMatrix () const
-
voidcalcInverseView () const
-
voidgetClipCoordinates (float clipDist, float ratio, vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight) const
Protected Attributes
-
vec2mLensShift
-
vec3mEyePoint
-
vec3mViewDirection
-
quatmOrientation
-
vec3mWorldUp
-
floatmFov
-
floatmAspectRatio
-
floatmNearClip
-
floatmFarClip
-
floatmPivotDistance
-
vec3mU
-
vec3mV
-
vec3mW
-
mat4mProjectionMatrix
-
mat4mInverseProjectionMatrix
-
boolmProjectionCached
-
mat4mViewMatrix
-
boolmModelViewCached
-
mat4mInverseModelViewMatrix
-
boolmInverseModelViewCached
-
floatmFrustumLeft
-
floatmFrustumRight
-
floatmFrustumTop
-
floatmFrustumBottom