Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

oxygen::Camera Class Reference

Camera encapsualtes all data needed to describe the viewpoint from which a scene is rendered. More...

#include <camera.h>

Inheritance diagram for oxygen::Camera:

Inheritance graph
[legend]
Collaboration diagram for oxygen::Camera:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Camera ()
virtual ~Camera ()
void SetViewport (int x, int y, int width, int height)
 sets viewpoint properties
int GetViewportX ()
int GetViewportY ()
int GetViewportWidth ()
int GetViewportHeight ()
void SetFOV (const float fov)
 sets the field of view (FOV)
void SetZNear (const float zNear)
 sets the distance of the Z near plane
void SetZFar (const float zFar)
 sets the distance of the Z far plane
void AdjustFOV (const float fov)
 adjusts the current FOV, i.e.
void AdjustZNear (const float zNear)
 adjusts the distance of the Z near plane, i.e adds a delta increment
void AdjustZFar (const float zFar)
 adjusts the distance of the Z far plane, i.e adds a delta increment
float GetFOV () const
 returns the field of View
float GetZNear () const
 returns the distance of the Z near plane
float GetZFar () const
 returns the distance of the Z far plane
const salt::MatrixGetViewTransform () const
 returns the view transformation matrix
const salt::MatrixGetProjectionTransform () const
 returns the projection matrix
void DescribeFrustum (salt::Frustum &frustum) const
 fills in a frustum object with the correct parameters for this camera
void Bind ()
 sets the view transform to be the inverted WorldTransform and sets up the projection transform matrix

Protected Member Functions

virtual void OnLink ()
 gets the right viewport resolution

Protected Attributes

float mFOV
 horizontal field of view, default is 60 degrees
float mZNear
 near clipping plane, default is 1
float mZFar
 far clipping plane, default is 2000
int mX
 x-position of upper left viewport corner, default is 0
int mY
 y-position of upper left viewport corner, default is 0
int mWidth
 width of viewport, default is the engine window width
int mHeight
 height of viewport, default is the egine window height
float mHalfWorldWidth
float mHalfWorldHeight
salt::Matrix mViewTransform
 the view transformation matrix
salt::Matrix mProjectionTransform
 the projection matrix

Private Member Functions

virtual void UpdateHierarchyInternal ()
 calculates the view matrix (world->view space transformation)

Detailed Description

Camera encapsualtes all data needed to describe the viewpoint from which a scene is rendered.

The active camera is responsible to construct a frustum needed to render the scene.

Definition at line 35 of file camera.h.


Constructor & Destructor Documentation

Camera::Camera  ) 
 

Definition at line 29 of file camera.cpp.

References salt::Matrix::Identity(), mFOV, mHeight, mViewTransform, mWidth, mX, mY, mZFar, mZNear, and zeitgeist::Leaf::SetName().

Here is the call graph for this function:

Camera::~Camera  )  [virtual]
 

Definition at line 43 of file camera.cpp.


Member Function Documentation

void Camera::AdjustFOV const float  fov  ) 
 

adjusts the current FOV, i.e.

adds a delta increment

Definition at line 175 of file camera.cpp.

References mFOV.

void Camera::AdjustZFar const float  zFar  ) 
 

adjusts the distance of the Z far plane, i.e adds a delta increment

Definition at line 185 of file camera.cpp.

References mZFar.

void Camera::AdjustZNear const float  zNear  ) 
 

adjusts the distance of the Z near plane, i.e adds a delta increment

Definition at line 180 of file camera.cpp.

References mZNear.

void Camera::Bind  ) 
 

sets the view transform to be the inverted WorldTransform and sets up the projection transform matrix

Definition at line 93 of file camera.cpp.

References salt::Matrix::CalcInfiniteFrustum(), oxygen::BaseNode::GetWorldTransform(), salt::Matrix::InvertRotationMatrix(), mHalfWorldHeight, mHalfWorldWidth, mProjectionTransform, mViewTransform, mZNear, and salt::Matrix::RotateX().

Here is the call graph for this function:

void Camera::DescribeFrustum salt::Frustum frustum  )  const
 

fills in a frustum object with the correct parameters for this camera

The code extracts a frustum given the projection and view transforms. It is really fast and very generic because of that.

Definition at line 51 of file camera.cpp.

References salt::Plane::d, oxygen::BaseNode::GetWorldTransform(), salt::Matrix::m, salt::Frustum::mBasePos, salt::Frustum::mPlanes, mProjectionTransform, mViewTransform, salt::Plane::normal, salt::Plane::Normalize(), salt::Frustum::PI_BOTTOM, salt::Frustum::PI_FAR, salt::Frustum::PI_LEFT, salt::Frustum::PI_NEAR, salt::Frustum::PI_RIGHT, salt::Frustum::PI_TOP, salt::Matrix::Pos(), and salt::TVector3< DATATYPE, TYPE >::Set().

Here is the call graph for this function:

float Camera::GetFOV  )  const
 

returns the field of View

Definition at line 190 of file camera.cpp.

References mFOV.

const salt::Matrix & Camera::GetProjectionTransform  )  const
 

returns the projection matrix

Definition at line 210 of file camera.cpp.

References mProjectionTransform.

int Camera::GetViewportHeight  ) 
 

Definition at line 155 of file camera.cpp.

References mHeight.

int Camera::GetViewportWidth  ) 
 

Definition at line 150 of file camera.cpp.

References mWidth.

int Camera::GetViewportX  ) 
 

Definition at line 140 of file camera.cpp.

References mX.

int Camera::GetViewportY  ) 
 

Definition at line 145 of file camera.cpp.

References mY.

const salt::Matrix & Camera::GetViewTransform  )  const
 

returns the view transformation matrix

Definition at line 205 of file camera.cpp.

References mViewTransform.

float Camera::GetZFar  )  const
 

returns the distance of the Z far plane

Definition at line 200 of file camera.cpp.

References mZFar.

float Camera::GetZNear  )  const
 

returns the distance of the Z near plane

Definition at line 195 of file camera.cpp.

References mZNear.

void Camera::OnLink  )  [protected, virtual]
 

gets the right viewport resolution

Reimplemented from zeitgeist::Leaf.

Definition at line 108 of file camera.cpp.

References zeitgeist::Object::GetLog(), zeitgeist::Object::GetScript(), mHeight, and mWidth.

Here is the call graph for this function:

void Camera::SetFOV const float  fov  ) 
 

sets the field of view (FOV)

Definition at line 160 of file camera.cpp.

References mFOV.

void Camera::SetViewport int  x,
int  y,
int  width,
int  height
 

sets viewpoint properties

Definition at line 132 of file camera.cpp.

References mHeight, mWidth, mX, and mY.

void Camera::SetZFar const float  zFar  ) 
 

sets the distance of the Z far plane

Definition at line 170 of file camera.cpp.

References mZFar.

void Camera::SetZNear const float  zNear  ) 
 

sets the distance of the Z near plane

Definition at line 165 of file camera.cpp.

References mZNear.

void Camera::UpdateHierarchyInternal  )  [private, virtual]
 

calculates the view matrix (world->view space transformation)

Reimplemented from oxygen::BaseNode.

Definition at line 123 of file camera.cpp.

References salt::gClamp(), salt::gDegToRad(), mFOV, mHalfWorldHeight, mHalfWorldWidth, mHeight, mWidth, and mZNear.

Here is the call graph for this function:


Member Data Documentation

float oxygen::Camera::mFOV [protected]
 

horizontal field of view, default is 60 degrees

Definition at line 111 of file camera.h.

Referenced by AdjustFOV(), Camera(), GetFOV(), SetFOV(), and UpdateHierarchyInternal().

float oxygen::Camera::mHalfWorldHeight [protected]
 

Definition at line 131 of file camera.h.

Referenced by Bind(), and UpdateHierarchyInternal().

float oxygen::Camera::mHalfWorldWidth [protected]
 

Definition at line 130 of file camera.h.

Referenced by Bind(), and UpdateHierarchyInternal().

int oxygen::Camera::mHeight [protected]
 

height of viewport, default is the egine window height

Definition at line 129 of file camera.h.

Referenced by Camera(), GetViewportHeight(), OnLink(), SetViewport(), and UpdateHierarchyInternal().

salt::Matrix oxygen::Camera::mProjectionTransform [protected]
 

the projection matrix

Definition at line 137 of file camera.h.

Referenced by Bind(), DescribeFrustum(), and GetProjectionTransform().

salt::Matrix oxygen::Camera::mViewTransform [protected]
 

the view transformation matrix

Definition at line 134 of file camera.h.

Referenced by Bind(), Camera(), DescribeFrustum(), and GetViewTransform().

int oxygen::Camera::mWidth [protected]
 

width of viewport, default is the engine window width

Definition at line 126 of file camera.h.

Referenced by Camera(), GetViewportWidth(), OnLink(), SetViewport(), and UpdateHierarchyInternal().

int oxygen::Camera::mX [protected]
 

x-position of upper left viewport corner, default is 0

Definition at line 120 of file camera.h.

Referenced by Camera(), GetViewportX(), and SetViewport().

int oxygen::Camera::mY [protected]
 

y-position of upper left viewport corner, default is 0

Definition at line 123 of file camera.h.

Referenced by Camera(), GetViewportY(), and SetViewport().

float oxygen::Camera::mZFar [protected]
 

far clipping plane, default is 2000

Definition at line 117 of file camera.h.

Referenced by AdjustZFar(), Camera(), GetZFar(), and SetZFar().

float oxygen::Camera::mZNear [protected]
 

near clipping plane, default is 1

Definition at line 114 of file camera.h.

Referenced by AdjustZNear(), Bind(), Camera(), GetZNear(), SetZNear(), and UpdateHierarchyInternal().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:47:03 2006 for rcssserver3d by  doxygen 1.4.4