StandardCamera Class Reference

Inheritance diagram for StandardCamera:

List of all members.

Public Member Functions

void changeOrthoFrustumSize (int delta)
virtual void getOrthoWidthHeight (GLdouble &halfWidth, GLdouble &halfHeight) const
 Returns the halfWidth and halfHeight of the Camera orthographic frustum.
virtual float zFar () const
 Returns the far clipping plane distance used by the Camera projection matrix.
virtual float zNear () const
 Returns the near clipping plane distance used by the Camera projection matrix.

Detailed Description

Definition at line 326 of file renderworld.cpp.


Member Function Documentation

virtual void getOrthoWidthHeight ( GLdouble &  halfWidth,
GLdouble &  halfHeight 
) const [inline, virtual]

Returns the halfWidth and halfHeight of the Camera orthographic frustum.

These values are only valid and used when the Camera is of type() Camera::ORTHOGRAPHIC. They are expressed in OpenGL units and are used by loadProjectionMatrix() to define the projection matrix using:

 glOrtho( -halfWidth, halfWidth, -halfHeight, halfHeight, zNear(), zFar() )

These values are proportional to the Camera (z projected) distance to the revolveAroundPoint(). When zooming on the object, the Camera is translated forward and its frustum is narrowed, making the object appear bigger on screen, as intuitively expected.

Overload this method to change this behavior if desired, as is done in the standardCamera example.

Reimplemented from Camera.

Definition at line 344 of file renderworld.cpp.

References Camera::aspectRatio().

virtual float zFar ( ) const [inline, virtual]

Returns the far clipping plane distance used by the Camera projection matrix.

The far clipping plane is positioned at a distance equal to zClippingCoefficient() * sceneRadius() behind the sceneCenter():

See the zNear() documentation for details.

Reimplemented from Camera.

Definition at line 334 of file renderworld.cpp.

virtual float zNear ( ) const [inline, virtual]

Returns the near clipping plane distance used by the Camera projection matrix.

The clipping planes' positions depend on the sceneRadius() and sceneCenter() rather than being fixed small-enough and large-enough values. A good scene dimension approximation will hence result in an optimal precision of the z-buffer.

The near clipping plane is positioned at a distance equal to zClippingCoefficient() * sceneRadius() in front of the sceneCenter():

In order to prevent negative or too small zNear() values (which would degrade the z precision), zNearCoefficient() is used when the Camera is inside the sceneRadius() sphere:

 const float zMin = zNearCoefficient() * zClippingCoefficient() * sceneRadius();
 if (zNear < zMin)
   zNear = zMin;
 // With an ORTHOGRAPHIC type, the value is simply clamped to 0.0

See also the zFar(), zClippingCoefficient() and zNearCoefficient() documentations.

If you need a completely different zNear computation, overload the zNear() and zFar() methods in a new class that publicly inherits from Camera and use QGLViewer::setCamera():

 class myCamera :: public qglviewer::Camera
 {
   virtual float Camera::zNear() const { return 0.001; };
   virtual float Camera::zFar() const { return 100.0; };
 }

See the standardCamera example for an application.

Attention:
The value is always positive although the clipping plane is positioned at a negative z value in the Camera coordinate system. This follows the gluPerspective standard.

Reimplemented from Camera.

Definition at line 331 of file renderworld.cpp.


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