Position and orientation of the camera | |
| Vec | position () const |
| Quaternion | orientation () const |
| void | getPosition (float &x, float &y, float &z) const |
| void | getOrientation (float &q0, float &q1, float &q2, float &q3) const |
| void | setPosition (const Vec &pos) |
| void | setPosition (float x, float y, float z) |
| void | setOrientation (const Quaternion &q) |
| void | setOrientation (float q0, float q1, float q2, float q3) |
| void | setOrientation (float theta, float phi) |
| void | setCameraFromProjectionMatrix (const float *const m) |
Camera positioning tools | |
| void | setUpVector (float x, float y, float z, bool noMove=true) |
| void | showEntireScene () |
| void | fitBoundingBox (const Vec &m, const Vec &M) |
| void | fitSphere (const Vec ¢er, float radius) |
| void | fitSphere (float x, float y, float z, float r) |
| void | lookAt (const Vec &target) |
| void | lookAt (float x, float y, float z) |
| void | centerScene () |
| void | setUpVector (const Vec &up, bool noMove=true) |
| void | setFOVToFitScene () |
| void | interpolateToZoomOnPixel (int x, int y) |
| void | interpolateToFitScene () |
Camera intrinsic parameters | |
| float | fieldOfView () const |
| float | flySpeed () const |
| Type | type () const |
| ManipulatedCameraFrame::Mode | mode () const |
| void | setFieldOfView (float f) |
| void | setFlySpeed (float s) |
| void | setType (Type type) |
| void | setMode (ManipulatedCameraFrame::Mode m) |
| void | toggleMode () |
Camera associated parameters | |
| virtual float | zNear () const |
| virtual float | zFar () const |
| float | zNearCoef () const |
| void | getOrthoWidthHeight (GLdouble &w, GLdouble &h) const |
| float | aspectRatio () const |
| int | screenWidth () const |
| int | screenHeight () const |
| float | pixelGLRatio (const Vec &pos) |
| float | distanceToSceneCenter () const |
| Vec | upVector () const |
| void | getUpVector (float &x, float &y, float &z) const |
| Vec | viewDirection () const |
| void | getViewDirection (float &x, float &y, float &z) const |
| Vec | pointUnderPixel (const int x, const int y, bool &found) |
| bool | isManipulated () const |
| void | setZNearCoef (float coef) |
Revolve Around Point | |
| Vec | revolveAroundPoint () const |
| void | getRevolveAroundPoint (float &x, float &y, float &z) const |
| void | setRevolveAroundPoint (const Vec &rap) |
| void | setRevolveAroundPoint (float x, float y, float z) |
| bool | setRevolveAroundPointFromPixel (int x, int y) |
| void | setRevolveAroundPointToSceneCenter () |
Camera Paths | |
| A camera path is defined by a KeyFrameInterpolator. You can interactively addKeyFrame() to a given path using the default QGLViewer shortcut: Alt-F[1-12] (see QGLViewer::setKeyFrameKey()). Use playKeyFramePath() to make the camera follow the path (default shortcut is F[1-12]). | |
| int | nbPaths () const |
| KeyFrameInterpolator * | keyFrameInterpolator (unsigned short i) const |
| void | setKeyFrameInterpolator (unsigned short i, KeyFrameInterpolator *const kfi) |
| virtual void | addKeyFrame (int i) |
| virtual void | playKeyFramePath (int i) |
| virtual void | deleteKeyFramePath (int i) |
| virtual void | resetKeyFramePath (int i) |
| virtual void | drawAllPaths () |
Associated camera frame | |
| ManipulatedCameraFrame * | frame () const |
| void | setFrame (ManipulatedCameraFrame *const f) |
OpenGL associated matrices | |
| virtual void | loadProjectionMatrix (bool reset=true) const |
| virtual void | loadProjectionMatrixStereo (bool leftBuffer=true) const |
| virtual void | loadModelViewMatrix (bool reset=true) const |
| virtual void | loadModelViewMatrixStereo (bool leftBuffer=true) const |
| virtual void | getProjectionMatrix (GLdouble m[16]) const |
| virtual void | getProjectionMatrix (GLfloat m[16]) const |
| virtual void | getModelViewMatrix (GLdouble m[16]) const |
| virtual void | getModelViewMatrix (GLfloat m[16]) const |
| virtual void | computeModelViewMatrix () const |
World to Camera coordinate systems | |
| Methods to go from the world to the camera coordinate systems, and vice-versa. Simply an interface for the Frame equivalent functions. | |
| void | getCameraCoordinatesOf (const float src[3], float res[3]) const |
| Vec | cameraCoordinatesOf (const Vec &src) const |
| void | getWorldCoordinatesOf (const float src[3], float res[3]) const |
| Vec | worldCoordinatesOf (const Vec &src) const |
2D screen to 3D world coordinate systems | |
| Methods to go from the 2D screen to the 3D world coordinate systems, and vice-versa. | |
| Vec | projectedCoordinatesOf (const Vec &src) const |
| void | getProjectedCoordinatesOf (const float src[3], float res[3]) const |
| Vec | unprojectedCoordinatesOf (const Vec &src) const |
| void | getUnprojectedCoordinatesOf (const float src[3], float res[3]) const |
| void | convertClickToLine (int x, int y, float orig[3], float dir[3]) const |
| void | convertClickToLine (int x, int y, Vec &orig, Vec &dir) const |
Stereo mode parameters | |
| float | horizontalFieldOfView () const |
| float | IODist () const |
| float | distanceToScreen () const |
| float | distanceToZeroParallaxPlane () const |
| float | physicalScreenWidth () const |
| void | setHorizontalFieldOfView (float hfov) |
| void | setIODist (float iod) |
| void | setDistanceToScreen (float dts) |
| void | setDistanceToZeroParallaxPlane (float dtz) |
| void | setPhysicalScreenWidth (float sw) |
XML representation | |
| virtual QDomElement | domElement (const QString &name, QDomDocument &doc) const |
| virtual void | initFromDOMElement (const QDomElement &de) |
Scene radius and center | |
| Definition of the size of the scene. | |
| float | sceneRadius () const |
| Vec | sceneCenter () const |
| void | setSceneRadius (float r) |
| void | setSceneBoundingBox (const Vec &m, const Vec &M) |
| void | setSceneCenter (const Vec &sc) |
| void | setSceneCenter (float x, float y, float z) |
| bool | setSceneCenterFromPixel (int x, int y) |
Internal methods | |
| Used by the QGLViewer to transmit to the Camera some scene related values. | |
| bool | cameraPathIsEdited () const |
| void | editCameraPath (bool edit) |
| void | setWindowWidthAndHeight (int w, int h) |
Public Types | |
| enum | Type { PERSPECTIVE, ORTHO } |
Public Methods | |
| Camera () | |
| virtual | ~Camera () |
A Camera defines some intrinsic camera parameters, such as fieldOfView(), position(), viewDirection(), upVector()... It also provides useful positioning tools that ease its placement : showEntireScene(), fitSphere(), fitBoundingBox(),, ...
The type() of the Camera can be ORTHO or PERSPECTIVE (see Type()). fieldOfView() is meaningless in ORTHO.
The position() and orientation() of the Camera are defined by a ManipulatedCameraFrame that can be retrieved with frame(). These functions are just a convenient interface for the associated Frame functions. This also means that the Camera frame() can be attached to a Frame::referenceFrame() which enable complex Camera setups.
The mode() of the Camera is also simply the one of its frame(). Current possible values are REVOLVE and FLY (see ManipulatedCameraFrame::Mode()).
+ and - keys.space) to toggle between the two modes. See the shortcut page and QGLViewer::setKeyFrameKey() for more details on key customization.
The near and far planes of the Camera are determined from the QGLViewer::sceneRadius() and QGLViewer::sceneCenter() by the zNear() and zFar() functions. Reasonable values on the scene extends hence have to be provided to the QGLViewer in order for the Camera to correctly display the scene. High level positioning functions can then be automated (showEntireScene(), centerScene()...). Once again, see the mouse page for details.
A Camera holds 12 KeyFrameInterpolator that can be used to save camera positions and paths. See the shortcut page for default key bindings.
Use cameraCoordinatesOf() ans worldCoordinatesOf() to convert to and from the Camera frame() coordinate system. projectedCoordinatesOf() and unprojectedCoordinatesOf() will convert from screen to 3D coordinates. convertClickToLine() is very useful for analytical object selection.
Stereo display is possible on machines with quad buffer capabilities (with PERSPECTIVE type() only). Test the stereoViewer example to check.
|
|
The type of camera used by the QGLViewer, set by setType(). This type will be use in loadProjectionMatrix().
|
|
|
Default values are given to the camera parameters : sceneCenter=0, sceneRadius=1, camera type = PERSPECTIVE, default stereo value, .... |
|
|
Virtual destructor. Empty. |
|
|
Adds the current camera frame as a key frame to the path number The default shortcut for this function is Alt-F[1-12]. Set QGLViewer::setKeyFrameKey() and QGLViewer::setAddKeyFrameStateKey(). Use playKeyFramePath() to make the camera play the key frame path (resp. restore point of view). Use deleteKeyFramePath() to clear the key frame path. See also keyFrameInterpolator() and setKeyFrameInterpolator() to directly define a complete path. |
|
|
Returns the currents camera aspect ratio (screenWidth() / screenHeight()), determined from the QGLViewer window size. |
|
|
Returns the camera frame coordinates of a point |
|
|
Returns |
|
|
Move the camera so that the sceneCenter() is projected on the center of the window. The orientation() and fieldOfView() are unchanged. ManipulatedCameraFrame::mouseDoubleClickEvent() calls this function after a right button double click. See also showEntireScene(). |
|
|
Computes the model view matrix associated with the camera state. Called by loadModelViewMatrix() before each drawing. You may need to call this (unlikely) if you use the model view matrix out of the main drawing loop, for a (un) projectedCoordinatesOf() or a getModelViewMatrix() for instance. |
|
||||||||||||||||||||
|
This function should be called by your selection function to transform a window x,y coordinate to a (world coordinates) half line, for analytical intersection process.
The origin of the half line (eye position) is stored in Typical usage would be: convertClickToLine(e->x(), e->y(), orig, dir);
The See the select example for an illustration. |
|
||||||||||||||||||||
|
Same as convertClickToLine(), but the result is returned as a float[3]. |
|
|
Deletes the KeyFrameInterpolator of index |
|
|
Returns the distance from the camera center to sceneCenter(), projected along the camera Z axis. Used by zNear() and zFar() to optimize the Z range. |
|
|
Returns the physical distance to screen (used for stereo mode only). Value is set using setDistanceToScreen() |
|
|
Returns the distance to 0 parallax plane (used for stereo mode only). Value is set using setDistanceToZeroParallaxPlane() |
|
||||||||||||
|
Creates an XML QDomElement that represents the Camera. Use initFromDOMElement() to restore the Camera state from the resulting domElement. See also KeyFrameInterpolator::domElement(), Frame::domElement()... If you want to save the camera state in a file, use QDomDocument doc("myCAMERA"); doc.appendChild( myCamera->domElement("Camera", doc) ); ofstream file("myCamera.xml"); file << doc.toString(); Use the following code to retrieve state from the saved file: // Load DOM from file QDomDocument doc; QFile f("myCamera.xml"); f.open(IO_ReadOnly); doc.setContent(&f); f.close(); // Parse the DOM tree QDomElement main = doc.documentElement(); myCamera->initFromDOMElement(main); |
|
|
Draws the camera paths defined by the keyFrameInterpolator(). Simply calls KeyFrameInterpolator::drawPathModifyGLState() for all the defined path. See addKeyFrame() and setKeyFrameInterpolator() to define a path.
The path color is the current
|
|
|
Starts or stops the edition of the camera paths. Called by QGLViewer::editCameraPath() and QGLViewer::toggleCameraPathEditor(). Get current value with cameraPathIsEdited(). |
|
|
Returns the vertical field of view of the camera (in radians). Value is set using setFieldOfView(), default value is pi/4 radians. |
|
||||||||||||
|
Moves the camera so that the bounding box
|
|
||||||||||||||||||||
|
Same as fitSphere(), but with float parameters. |
|
||||||||||||
|
Move the camera so that the sphere ( |
|
|
Returns the current fly speed (used when mode() is FLY). Set with setFlySpeed(). Set to 0.5% of the sceneRadius in setSceneRadius(). |
|
|
The ManipulatedCameraFrame attached to the camera and which defines its position and orientation. See setFrame(). |
|
||||||||||||
|
Same as cameraCoordinatesOf(), but the parameters are float[3] ( |
|
|
Set
This matrix actually represents the state of the
|
|
|
This function is provided for convenience, in case you want to work with double instead of floats, see getModelViewMatrix(GLfloat m[16]) for explanations. |
|
||||||||||||||||||||
|
float version of orientation(). |
|
||||||||||||
|
Returns the half width |
|
||||||||||||||||
|
Same as position(), but with float parameters. |
|
||||||||||||
|
float version of projectedCoordinatesOf() ( |
|
|
Set
|
|
|
This function is provided for convenience, in case you want to work with double instead of floats, see getProjectionMatrix(GLfloat m[16]) for explanations. |
|
||||||||||||||||
|
float version of revolveAroundPoint(). |
|
||||||||||||
|
Same as getUnprojectedCoordinatesOf(), but with float parameters ( |
|
||||||||||||||||
|
Same as upVector(), but with float parameters. |
|
||||||||||||||||
|
|
|
||||||||||||
|
Same as worldCoordinatesOf(), but the parameters are float[3] ( |
|
|
Returns the horizontal (X camera frame direction) field of view used by the camera (in radians). Value is set using setHorizontalFieldOfView() or setFieldOfView(). The values are always linked by :
horizontalFieldOfView() = 2.0 * atan ( tan(fieldOfView()/2.0) * aspectRatio() ).
|
|
|
Restore the Camera state from a QDomElement created by domElement(). See also KeyFrameInterpolator::initFromDOMElement(), Frame::initFromDOMElement(). |
|
|
Inperpolates the camera position on a one second KeyFrameInterpolator path stating from the current position, so that at the end the entire scene is visible and fits in screen (see showEntireScene()). See also interpolateToFitScene(). This function is binded to the right then middle double simple click. See mouse page for details. See also zoomOnPixel(). |
|
||||||||||||
|
Make the camera zoom on the selected pixel (if an object is actually drawn in this pixel, see pointUnderPixel()). A KeyFrameInterpolator is created and animates the camera on a one second path that brings the camera closer to the selected pixel. See also interpolateToFitScene(). This function is binded to the middle then right double simple click. See mouse page for details. See also interpolateToFitScene(). |
|
|
Returns the inter-ocular distance used for stereo (in meters). Value set using setIODist() |
|
|
|
|
|
Returns the current KeyFrameInterpolator that defines the camera path number
If the path is not defined for this index, the method returns a Use the following code to remove the connection between the KeyFrameInterpolator::interpolated() signal and the viewer: disconnectSignalToAllViewers(keyFrameInterpolator(i), SIGNAL(interpolated()));
|
|
|
Loads the current camera GL_MODELVIEW matrix.
When getModelViewMatrix() returns the current 4x4 model view matrix.
|
|
|
Loads the GL_MODELVIEW matrix for stereo mode. It clears the previous modelview matrix by calling
|
|
|
Load the current camera GL_PROJECTION matrix. Default method set camera according to fieldOfView(), and window aspect ratio in PERSPECTIVE type(). See getOrthoWidthHeight() for ORTHO type(). Uses zNear() and zFar() which are determined from sceneRadius() and sceneCenter() so that they best fit the scene size. Camera type is returned by type(), and is set with setType().
When getProjectionMatrix() returns the 4x4 projection matrix.
|
|
|
Load the current camera GL_PROJECTION matrix for Stereo mode. Only PERSPECTIVE camera type() case is handled. Uses zNear() and zFar() which are determined from sceneRadius() and sceneCenter() so that they best fit the scene size. Uses distanceToZeroParallaxPlane(), IODist(), and physicalScreenWidth() to compute cameras offset for stereovision, as well as asymmetric frustums Camera type is returned by type(), and is set with setType().
When getProjectionMatrix() will always return the 4x4 mono projection matrix.
|
|
||||||||||||||||
|
Same as lookAt(), but with float parameters. |
|
|
Set the camera orientation, so that it looks at point |
|
|
Returns the value of frame mode, set by setMode() or toggleMode(). This mode determines the behavior or the camera when the mouse is moved. |
|
|
Returns the number of camera paths that can be defined. This is the maximum number of KeyFrameInterpolator that can be saved (index range is 0.. |
|
|
Returns the camera current orientation, defined in the world coordinate system. Actually returns |
|
|
Returns the physical screen width (used for stereo mode only). Value is set using setPhysicalScreenWidth() |
|
|
Returns the pixel to GL unit ratio. A line of pixelGLRatio() GL unit, located at position The following code will draw a 20 pixel line, starting at sceneCenter() and always directed along the screen vertical direction. glBegin(GL_LINES); glVertex3fv(sceneCenter().address()); glVertex3fv((sceneCenter() + 20*pixelGLRatio(sceneCenter())*upVector()).address()); glEnd();
|
|
|
Make the camera follow the key frame path number The default shortcut for this function is F[1-12]. Set QGLViewer::setKeyFrameKey() and QGLViewer::setPlayKeyFramePathStateKey(). See also keyFrameInterpolator() and setKeyFrameInterpolator() to directly define a complete path. |
|
||||||||||||||||
|
Returns the coordinates of the 3D point located at pixel (x,y) on screen. Calls a glReadPixel to get the pixel depth and applies an unprojectedCoordinatesOf() to the result.
|
|
|
Returns the camera position (the eye), defined in the world coordinate system. Use setPosition() to set the camera position. Other convenient functions are showEntireScene(), fitBoundingBox() or fitSphere(). Actually returns |
|
|
Returns the screen projected coordinates of a point
This method is not computationally optimized. If you call it several times with no change in the matrices, you should buffer the entire projection matrix (modelview, projection and then viewport) to speed-up the queries. See the unprojectedCoordinatesOf() performs the inverse transformation.
|
|
|
If this keyFrame path is not being played (see playKeyFramePath() ), reset it to is its starting position (see KeyFrameInterpolator::resetInterpolation()). If the path is played, simply stop interpolation. |
|
|
When the camera is in REVOLVE mode (see mode()), this is the point the camera revolves around (defined in world coordinate system). Default value is the sceneCenter(). Camera mode can be changed with toggleMode() or with setMode().
|
|
|
Returns the position of the scene center. This value is set setSceneCenter(), which is called by QGLViewer::setSceneCenter(). Default is 0,0,0 (world origin). |
|
|
Returns the scene radius used by the camera. Used to set the camera near and far planes (see zNear() and zFar()). This value is modifed by QGLViewer::setSceneRadius(), which simply calls setSceneRadius(). |
|
|
Returns the current height (in pixels) of the camera screen. See also QGLWidget::height(). |
|
|
Returns the current width (in pixels) of the camera screen. See also QGLWidget::width() |
|
|
m is the projection matrix as used in vision algorithm. It has 3 lines and 4 columns. It transforms a point in the world homogeneous coordinate system (4 coordinates: sx, sy, sz and s) in a point in the screen homogeneous coordinate system (3 coordinates: sx, sy, and s, where x and y are the pixel coordinates on the screen).
m is a pointer to the elements of the matrix ordered in line major order. If you define your matrix as a This code was written by Sylvain Paris (Sylvain.Paris@imag.fr). |
|
|
Defines the distance in real world between the observer eyes and the screen -monitor or projection wall- in meters. Default value is 0.5m. loadProjectionMatrixStereo() uses this value to define the camera offset and frustum. |
|
|
Defines the distance in virtual world between the viewpoint and the plane where the horizontal parallax is null, that's to say where the stereo left and right images are superimposed. loadProjectionMatrixStereo() uses this value to define the camera offset and frustum.
|
|
|
Defines the vertical field of view of the camera (in radians). Also used to fit the scene and mouse translations. fieldOfView() returns the current value. The default value is pi/4 radians. loadProjectionMatrix() uses this value to define the camera.
The field of view corresponds the one used in Use setFOVToFitScene() to adapt the fieldOfView(). This is not the normal way of zooming in or out. All the other positioning camera function (showEntireScene(), fitSphere()...) move the camera instead of changing its fieldOfView(). distanceToZeroParallaxPlane() is set to sceneRadius() / tan(fieldOfView()/2) (used only for stereo mode, see QGLViewer::setStereoDisplay(), setSceneRadius() and setDistanceToZeroParallaxPlane()). |
|
|
When camera is in FLY mode (see mode()), tunes the speed of the displacement. Current value is given by flySpeed(). Note that is value is also set in setSceneRadius(). |
|
|
Change the camera fieldOfView() so that the entire scene (defined by QGLViewer;;sceneCenter() and QGLViewer::sceneRadius()) would be visible from the current camera position(). The position() and orientation() of the camera are not modified and you have to properly orientate the camera in order to actually see the scene (see lookAt()). See also showEntireScene() and fitSphere(). This function is especially useful for shadow maps computation. Use the camera positionning tools (setPosition(), lookAt(), setUpVector()) to position the camera at the light position. Use setFOVToFitScene() to define an optimal fieldOfView() that best use the shadow map resolution. Use showZBuffer() to actually see the computed shadow map. See the shadowMap example (TODO).
|
|
|
Changes the ManipulatedCameraFrame that defines the position and orientation of the camera. If you simply want to move the camera, use setPosition() and setOrientation() or one of the camera positioning functions : lookAt(), fitSphere(), fitBoundingBox(), showEntireScene()... If you want to save camera positions, there's no real need to call this function either. Use addKeyFrame() and playKeyFramePath() for this. This function is actually mainly useful if you derive the ManipulatedCameraFrame class and want to use an instance of your new class to move the camera.
A
delete camera()->frame();
camera()->setFrame(myManipulatedCameraFrame());
|
|
|
Defines the horizontal field of view of the camera (in radians) by calling setFieldOfView() scaled by 1/aspectRatio() to keep consistency. loadProjectionMatrixStereo() uses this value to define the camera offset and frustum. |
|
|
Defines the real inter-ocular distance (in meters). The default value used is 0.062m, which fits most people. loadProjectionMatrixStereo() uses this value to define the camera offset and frustum |
|
||||||||||||
|
Changes the KeyFrameInterpolator that currently defines the camera path of index deleteKeyFramePath(3); setKeyFrameInterpolator(3, myKeyFrameInterpolator);
|
|
|
Set the displacement mode of the camera, defined from ManipulatedCameraFrame::Mode(). See the mouse behavior and customization HTML page for details. |
|
||||||||||||
|
Set the orientation of the camera using polar coordinates This function can be useful to create Quicktime VR panoramic sequences, see saveSnapshot() for details. |
|
||||||||||||||||||||
|
Same as setOrientation(), but with float parameters. |
|
|
Set the camera orientation, defined with respect to the world coordinate system. The current camera orientation can be obtained from orientation(). The camera position() is not modified by this function. See also lookAt() and setUpVector(). |
|
|
Defines the width of the real screen (in meters). Typically 0.4m (default value) for a monitor and 10m for the cylindrical wall in Reality Center. loadProjectionMatrixStereo() uses this value to define the camera offset and frustum. |
|
||||||||||||||||
|
Same as setPosition(), but with float parameters. |
|
|
Set the camera position (the eye), defined in the world coordinate system. The current camera position can be obtained from position(). |
|
||||||||||||||||
|
float version of setRevolveAroundPoint(). |
|
|
Changes the revolveAroundPoint(), which defines the position (in world coordinates) of the 3D point the camera revolves around in REVOLVE camera mode (see mode() and setMode()). Current value can be get from revolveAroundPoint(). Default value is sceneCenter(), which default value is (0,0,0). The zNear() and zFar() values are fitted to the scene, which will be entirely visible if revolveAroundPoint() is located inside a sceneRadius() sphere centered on sceneCenter(). The camera position and orientation are not modified so that the image displayed by the camera is not affected by the revolveAroundPoint() change.
|
|
||||||||||||
|
The revolveAroundPoint() is set to the point located at pixel (x,y) on screen.
Returns This function is binded to the left then right double simple click. See mouse page for details. |
|
|
The name says it all. See setRevolveAroundPoint() and sceneCenter(). |
|
||||||||||||
|
Similar to setSceneRadius() and setSceneCenter(), but the scene limits are defined by a bounding box. |
|
||||||||||||||||
|
Same as setSceneCenter(), but with |
|
|
Changes the sceneCenter value (used for zNear() and zFar()). This value is set from QGLViewer::setSceneCenter().
|
|
||||||||||||
|
setSceneCenter() to the result of pointUnderPixel() (if a point was found).
Returns |
|
|
Scene radius (see sceneRadius()) scales axis and grid display and is used by zNear() and zFar(). Should be set according to the displayed scene radius. This value is updated by the QGLViewer::setSceneRadius(). distanceToZeroParallaxPlane() is set to sceneRadius()/tan(fieldOfView()/2) (used only for stereo mode, see QGLViewer::setStereoDisplay(), setFieldOfView() and setDistanceToZeroParallaxPlane()). See also setSceneBoundingBox(). |
|
|
Defines the camera type. Supported types are defined by the Type() enum. loadProjectionMatrix() will create the camera accordingly. Use type() to get the current value.
myViewer.camera()->setType(qglviewer::Camera::ORTHO);
myViewer.camera()->showEntireScene();
|
|
||||||||||||||||||||
|
Same as setUpVector(), but with float parameters. |
|
||||||||||||
|
Rotate the camera such that its up vector becomes Use this function in order to define the horizontal plane in FLY mode. See setMode() for details.
However it might be interesting to compensate the orientation modification by a translation, so that the revolveAroundPoint() stays projected at the same position on screen. This is especially useful in the camera REVOLVE mode (see setMode()) and can be achieved when |
|
||||||||||||
|
Update a copy of the QGLViewer window dimensions. Called by the QGLViewer when it is resized. You should not call this function directly, as the QGLViewer does it. However, if your Camera is used outside of a QGLViewer (offscreen rendering, shadow maps), you need to provide the screen width and height (see screenWidth() and screenHeight()) in order to define the camera aspectRatio() which is used to define the projection matrix in loadProjectionMatrix(). |
|
|
This value is used when the camera is inside the sceneRadius(), sceneCenter() sphere. The zNear() value is then set to zNearCoef() * sceneRadius(). Default value is 0.001, which is appropriate for walkthrough applications. In case you need a high dynamic ZBuffer precision, you can increase this value (~0.1). A lower value will prevent clipping of very close objects at the expense of a worst Z precision. |
|
|
Adjust the camera so that the entire scene is visible. The camera is translated to make the entire scene fit the window, its orientation() is unchanged. The scene is defined by the QGLViewer::sceneCenter() and QGLViewer::sceneRadius(). The fieldOfView() is not modified by this function. QGLViewer::showEntireScene() simply calls this function. See also setFOVToFitScene(). You will typically use this function in QGLViewer::init(): setSceneRadius(3.0); showEntireScene(); You should orientate the camera before you call this function. See lookAt(), setOrientation() and setUpVector(). By default the QGLViewer::sceneRadius() is 1.0, and the QGLViewer constructor calls this function. See also centerScene(). ManipulatedCameraFrame::mouseDoubleClickEvent() calls this function after a middle button double click. |
|
|
Change camera mode (defined by the ManipulatedCameraFrame::Mode() enum), see mode() and setMode(). |
|
|
Returns the type of the camera used by the QGLViewer. Set by setType(). Supported types are defined by the Type() enum. Used by loadProjectionMatrix(). |
|
|
Returns the world unprojected coordinates of a point
This method is not computationally optimized. If you call it several times with no change in the matrices, you should buffer the entire inverse projection matrix (modelview, projection and then viewport) to speed-up the queries. See the projectedCoordinatesOf() performs the inverse transformation.
|
|
|
Return the current up vector of the camera, defined in the world coordinate system. See also setUpVector(). Simply returns : frame()->inverseTransformOf(Vec(0.0,1.0,0.0)); |
|
|
Returns the normalized view direction of the camera (negative Z axis), defined in the world coordinate system. |
|
|
Returns the world coordinates of the point whose position is |
|
|
Returns the zFar value used by the projection matrix. This value is fitted to sceneCenter() and sceneRadius() in order to ensure an optimal z sampling: float coef = sqrt(2.0); // so that a 1x1 grid fits if (cameraPathIsEdited()) coef = 5.0; zFar=distanceToSceneCenter() + coef*sceneRadius();
The
|
|
|
Returns the zNear value used by the projection matrix. This value is fitted to sceneCenter() and sceneRadius() in order to ensure an optimal z sampling: float coef = sqrt(2.0); // so that a 1x1 grid fits if (cameraPathIsEdited()) coef = 5.0; zNear = distanceToSceneCenter() - coef*sceneRadius(); // Prevents negative or null zNear values. if (zNear < zNearCoef() * sceneRadius()) switch (type()) { case Camera::PERSPECTIVE : z = zNearCoef() * sceneRadius(); break; case Camera::ORTHO : z = 0.0; break; } Returned value is clipped when the camera is inside the scene sphere to prevent negative or too small zNear() values (see setZNearCoef()).
The
|
|
|
Returns the coefficient which is used to set zNear() when the camera is inside the sceneRadius() sphere. Set with setZNearCoef(). |
1.3-rc2