Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members | Related Pages

ViewVolume Class Reference

Defines a 3D view volume. More...

List of all members.

Public Member Functions

 ViewVolume ()
 Default constructor.
void getMatrices (Matrix &affine, Matrix &proj) const
 Returns two matrices corresponding to the view volume.
Matrix getMatrix () const
 Like the method above, but returns the affine and projection parts together in one matrix (i.e.
Matrix getCameraSpaceMatrix () const
 Returns a matrix that transforms the view volume into camera space: it translates the view volume so the view point is at the origin, and rotates it so the view direction is along the negative z axis.
void projectPointToLine (const Fusion::Vec2f &pt, Line &line) const
 Maps a 2d point (in 0 <= x,y <= 1) to a 3d line.
void projectToScreen (const Fusion::Vec3f &src, Fusion::Vec3f &dst) const
 Maps the 3d point in world coordinates to a 2d point in normalized screen coordinates (0 <= x,y,z <= 1, 0 <= z <= 1).
Plane getPlane (float distFromEye) const
 Returns a plane parallel to the near (or far) plane of the view volume at a given distance from the projection point (eye).
Fusion::Vec3f getSightPoint (float distFromEye) const
 Returns the point along the line of sight at the given distance from the projection point (eye).
Fusion::Vec3f getPlanePoint (float distFromEye, const Fusion::Vec2f &normPoint) const
 Returns the projection of a given point in normalized screen coords (see projectToScreen()) onto the plane parallel to the near plane that is at distFromEye units from the eye.
Fusion::Rotation getAlignRotation (bool rightAngleOnly=false) const
 Returns a rotation that would align a viewed object so that its positive x-axis (of its object space) is to the right in the view and it's positive y-axis is up.
float getWorldToScreenScale (const Fusion::Vec3f &worldCenter, float normRadius) const
 Returns a scale factor that would scale a unit sphere centered at worldCenter so that it would appear to have the given radius in normalized screen coordinates when projected onto the near plane.
Fusion::Vec2f projectBox (const Box3f &box) const
 Projects the given 3D bounding box onto the near plane and returns the size (in normalized screen coords) of the rectangular region that encloses it.
ViewVolume narrow (float left, float bottom, float right, float top) const
 Given a view volume, this narrows the view to the given sub-rectangle of the near plane.
ViewVolume narrow (const Box3f &box) const
 Narrow a view volume by the given box.
void ortho (float left, float right, float bottom, float top, float near, float far)
 Sets up an orthographic view volume with the given sides.
void perspective (float fovy, float aspect, float near, float far)
 Sets up a perspective view volume with the given field of view and aspect ratio.
void rotateCamera (const Fusion::Rotation &q)
 Rotate the camera view direction.
void translateCamera (const Fusion::Vec3f &v)
 Translate the camera viewpoint.
Fusion::Vec3f zVector () const
 Returns the positive z axis in eye space.
ViewVolume zNarrow (float near, float far) const
 Returns a narrowed view volume which contains as tightly as possible the given interval on the z axis (in eye space).
void scale (float factor)
 Scales width and height of view volume by given factor.
void scaleWidth (float ratio)
 Scales view volume to be the given ratio of its current width or height, leaving the resulting view volume centered about the same point (in the near plane) as the current one.
ProjectionType getProjectionType () const
 Get projection type.
const Fusion::Vec3f & getProjectionPoint () const
 Get projection point.
const Fusion::Vec3f & getProjectionDirection () const
 Get projection direction.
float getNearDist () const
 Returns distance from projection point to near plane.
float getWidth () const
 return bounds of viewing frustum


Detailed Description

Defines a 3D view volume.

For perspective projection, the view volume is a frustum. For orthographic (parallel) projection, the view volume is a rectangular prism.


Member Function Documentation

Fusion::Rotation getAlignRotation bool  rightAngleOnly = false  )  const
 

Returns a rotation that would align a viewed object so that its positive x-axis (of its object space) is to the right in the view and it's positive y-axis is up.

If rightAngleOnly is TRUE, it will come as close as it can to this goal by using only 90 degree rotations.

void getMatrices Matrix affine,
Matrix proj
const
 

Returns two matrices corresponding to the view volume.

The first is a viewing matrix, which is guaranteed to be an affine transformation. The second is suitable for use as a projection matrix in GL.

Matrix getMatrix  )  const
 

Like the method above, but returns the affine and projection parts together in one matrix (i.e.

affine.multRight( proj ) ).

ViewVolume narrow const Box3f &  box  )  const
 

Narrow a view volume by the given box.

The box must lie inside the unit cube, and the view will be shrunk according to the size of the box.

ViewVolume narrow float  left,
float  bottom,
float  right,
float  top
const
 

Given a view volume, this narrows the view to the given sub-rectangle of the near plane.

The coordinates of the rectangle are between 0 and 1, where (0,0) is the lower-left corner of the near plane and (1,1) is the upper-right corner.

void ortho float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far
 

Sets up an orthographic view volume with the given sides.

The parameters are the same as for the GL ortho() routine.

void perspective float  fovy,
float  aspect,
float  near,
float  far
 

Sets up a perspective view volume with the given field of view and aspect ratio.

The parameters are the same as for the GL perspective() routine, except that the field of view angle is specified in radians.

void projectToScreen const Fusion::Vec3f &  src,
Fusion::Vec3f &  dst
const
 

Maps the 3d point in world coordinates to a 2d point in normalized screen coordinates (0 <= x,y,z <= 1, 0 <= z <= 1).

The z-screen coordinate represents the homogonized z coordinate which goes (non-linearly) from 0 at the near clipping plane to 1 at the far clipping plane.

void rotateCamera const Fusion::Rotation &  q  ) 
 

Rotate the camera view direction.

Note that this accomplishes the reverse of doing a GL rotate() command after defining a camera, which rotates the scene viewed by the camera.

void translateCamera const Fusion::Vec3f &  v  ) 
 

Translate the camera viewpoint.

Note that this accomplishes the reverse of doing a GL translate() command after defining a camera, which translates the scene viewed by the camera.

ViewVolume zNarrow float  near,
float  far
const
 

Returns a narrowed view volume which contains as tightly as possible the given interval on the z axis (in eye space).

The returned view volume will never be larger than the current volume, however. Near and far are given in terms of zVector(): this means that near > far must hold.

Fusion::Vec3f zVector  )  const
 

Returns the positive z axis in eye space.

In this coordinate system, the z value of the near plane should be GREATER than the z value of the far plane.


Generated on Sat Apr 1 06:08:10 2006 for Emma Content Development Kit by  doxygen 1.4.3