VCamera Class Reference

#include <VCamera.h>

List of all members.

Public Member Functions

 VCamera ()
void setProjection (int width, int height)
void updateProjMatrix ()
void updateProjMatrixLeft ()
void updateProjMatrixRight ()
void setProjectionToInfinity ()
void setProjectionToNormal ()
void rotateX (float m_degrees)
void rotateY (float m_degrees)
void rotateZ (float m_degrees)
void rotate (float m_degrees, float ax, float ay, float az)
void lookInDirection (VVector eye, VVector view, VVector up)
void updateViewMatrix ()
void updateViewMatrixLeft ()
void updateViewMatrixRight ()
void mouseMove (float x, float y, float z)
void moveForward (float way)
void moveSideWards (float way)
const VMatrix getViewMatrix () const
void setViewMatrix (const VMatrix &m)
const VMatrix getProjMatrix () const
void setProjMatrix (const VMatrix &m)
const VQuaternion getOrientation () const
void setOrientation (const VQuaternion &q)
const VVector getPosition () const
VVector getUpVector ()
VVector getAtVector ()
void setPosition (VVector &v)
float * getViewMatrix ()
float * getProjectionMatrix ()
float getFov () const
void setFov (float m_fov)
float getAspecRatio () const
void setAspectRatio (float m_aspect)
void setStereoParameters (float m_ScreenDistance, float m_EyeSeparation)
void setOrthogonalCamera (VVector m_OrthogonalSize, bool m_OrthogonalCamera=true)
void setAsShadowCamera (bool m_IsShadow)

Private Attributes

float mFov
float mAspectRatio
float mNearPlane
float mFarPlane
VQuaternion mOrientation
VVector mPosition
VMatrix mViewMatrix
VMatrix mLeftViewMatrix
VMatrix mRightViewMatrix
VMatrix mProjMatrix
VMatrix mLeftProjMatrix
VMatrix mRightProjMatrix
float mEyeSeparation
float mScreenDistance
bool mMustUpdateProjection
bool mMustUpdateView
bool mOrthogonalCamera
VVector mOrthogonalSize
bool mIsShadowCamera


Detailed Description

Camera class. Class for generating and Manipulating the View and Projection Matrices uses Quaternions for Rotations

Definition at line 14 of file VCamera.h.


Constructor & Destructor Documentation

VCamera::VCamera (  ) 

StandardConstructor. Constructor for setting up the necessary Values sets the FOV to 45, the Nearplane to 0.1, the Farplane to 100

Definition at line 8 of file VCamera.cpp.

References mAspectRatio, and mFarPlane.


Member Function Documentation

void VCamera::setProjection ( int  width,
int  height 
)

Setup Method for Screensize. Sets the Screendimensions

Parameters:
width integer describing the width of the window
height integer describing the height of the window

Definition at line 24 of file VCamera.cpp.

References mAspectRatio, mMustUpdateProjection, and updateProjMatrix().

Referenced by VFlowRenderer::resize().

void VCamera::updateProjMatrix (  ) 

Updates the Projection Matrix. Updates the Projection Matrix To be called everytime the Projection Changes

Definition at line 42 of file VCamera.cpp.

References VMatrix::clearMatrix(), mAspectRatio, mFarPlane, mFov, mMustUpdateProjection, mNearPlane, mOrthogonalCamera, mProjMatrix, and PI.

Referenced by setProjection(), VFlowRenderer::setShaderWrapperGlyph(), VFlowRenderer::setShaderWrapperGlyphTf(), VFlowRenderer::setShaderWrapperIcon(), VFlowRenderer::setShaderWrapperLIC(), VFlowRenderer::setShaderWrapperLICTexture(), VFlowRenderer::setShaderWrapperLICTextureTf(), VFlowRenderer::setShaderWrapperLICTf(), VFlowRenderer::setShaderWrapperOLICTexture(), VFlowRenderer::setShaderWrapperPressure(), VFlowRenderer::setShaderWrapperStreamLines(), VFlowRenderer::setShaderWrapperStreamLinesGlyph(), VFlowRenderer::setShaderWrapperStreamLinesTf(), VFlowRenderer::setShaderWrapperStreamLinesTfGlyph(), VFlowRenderer::setShaderWrapperVelocity(), VFlowRenderer::setShaderWrapperVorticity(), updateProjMatrixLeft(), and updateProjMatrixRight().

void VCamera::updateProjMatrixLeft (  ) 

Updates the Projection Matrix for Left Eye. Updates the Projection Matrix for Left Eye To be called everytime the Projection Changes

Definition at line 96 of file VCamera.cpp.

References mEyeSeparation, mLeftProjMatrix, mMustUpdateProjection, mProjMatrix, mScreenDistance, and updateProjMatrix().

void VCamera::updateProjMatrixRight (  ) 

Updates the Projection Matrix for Right Eye. Updates the Projection Matrix for Right Eye To be called everytime the Projection Changes

Definition at line 113 of file VCamera.cpp.

References mEyeSeparation, mMustUpdateProjection, mProjMatrix, mRightProjMatrix, mScreenDistance, and updateProjMatrix().

void VCamera::setProjectionToInfinity (  ) 

Sets the Projection to Infinity. Sets the Projection to Infinity, e.g. used for Shadow Volumes

Definition at line 130 of file VCamera.cpp.

References mNearPlane, and mProjMatrix.

void VCamera::setProjectionToNormal (  ) 

Sets the Projection to Normal again. Sets the Projection to a non-infinity projection. Used in a normal case

Definition at line 140 of file VCamera.cpp.

References mFarPlane, mNearPlane, and mProjMatrix.

void VCamera::rotateX ( float  m_degrees  ) 

Rotates the Camera around the local X-Axis.

Parameters:
m_degrees float value for rotation angle

Definition at line 150 of file VCamera.cpp.

References VQuaternion::applyRotationX(), mMustUpdateView, mOrientation, and VQuaternion::normalize().

void VCamera::rotateY ( float  m_degrees  ) 

Rotates the Camera around the local Y-Axis.

Parameters:
m_degrees float value for rotation angle

Definition at line 161 of file VCamera.cpp.

References VQuaternion::applyRotationY(), mMustUpdateView, mOrientation, and VQuaternion::normalize().

void VCamera::rotateZ ( float  m_degrees  ) 

Rotates the Camera around the local Z-Axis.

Parameters:
m_degrees float value for rotation angle

Definition at line 172 of file VCamera.cpp.

References VQuaternion::applyRotationZ(), mMustUpdateView, mOrientation, and VQuaternion::normalize().

void VCamera::rotate ( float  m_degrees,
float  ax,
float  ay,
float  az 
)

Rotates the Camera around an arbitrary axis.

Parameters:
m_degrees float value for rotation angle

Definition at line 179 of file VCamera.cpp.

References VQuaternion::applyRotationZ(), mMustUpdateView, mOrientation, and VQuaternion::normalize().

void VCamera::lookInDirection ( VVector  eye,
VVector  view,
VVector  up 
)

Sets some lookDirection Camera Parameters.

Parameters:
eye Vector3 position of eyepoint
view Vector3 view direction
up Vector3 the upvector of the camera

Definition at line 193 of file VCamera.cpp.

References VMatrix::clearMatrix(), VVector::getCross(), VMatrix::getRotation(), VVector::getX(), VVector::getY(), VVector::getZ(), mMustUpdateView, mOrientation, mPosition, mViewMatrix, VQuaternion::normalize(), VVector::normalize(), and VMatrix::translate().

Referenced by VFlowRenderer::processGuiInput(), and VFlowRenderer::VFlowRenderer().

void VCamera::updateViewMatrix (  ) 

Updates the View Matrix. Updates the View Matrix To be called every frame even if stereo rendering is used

Updates the View Matrix. Updates the View Matrix To be called every frame

Definition at line 244 of file VCamera.cpp.

References VMatrix::clearMatrix(), VQuaternion::getInverse(), mMustUpdateView, mOrientation, mPosition, mViewMatrix, VQuaternion::normalize(), VMatrix::rotate(), and VMatrix::translate().

Referenced by VFlowRenderer::setShaderWrapperGlyph(), VFlowRenderer::setShaderWrapperGlyphTf(), VFlowRenderer::setShaderWrapperIcon(), VFlowRenderer::setShaderWrapperLIC(), VFlowRenderer::setShaderWrapperLICTexture(), VFlowRenderer::setShaderWrapperLICTextureTf(), VFlowRenderer::setShaderWrapperLICTf(), VFlowRenderer::setShaderWrapperOLICTexture(), VFlowRenderer::setShaderWrapperPressure(), VFlowRenderer::setShaderWrapperStreamLines(), VFlowRenderer::setShaderWrapperStreamLinesGlyph(), VFlowRenderer::setShaderWrapperStreamLinesTf(), VFlowRenderer::setShaderWrapperStreamLinesTfGlyph(), VFlowRenderer::setShaderWrapperVelocity(), VFlowRenderer::setShaderWrapperVorticity(), updateViewMatrixLeft(), and updateViewMatrixRight().

void VCamera::updateViewMatrixLeft (  ) 

Updates the View Matrix for the Left Eye. Updates the View Matrix for the Left Eye To be called every frame IMPORTANT: only works if updateViewMatrix is called beforehand

Updates the View Matrix for the Left Eye. Updates the View Matrix for the Left Eye To be called every frame

Definition at line 264 of file VCamera.cpp.

References mEyeSeparation, mLeftViewMatrix, mMustUpdateView, mScreenDistance, mViewMatrix, and updateViewMatrix().

void VCamera::updateViewMatrixRight (  ) 

Updates the View Matrix for the Right Eye. Updates the View Matrix for the Right Eye IMPORTANT: only works if updateViewMatrix is called beforehand To be called every frame

Updates the View Matrix for the Right Eye. Updates the View Matrix for the Right Eye To be called every frame

Definition at line 281 of file VCamera.cpp.

References mEyeSeparation, mMustUpdateView, mRightViewMatrix, mScreenDistance, mViewMatrix, and updateViewMatrix().

void VCamera::mouseMove ( float  x,
float  y,
float  z 
)

Method for Controlling the Camera with the Mouse. Used when doing Mouse Motion

Parameters:
x float value of way in x direction
y float value of way in y direction
z float value of way in z direction

Definition at line 300 of file VCamera.cpp.

References mMustUpdateView, and mOrientation.

void VCamera::moveForward ( float  way  ) 

Moves the Camera forward. Used if camera only moves in the lookat direction

Parameters:
way float value of length of motion

Definition at line 324 of file VCamera.cpp.

References VQuaternion::getForwardVector(), mMustUpdateView, mOrientation, and mPosition.

void VCamera::moveSideWards ( float  way  ) 

Moves the Camera sidewards. Used for strafing. movement orthogonal to up and lookat vector

Parameters:
way float value of length of motion
sets up the necessary parameters for stereo rendering.
Parameters:
m_ScreenDistance distance to Screen
m_EyeSeparation eye separation of the two eyes

Definition at line 336 of file VCamera.cpp.

References VQuaternion::getRightVector(), mMustUpdateView, mOrientation, and mPosition.

const VMatrix VCamera::getViewMatrix (  )  const [inline]

returns the current Viewmatrix.

Returns:
Matrix4x4 the current Viewmatrix

Definition at line 148 of file VCamera.h.

References mViewMatrix.

Referenced by VFlowRenderer::getCameraSideVector(), VFlowRenderer::getCameraUpVector(), VFlowRenderer::getCameraViewMatrix(), VFlowRenderer::setShaderWrapperGlyph(), VFlowRenderer::setShaderWrapperGlyphTf(), VFlowRenderer::setShaderWrapperIcon(), VFlowRenderer::setShaderWrapperLIC(), VFlowRenderer::setShaderWrapperLICTexture(), VFlowRenderer::setShaderWrapperLICTextureTf(), VFlowRenderer::setShaderWrapperLICTf(), VFlowRenderer::setShaderWrapperOLICTexture(), VFlowRenderer::setShaderWrapperPressure(), VFlowRenderer::setShaderWrapperStreamLines(), VFlowRenderer::setShaderWrapperStreamLinesGlyph(), VFlowRenderer::setShaderWrapperStreamLinesTf(), VFlowRenderer::setShaderWrapperStreamLinesTfGlyph(), VFlowRenderer::setShaderWrapperVelocity(), and VFlowRenderer::setShaderWrapperVorticity().

void VCamera::setViewMatrix ( const VMatrix m  )  [inline]

sets the current Viewmatrix.

Parameters:
m Matrix4x4 the new viewmatrix

Definition at line 157 of file VCamera.h.

References mMustUpdateView, and mViewMatrix.

const VMatrix VCamera::getProjMatrix (  )  const [inline]

returns the current projectionmatrix.

Returns:
Matrix4x4 the current projectionmatrix

Definition at line 167 of file VCamera.h.

References mProjMatrix.

Referenced by VFlowRenderer::getCameraProjMatrix().

void VCamera::setProjMatrix ( const VMatrix m  )  [inline]

sets the current projectionmatrix.

Parameters:
m Matrix4x4 the new projectionmatrix

Definition at line 176 of file VCamera.h.

References mProjMatrix.

const VQuaternion VCamera::getOrientation (  )  const [inline]

returns the current orientation.

Returns:
Quaternion containing the rotation of the camera

Definition at line 185 of file VCamera.h.

References mOrientation.

void VCamera::setOrientation ( const VQuaternion q  )  [inline]

sets the current orientation.

Parameters:
q Quaternion containg the new orientation

Definition at line 194 of file VCamera.h.

References mOrientation.

const VVector VCamera::getPosition (  )  const [inline]

returns the current cameraposition.

Returns:
Vector3 containing the current position

Definition at line 203 of file VCamera.h.

References mPosition.

VVector VCamera::getUpVector (  )  [inline]

returns the current camera upt Vector

Returns:
Vector3 containing the current up vector

Definition at line 212 of file VCamera.h.

References VQuaternion::getUpVector(), and mOrientation.

VVector VCamera::getAtVector (  )  [inline]

returns the current camera at Vector

Returns:
Vector3 containing the current at vector

Definition at line 221 of file VCamera.h.

References VQuaternion::getForwardVector(), and mOrientation.

void VCamera::setPosition ( VVector v  )  [inline]

sets the current cameraposition.

Parameters:
v Vector3 containing the new camera position

Definition at line 230 of file VCamera.h.

References mMustUpdateView, and mPosition.

float* VCamera::getViewMatrix (  )  [inline]

returns a Pointer to the First View Matrix element

Returns:
float Ptr

Definition at line 240 of file VCamera.h.

References mViewMatrix.

float* VCamera::getProjectionMatrix (  )  [inline]

returns a Pointer to the First Projection Matrix element

Returns:
float Ptr

Definition at line 249 of file VCamera.h.

References mProjMatrix.

Referenced by VFlowRenderer::setShaderWrapperGlyph(), VFlowRenderer::setShaderWrapperGlyphTf(), VFlowRenderer::setShaderWrapperIcon(), VFlowRenderer::setShaderWrapperLIC(), VFlowRenderer::setShaderWrapperLICTexture(), VFlowRenderer::setShaderWrapperLICTextureTf(), VFlowRenderer::setShaderWrapperLICTf(), VFlowRenderer::setShaderWrapperOLICTexture(), VFlowRenderer::setShaderWrapperPressure(), VFlowRenderer::setShaderWrapperStreamLines(), VFlowRenderer::setShaderWrapperStreamLinesGlyph(), VFlowRenderer::setShaderWrapperStreamLinesTf(), VFlowRenderer::setShaderWrapperStreamLinesTfGlyph(), VFlowRenderer::setShaderWrapperVelocity(), and VFlowRenderer::setShaderWrapperVorticity().

float VCamera::getFov (  )  const [inline]

returns the field of view.

Returns:
float value containing the field of view of the camera

Definition at line 258 of file VCamera.h.

References mFov.

Referenced by VFlowRenderer::getCameraFOV().

void VCamera::setFov ( float  m_fov  )  [inline]

sets the field of view.

Parameters:
m_fov float value containing the new field of view

Definition at line 267 of file VCamera.h.

References mFov, and mMustUpdateProjection.

float VCamera::getAspecRatio (  )  const [inline]

returns the camera aspect ratio.

Returns:
float value containing the aspect ratio

Definition at line 277 of file VCamera.h.

References mAspectRatio.

Referenced by VFlowRenderer::getCameraAspect().

void VCamera::setAspectRatio ( float  m_aspect  )  [inline]

sets the aspect ratio

Parameters:
m_aspect float value containing the current aspect ratio

Definition at line 286 of file VCamera.h.

References mAspectRatio, and mMustUpdateProjection.

void VCamera::setStereoParameters ( float  m_ScreenDistance,
float  m_EyeSeparation 
)

sets up the necessary parameters for stereo rendering.

Parameters:
m_ScreenDistance distance to Screen
m_EyeSeparation eye separation of the two eyes
sets up the necessary parameters for stereo rendering.
Parameters:
m_ScreenDistance focal length of the camera
m_EyeSeparation eye separation of the two eyes

Definition at line 348 of file VCamera.cpp.

References mEyeSeparation, mMustUpdateProjection, and mScreenDistance.

void VCamera::setOrthogonalCamera ( VVector  m_OrthogonalSize,
bool  m_OrthogonalCamera = true 
) [inline]

sets up the camera for orthogonal Projection

Parameters:
m_OrthogonalSize Vector2 containing the EdgePoints
m_OrthogonalCamera for activating

Definition at line 304 of file VCamera.h.

References mMustUpdateProjection, mOrthogonalCamera, and mOrthogonalSize.

void VCamera::setAsShadowCamera ( bool  m_IsShadow  )  [inline]

sets if the camera is ShadowCamera

Parameters:
m_IsShadow if it is ShadowCamera

Definition at line 315 of file VCamera.h.

References mIsShadowCamera.


Member Data Documentation

float VCamera::mFov [private]

Camera Field of View.

Definition at line 323 of file VCamera.h.

Referenced by getFov(), setFov(), and updateProjMatrix().

float VCamera::mAspectRatio [private]

Camera aspect ratio.

Definition at line 324 of file VCamera.h.

Referenced by getAspecRatio(), setAspectRatio(), setProjection(), updateProjMatrix(), and VCamera().

float VCamera::mNearPlane [private]

Distance to NearPlane.

Definition at line 325 of file VCamera.h.

Referenced by setProjectionToInfinity(), setProjectionToNormal(), and updateProjMatrix().

float VCamera::mFarPlane [private]

Distance to FarPlane.

Definition at line 326 of file VCamera.h.

Referenced by setProjectionToNormal(), updateProjMatrix(), and VCamera().

VQuaternion VCamera::mOrientation [private]

Camera Orientation.

Definition at line 328 of file VCamera.h.

Referenced by getAtVector(), getOrientation(), getUpVector(), lookInDirection(), mouseMove(), moveForward(), moveSideWards(), rotate(), rotateX(), rotateY(), rotateZ(), setOrientation(), and updateViewMatrix().

VVector VCamera::mPosition [private]

Camera Position.

Definition at line 329 of file VCamera.h.

Referenced by getPosition(), lookInDirection(), moveForward(), moveSideWards(), setPosition(), and updateViewMatrix().

VMatrix VCamera::mViewMatrix [private]

Current View Matrix.

Definition at line 331 of file VCamera.h.

Referenced by getViewMatrix(), lookInDirection(), setViewMatrix(), updateViewMatrix(), updateViewMatrixLeft(), and updateViewMatrixRight().

VMatrix VCamera::mLeftViewMatrix [private]

Current View Matrix for the left Eye.

Definition at line 332 of file VCamera.h.

Referenced by updateViewMatrixLeft().

VMatrix VCamera::mRightViewMatrix [private]

Current View Matrix for the right Eye.

Definition at line 333 of file VCamera.h.

Referenced by updateViewMatrixRight().

VMatrix VCamera::mProjMatrix [private]

Current Projection Matrix.

Definition at line 334 of file VCamera.h.

Referenced by getProjectionMatrix(), getProjMatrix(), setProjectionToInfinity(), setProjectionToNormal(), setProjMatrix(), updateProjMatrix(), updateProjMatrixLeft(), and updateProjMatrixRight().

VMatrix VCamera::mLeftProjMatrix [private]

Current Projection Matrix for the left Eye.

Definition at line 335 of file VCamera.h.

Referenced by updateProjMatrixLeft().

VMatrix VCamera::mRightProjMatrix [private]

Current Projection Matrix for the right Eye.

Definition at line 336 of file VCamera.h.

Referenced by updateProjMatrixRight().

float VCamera::mEyeSeparation [private]

Eye Seperation.

Definition at line 340 of file VCamera.h.

Referenced by setStereoParameters(), updateProjMatrixLeft(), updateProjMatrixRight(), updateViewMatrixLeft(), and updateViewMatrixRight().

float VCamera::mScreenDistance [private]

distance to screen.

Definition at line 341 of file VCamera.h.

Referenced by setStereoParameters(), updateProjMatrixLeft(), updateProjMatrixRight(), updateViewMatrixLeft(), and updateViewMatrixRight().

bool VCamera::mMustUpdateProjection [private]

Bool Containing if Projection Matrix needs updating.

Definition at line 343 of file VCamera.h.

Referenced by setAspectRatio(), setFov(), setOrthogonalCamera(), setProjection(), setStereoParameters(), updateProjMatrix(), updateProjMatrixLeft(), and updateProjMatrixRight().

bool VCamera::mMustUpdateView [private]

Bool Containing if View Matrix needs updating.

Definition at line 344 of file VCamera.h.

Referenced by lookInDirection(), mouseMove(), moveForward(), moveSideWards(), rotate(), rotateX(), rotateY(), rotateZ(), setPosition(), setViewMatrix(), updateViewMatrix(), updateViewMatrixLeft(), and updateViewMatrixRight().

bool VCamera::mOrthogonalCamera [private]

if Camera is Orthogonal Camera.

Definition at line 346 of file VCamera.h.

Referenced by setOrthogonalCamera(), and updateProjMatrix().

VVector VCamera::mOrthogonalSize [private]

Size of Orthogonal Camera.

Definition at line 347 of file VCamera.h.

Referenced by setOrthogonalCamera().

bool VCamera::mIsShadowCamera [private]

if Camera is Shadow Camera.

Definition at line 348 of file VCamera.h.

Referenced by setAsShadowCamera().


The documentation for this class was generated from the following files:
Generated on Mon Jan 21 01:15:16 2008 for FlowVis by  doxygen 1.5.4