Visualization Library 2.1.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Represents a virtual camera defining, among other things, the point of view from which scenes can be rendered. More...
#include <Camera.hpp>
Public Member Functions | |
Camera () | |
Constructs a perspective projecting camera with FOV = 60.0, Near Plane = 0.05, Far Plane = 10000.0. More... | |
void | computeNearFarOptimizedProjMatrix (const Sphere &scene_bounding_sphere) |
The near and far clipping planes are adjusted to fit the provided scene_bounding_sphere . More... | |
void | computeFrustumPlanes () |
Computes the Camera's frustum planes in world space. More... | |
void | applyModelViewMatrix (const mat4 &model_matrix) const |
Loads the GL_MODELVIEW matrix with the Camera's view matrix multiplied by the specified model matrix. More... | |
void | applyViewMatrix () const |
Loads the GL_MODELVIEW matrix with the Camera's view matrix. More... | |
void | applyProjMatrix () const |
Loads the GL_PROJECTION matrix with the Camera's projection matrix. More... | |
real | aspectRatio () const |
Returns the aspect ratio computed as viewport()->width()/viewport()->height(). More... | |
void | setFOV (real fov) |
The field of view of the camera. More... | |
real | fov () const |
The field of view of the camera. More... | |
void | setNearPlane (real nearplane) |
The near clipping plane. More... | |
real | nearPlane () const |
The near clipping plane. More... | |
void | setFarPlane (real farplane) |
The far clipping plane. More... | |
real | farPlane () const |
The far clipping plane. More... | |
real | left () const |
'left' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() More... | |
void | setLeft (real v) |
real | right () const |
'right' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() More... | |
void | setRight (real v) |
real | bottom () const |
'bottom' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() More... | |
void | setBottom (real v) |
real | top () const |
'top' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() More... | |
void | setTop (real v) |
void | setFrustum (const Frustum &frustum) |
The view frustum of the camera used to perform frustum culling. More... | |
const Frustum & | frustum () const |
The view frustum of the camera used to perform frustum culling. More... | |
Frustum & | frustum () |
The view frustum of the camera used to perform frustum culling. More... | |
void | setViewport (Viewport *viewport) |
The viewport bound to a camera. More... | |
Viewport * | viewport () |
The viewport bound to a camera. More... | |
const Viewport * | viewport () const |
The viewport bound to a camera. More... | |
void | bindTransform (Transform *transform) |
Bind the camera to a Transform. More... | |
const Transform * | boundTransform () const |
Returns the Transform bound to a camera. More... | |
Transform * | boundTransform () |
Returns the Transform bound to a camera. More... | |
void | setViewMatrix (const mat4 &mat) |
Sets the Camera's view matrix (inverse of the modeling matrix). More... | |
const mat4 & | viewMatrix () const |
Returns the Camera's view matrix (inverse of the modeling matrix). More... | |
void | setModelingMatrix (const mat4 &mat) |
Sets the Camera's modelingMatrix() (inverse of the view matrix). More... | |
const mat4 & | modelingMatrix () const |
Returns the Camera's modelingMatrix() (inverse of the view matrix). More... | |
void | setProjectionMatrix (const mat4 &mat, EProjectionMatrixType proj_type) |
The Camera's projection matrix. More... | |
const mat4 & | projectionMatrix () const |
The Camera's projection matrix. More... | |
EProjectionMatrixType | projectionMatrixType () const |
The Camera's projection matrix type. More... | |
void | setProjectionPerspective () |
Builds a perspective projection matrix for the Camera based on the Camera's and Viewport's settings. More... | |
void | setProjectionPerspective (real fov, real near, real far) |
Builds a perspective projection matrix for the Camera based on the Camera's and Viewport's settings. More... | |
void | setProjectionFrustum (real left, real right, real bottom, real top, real znear, real zfar) |
Produces a perspective projection matrix. More... | |
void | setProjectionOrtho (real left, real right, real bottom, real top, real znear, real zfar) |
Builds an orthographic projection matrix for the Camera based on the Camera's near/far planes and its Viewport's settings. More... | |
void | setProjectionOrtho () |
Builds an orthographic projection matrix for the Camera based on the Camera's near/far planes and its Viewport's settings. More... | |
void | setProjectionOrtho (real offset) |
Builds an orthographic projection matrix for the Camera based on the Camera's near/far planes and its Viewport's settings. More... | |
void | setViewMatrixLookAt (const vec3 &eye, const vec3 &at, const vec3 &up) |
Setup the modelview transform of the camera based on look-at parameters. More... | |
void | getViewMatrixAsLookAt (vec3 &eye, vec3 &at, vec3 &up, vec3 &right) const |
Returns the look-at parameters of the modelview transform. More... | |
bool | project (const vec4 &in_world, vec4 &out_viewp) const |
Projects a vector from world coordinates to viewport coordinates. More... | |
bool | unproject (const vec3 &in_viewp, vec4 &out_world) const |
Unprojects a vector from viewport coordinates to world coordinates. More... | |
bool | unproject (std::vector< vec3 > &points) const |
Unprojects a set of points. More... | |
Ray | computeRay (int viewp_x, int viewp_y) |
Computes the ray passing through the point <viewp_x,viewp_y>. More... | |
Frustum | computeRayFrustum (int viewp_x, int viewp_y) |
Computes a 1 pixel wide frustum suitable to cull objects during ray intersection detection. More... | |
void | adjustView (const AABB &aabb, const vec3 &dir, const vec3 &up, real bias=1.0f) |
Adjusts the camera position so that the given aabb can be properly viewed. More... | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Protected Attributes | |
mat4 | mViewMatrix |
mat4 | mModelingMatrix |
mat4 | mProjectionMatrix |
ref< Viewport > | mViewport |
Frustum | mFrustum |
ref< Transform > | mBoundTransform |
real | mFOV |
real | mLeft |
real | mRight |
real | mBottom |
real | mTop |
real | mNearPlane |
real | mFarPlane |
EProjectionMatrixType | mProjectionType |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
Represents a virtual camera defining, among other things, the point of view from which scenes can be rendered.
Definition at line 49 of file Camera.hpp.
Camera::Camera | ( | ) |
Constructs a perspective projecting camera with FOV = 60.0, Near Plane = 0.05, Far Plane = 10000.0.
Definition at line 46 of file Camera.cpp.
References farPlane(), fov(), vl::Matrix4< float >::getPerspective(), mBottom, mFarPlane, mFOV, mFrustum, mLeft, mNearPlane, mProjectionMatrix, mProjectionType, mRight, mTop, mViewport, nearPlane(), vl::Frustum::planes(), and vl::PMT_PerspectiveProjection.
Adjusts the camera position so that the given aabb can be properly viewed.
aabb | The AABB (in world coords) that should be visible from the newly computed camera position. |
dir | The direction (in world coords) along which the camera should be displaced to view the given AABB. |
up | The vector that defines the up direction (in world coords). Used to properly compute the new camera matrix. |
bias | A bias factor used to adjust the computed camera distance from the given AABB. Values between 0 and 1 make the camera closer to the AABB center, values greater than 1 position the camera further away. |
Definition at line 135 of file Camera.cpp.
References vl::Log::bug(), vl::AABB::center(), vl::dot(), vl::extractPlanes(), frustum(), vl::Matrix4< float >::getLookAt(), vl::Matrix4< T_Scalar >::getT(), vl::Matrix4< T_Scalar >::getZ(), vl::AABB::isNull(), modelingMatrix(), vl::Plane::normal(), vl::Plane::origin(), vl::Frustum::plane(), vl::Frustum::planes(), projectionMatrix(), vl::Sphere::radius(), setViewMatrix(), viewMatrix(), and VL_CHECK.
Referenced by vl::TrackballManipulator::adjustView().
void Camera::applyModelViewMatrix | ( | const mat4 & | model_matrix | ) | const |
Loads the GL_MODELVIEW matrix with the Camera's view matrix multiplied by the specified model matrix.
Definition at line 60 of file Camera.cpp.
References vl::Matrix4< T_Scalar >::e(), vl::Matrix4< T_Scalar >::ptr(), and viewMatrix().
Referenced by vl::Light::apply().
void Camera::applyProjMatrix | ( | ) | const |
Loads the GL_PROJECTION matrix with the Camera's projection matrix.
Definition at line 81 of file Camera.cpp.
References projectionMatrix().
Referenced by vl::EdgeRenderer::render().
void Camera::applyViewMatrix | ( | ) | const |
Loads the GL_MODELVIEW matrix with the Camera's view matrix.
Definition at line 88 of file Camera.cpp.
References vl::Matrix4< T_Scalar >::e(), vl::Matrix4< T_Scalar >::ptr(), and viewMatrix().
Referenced by vl::EdgeRenderer::renderLines(), and vl::EdgeRenderer::renderSolids().
|
inline |
Returns the aspect ratio computed as viewport()->width()/viewport()->height().
If viewport() == NULL the function returns 0.
Definition at line 82 of file Camera.hpp.
Referenced by setProjectionPerspective().
|
inline |
Bind the camera to a Transform.
Definition at line 146 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera().
|
inline |
'bottom' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*()
Definition at line 120 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::exportCamera(), and setProjectionOrtho().
|
inline |
Returns the Transform bound to a camera.
Definition at line 149 of file Camera.hpp.
Referenced by vl::expandResourceDatabase(), and vlX::VLXClassWrapper_Camera::exportCamera().
|
inline |
Returns the Transform bound to a camera.
Definition at line 152 of file Camera.hpp.
void Camera::computeFrustumPlanes | ( | ) |
Computes the Camera's frustum planes in world space.
If nearFarClippingPlanesOptimized() == true the near and far culling planes distances are respectively set to nearPlane() and farPlane().
Definition at line 172 of file Camera.cpp.
References vl::extractPlanes(), mFrustum, vl::Frustum::planes(), projectionMatrix(), and viewMatrix().
Referenced by vl::Rendering::render().
void Camera::computeNearFarOptimizedProjMatrix | ( | const Sphere & | scene_bounding_sphere | ) |
The near and far clipping planes are adjusted to fit the provided scene_bounding_sphere
.
Optimizing the near and far clipping planes results in an optimized usage of the z-buffer with the consequence of minimizing possible z-fighting artifacts, thus enhancing the rendering quality.
Definition at line 100 of file Camera.cpp.
References vl::Log::bug(), vl::Sphere::center(), vl::Sphere::isNull(), vl::max(), mBottom, mFarPlane, mLeft, mNearPlane, mRight, mTop, vl::PMT_OrthographicProjection, vl::PMT_PerspectiveProjection, projectionMatrixType(), vl::Sphere::radius(), setProjectionOrtho(), setProjectionPerspective(), vl::Sphere::transformed(), viewMatrix(), and vl::Vector3< T_Scalar >::z().
Referenced by vl::Rendering::render().
Ray Camera::computeRay | ( | int | viewp_x, |
int | viewp_y | ||
) |
Computes the ray passing through the point <viewp_x,viewp_y>.
viewp_x | The x position of the point defining the ray |
viewp_y | The y position of the point defining the ray |
"opengl_y = window_height - coord_y"
. Definition at line 335 of file Camera.cpp.
References vl::Matrix4< T_Scalar >::getT(), modelingMatrix(), vl::normalize(), vl::Ray::setDirection(), vl::Ray::setOrigin(), unproject(), and vl::Vector4< T_Scalar >::xyz().
Frustum Camera::computeRayFrustum | ( | int | viewp_x, |
int | viewp_y | ||
) |
Computes a 1 pixel wide frustum suitable to cull objects during ray intersection detection.
Definition at line 349 of file Camera.cpp.
References vl::cross(), frustum(), vl::Frustum::planes(), unproject(), and vl::Vector4< T_Scalar >::xyz().
|
inline |
The far clipping plane.
Definition at line 109 of file Camera.hpp.
Referenced by Camera(), vlX::VLXClassWrapper_Camera::exportCamera(), and setProjectionPerspective().
|
inline |
The field of view of the camera.
Definition at line 95 of file Camera.hpp.
Referenced by Camera(), vlX::VLXClassWrapper_Camera::exportCamera(), and setProjectionPerspective().
|
inline |
The view frustum of the camera used to perform frustum culling.
Definition at line 131 of file Camera.hpp.
Referenced by adjustView(), computeRayFrustum(), vl::ActorTreeAbstract::extractVisibleActors(), vl::SceneManagerPortals::extractVisibleActors(), and vl::Rendering::render().
|
inline |
The view frustum of the camera used to perform frustum culling.
Definition at line 134 of file Camera.hpp.
Returns the look-at parameters of the modelview transform.
eye | The position of the camera. |
look | The direction the camera is looking at. |
up | The vector defining the Y positive direction of the camera. |
right | The vector defining the X positive direction of the camera. |
Definition at line 243 of file Camera.cpp.
References vl::Matrix4< T_Scalar >::getAsLookAtModeling(), and mModelingMatrix.
|
inline |
'left' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*()
Definition at line 112 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::exportCamera(), and setProjectionOrtho().
|
inline |
Returns the Camera's modelingMatrix() (inverse of the view matrix).
Definition at line 168 of file Camera.hpp.
Referenced by adjustView(), vl::TextureMatrix::apply(), computeRay(), vl::SceneManagerPortals::computeStartingSector(), vl::Billboard::computeWorldMatrix(), vl::GhostCameraManipulator::enableEvent(), vl::DistanceLODEvaluator::evaluate(), vl::SceneManagerPortals::extractVisibleActors(), vl::TrackballManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::OcclusionCullRenderer::render_pass2(), vl::TrackballManipulator::trackballRotation(), vl::GhostCameraManipulator::updateEvent(), vl::RaycastVolume::updateUniforms(), and vl::SlicedVolume::updateUniforms().
|
inline |
The near clipping plane.
Definition at line 102 of file Camera.hpp.
Referenced by Camera(), vlX::VLXClassWrapper_Camera::exportCamera(), and setProjectionPerspective().
Projects a vector from world coordinates to viewport coordinates.
Definition at line 248 of file Camera.cpp.
References mProjectionMatrix, mViewMatrix, mViewport, vl::Vector4< T_Scalar >::w(), vl::Vector4< T_Scalar >::x(), vl::Vector4< T_Scalar >::y(), and vl::Vector4< T_Scalar >::z().
Referenced by vl::Text::boundingRectTransformed(), vl::DrawPixels::render_Implementation(), and vl::Text::renderText().
|
inline |
The Camera's projection matrix.
Definition at line 174 of file Camera.hpp.
Referenced by adjustView(), applyProjMatrix(), computeFrustumPlanes(), vl::PixelLODEvaluator::evaluate(), vlX::VLXClassWrapper_Camera::exportCamera(), and vl::ProjViewTransfCallback::updateMatrices().
|
inline |
The Camera's projection matrix type.
Definition at line 177 of file Camera.hpp.
Referenced by computeNearFarOptimizedProjMatrix(), and vlX::VLXClassWrapper_Camera::exportCamera().
|
inline |
'right' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*()
Definition at line 116 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::exportCamera(), and setProjectionOrtho().
|
inline |
Definition at line 121 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera().
|
inline |
The far clipping plane.
Definition at line 106 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera(), setProjectionFrustum(), and setProjectionPerspective().
|
inline |
The field of view of the camera.
Definition at line 92 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera(), setProjectionFrustum(), and setProjectionPerspective().
|
inline |
The view frustum of the camera used to perform frustum culling.
Definition at line 128 of file Camera.hpp.
|
inline |
Definition at line 113 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera().
|
inline |
Sets the Camera's modelingMatrix() (inverse of the view matrix).
The view matrix is also set as the inverse of the modelingMatrix().
Definition at line 164 of file Camera.hpp.
References vl::Matrix4< T_Scalar >::getInverse().
Referenced by vl::TrackballManipulator::mouseMoveEvent(), vl::Rendering::render(), and vl::GhostCameraManipulator::updateEvent().
|
inline |
The near clipping plane.
Definition at line 99 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera(), setProjectionFrustum(), and setProjectionPerspective().
void Camera::setProjectionFrustum | ( | real | left, |
real | right, | ||
real | bottom, | ||
real | top, | ||
real | znear, | ||
real | zfar | ||
) |
Produces a perspective projection matrix.
The <left, bottom, zfar> and <right, top, znear> parameters specify the points on the near clipping plane that are mapped to the lower-left and upper-right corners of the viewport, respectively, assuming that the eye is located at (0,0,0). The zfar parameter specifies the location of the far clipping plane. Both znear and zfar must be positive.
This function is more general that setProjectionPerspective() as it's capable of generating off-axis projections, while setProjectionPerspective() only produces symmetrical (on-axis) projections. Since setProjectionFrustum() is more general than setProjectionPerspective(), you can use it in cases where setProjectionPerspective() can't be used. Some examples include shadows projection, tiled renderings, and stereo views.
Definition at line 181 of file Camera.cpp.
References vl::atan(), vl::Matrix4< float >::getFrustum(), vl::PMT_PerspectiveProjectionFrustum, setFarPlane(), setFOV(), setNearPlane(), and setProjectionMatrix().
|
inline |
The Camera's projection matrix.
Definition at line 171 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera(), setProjectionFrustum(), setProjectionOrtho(), setProjectionPerspective(), and vl::CalibratedCamera::updateCalibration().
void Camera::setProjectionOrtho | ( | real | left, |
real | right, | ||
real | bottom, | ||
real | top, | ||
real | znear, | ||
real | zfar | ||
) |
Builds an orthographic projection matrix for the Camera based on the Camera's near/far planes and its Viewport's settings.
Definition at line 213 of file Camera.cpp.
References bottom(), vl::Matrix4< float >::getOrtho(), left(), mBottom, mFarPlane, mFOV, mLeft, mNearPlane, mRight, mTop, vl::PMT_OrthographicProjection, right(), setProjectionMatrix(), and top().
void Camera::setProjectionOrtho | ( | ) |
Builds an orthographic projection matrix for the Camera based on the Camera's near/far planes and its Viewport's settings.
Definition at line 203 of file Camera.cpp.
References vl::Matrix4< float >::getOrtho(), mBottom, mFarPlane, mFOV, mLeft, mNearPlane, mRight, mTop, mViewport, vl::PMT_OrthographicProjection, and setProjectionMatrix().
Referenced by computeNearFarOptimizedProjMatrix().
void Camera::setProjectionOrtho | ( | real | offset | ) |
Builds an orthographic projection matrix for the Camera based on the Camera's near/far planes and its Viewport's settings.
This function is similar to glOrtho2D() with the difference that it can optionally add a translation offset on both x and y. For example with an offset of -0.5 the center of the pixels will be exactly at integer coordinates 0, 1, 2, etc.
Definition at line 225 of file Camera.cpp.
References vl::Matrix4< float >::getOrtho(), vl::Viewport::height(), mBottom, mFarPlane, mFOV, mLeft, mNearPlane, mRight, mTop, vl::PMT_OrthographicProjection, setProjectionMatrix(), viewport(), and vl::Viewport::width().
void Camera::setProjectionPerspective | ( | ) |
Builds a perspective projection matrix for the Camera based on the Camera's and Viewport's settings.
See also http://www.opengl.org/sdk/docs/man/xhtml/gluPerspective.xml for more information.
Definition at line 198 of file Camera.cpp.
References aspectRatio(), farPlane(), fov(), vl::Matrix4< float >::getPerspective(), nearPlane(), vl::PMT_PerspectiveProjection, and setProjectionMatrix().
Referenced by computeNearFarOptimizedProjMatrix(), and vl::Applet::resizeEvent().
void Camera::setProjectionPerspective | ( | real | fov, |
real | near, | ||
real | far | ||
) |
Builds a perspective projection matrix for the Camera based on the Camera's and Viewport's settings.
See also http://www.opengl.org/sdk/docs/man/xhtml/gluPerspective.xml for more information.
Definition at line 190 of file Camera.cpp.
References aspectRatio(), vl::Matrix4< float >::getPerspective(), vl::PMT_PerspectiveProjection, setFarPlane(), setFOV(), setNearPlane(), and setProjectionMatrix().
|
inline |
Definition at line 117 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera().
|
inline |
Definition at line 125 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera().
|
inline |
Sets the Camera's view matrix (inverse of the modeling matrix).
The modelingMatrix() is also set as the inverse of the viewMatrix().
Definition at line 156 of file Camera.hpp.
References vl::Matrix4< T_Scalar >::getInverse().
Referenced by adjustView(), vlX::VLXClassWrapper_Camera::importCamera(), vl::FlatManipulator::mouseMoveEvent(), and setViewMatrixLookAt().
Setup the modelview transform of the camera based on look-at parameters.
eye | The position of the camera. |
center | The point the camera is looking at. |
up | The vector defining the up direction. |
Definition at line 237 of file Camera.cpp.
References vl::Matrix4< float >::getLookAt(), and setViewMatrix().
|
inline |
The viewport bound to a camera.
Definition at line 137 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::importCamera().
|
inline |
'top' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*()
Definition at line 124 of file Camera.hpp.
Referenced by vlX::VLXClassWrapper_Camera::exportCamera(), and setProjectionOrtho().
Unprojects a vector from viewport coordinates to world coordinates.
in_viewp | The viewport coordinates point to be projected. Note that, in accordance to OpenGL conventions, the viewport coordinates have the Y axis pointing upwards and origin at the bottom left corner of the viewport. |
out_world | The world coordinates of the projected point. |
z
coordinate of in_viewp
determines the position of the projected point along the ray passing through in_viewp
. If z
equals 0 then out_world
will lay on the near clipping plane, if z
equals 1 then out_world
will lay on the far clipping plane. Definition at line 270 of file Camera.cpp.
References mProjectionMatrix, mViewMatrix, mViewport, vl::Vector4< T_Scalar >::w(), vl::Vector3< T_Scalar >::x(), vl::Vector4< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), vl::Vector4< T_Scalar >::y(), vl::Vector3< T_Scalar >::z(), and vl::Vector4< T_Scalar >::z().
Referenced by computeRay(), and computeRayFrustum().
bool Camera::unproject | ( | std::vector< vec3 > & | points | ) | const |
Unprojects a set of points.
See unproject(const vec3& in_viewp, vec4& out_world) for more information.
Definition at line 300 of file Camera.cpp.
References mProjectionMatrix, mViewMatrix, mViewport, vl::Vector4< T_Scalar >::w(), vl::Vector4< T_Scalar >::x(), vl::Vector4< T_Scalar >::y(), and vl::Vector4< T_Scalar >::z().
|
inline |
Returns the Camera's view matrix (inverse of the modeling matrix).
This is what you would pass to OpenGL with "glMatrixMode(GL_MODELVIEW); glLoadMatrix(camera.viewMatrix().ptr());"
Definition at line 160 of file Camera.hpp.
Referenced by adjustView(), vl::ClipPlane::apply(), applyModelViewMatrix(), applyViewMatrix(), computeFrustumPlanes(), computeNearFarOptimizedProjMatrix(), vl::PixelLODEvaluator::evaluate(), vlX::VLXClassWrapper_Camera::exportCamera(), vl::FlatManipulator::mouseMoveEvent(), vl::SlicedVolume::onActorRenderStarted(), vl::EdgeUpdateCallback::onActorRenderStarted(), vl::DepthSortCallback::onActorRenderStarted(), vl::EdgeRenderer::renderLines(), vl::EdgeRenderer::renderSolids(), vl::RenderQueue::sort(), and vl::ProjViewTransfCallback::updateMatrices().
|
inline |
The viewport bound to a camera.
Definition at line 140 of file Camera.hpp.
Referenced by vl::Text::boundingRectTransformed(), vl::TrackballManipulator::computeVector(), vl::GhostCameraManipulator::enableEvent(), vl::PixelLODEvaluator::evaluate(), vl::expandResourceDatabase(), vlX::VLXClassWrapper_Camera::exportCamera(), vl::TrackballManipulator::mouseDownEvent(), vl::FlatManipulator::mouseInViewport(), vl::GhostCameraManipulator::mouseMoveEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::SlicedVolume::onActorRenderStarted(), vl::Renderer::render(), vl::EdgeRenderer::render(), vl::Clear::render_Implementation(), vl::DrawPixels::render_Implementation(), vl::OcclusionCullRenderer::render_pass2(), vl::Text::renderBackground(), vl::Text::renderBorder(), vl::Renderer::renderRaw(), vl::Text::renderText(), vl::Applet::resizeEvent(), setProjectionOrtho(), and vl::CalibratedCamera::updateCalibration().
|
inline |
The viewport bound to a camera.
Definition at line 143 of file Camera.hpp.
|
protected |
Definition at line 279 of file Camera.hpp.
Referenced by Camera(), computeNearFarOptimizedProjMatrix(), and setProjectionOrtho().
Definition at line 277 of file Camera.hpp.
|
protected |
Definition at line 281 of file Camera.hpp.
Referenced by Camera(), computeNearFarOptimizedProjMatrix(), setProjectionOrtho(), and vl::CalibratedCamera::updateCalibration().
|
protected |
Definition at line 278 of file Camera.hpp.
Referenced by Camera(), and setProjectionOrtho().
|
protected |
Definition at line 276 of file Camera.hpp.
Referenced by Camera(), and computeFrustumPlanes().
|
protected |
Definition at line 279 of file Camera.hpp.
Referenced by Camera(), computeNearFarOptimizedProjMatrix(), and setProjectionOrtho().
|
protected |
Definition at line 273 of file Camera.hpp.
Referenced by getViewMatrixAsLookAt().
|
protected |
Definition at line 280 of file Camera.hpp.
Referenced by Camera(), computeNearFarOptimizedProjMatrix(), setProjectionOrtho(), and vl::CalibratedCamera::updateCalibration().
|
protected |
Definition at line 274 of file Camera.hpp.
Referenced by Camera(), project(), and unproject().
|
protected |
Definition at line 282 of file Camera.hpp.
Referenced by Camera().
|
protected |
Definition at line 279 of file Camera.hpp.
Referenced by Camera(), computeNearFarOptimizedProjMatrix(), and setProjectionOrtho().
|
protected |
Definition at line 279 of file Camera.hpp.
Referenced by Camera(), computeNearFarOptimizedProjMatrix(), and setProjectionOrtho().
|
protected |
Definition at line 272 of file Camera.hpp.
Referenced by project(), and unproject().
Definition at line 275 of file Camera.hpp.
Referenced by Camera(), project(), setProjectionOrtho(), and unproject().
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:48.
© Copyright Michele Bosi. All rights reserved.