CameraGL Class Reference

#include <CameraGL.h>

Inheritance diagram for CameraGL:

Camera GRAObject List of all members.

Public Types

enum  PixelSample {
  PS_CENTROID, PS_UPPER_LEFT_CORNER, PS_UPPER_RIGHT_CORNER, PS_LOWER_RIGHT_CORNER,
  PS_LOWER_LEFT_CORNER, PS_RANDOM
}

Public Member Functions

 CameraGL (AutoPtr< Projection > *pAP)
 CameraGL (const Camera &src)
virtual void setTransform (const Matrix4 &trMat)
virtual void unsetTransform ()
virtual void rotateX (float)
virtual void rotateY (float)
virtual void rotateZ (float)
virtual void rotate (float, const Vector3 &)
virtual void translate (float, float, float)
virtual void setProjection (AutoPtr< Projection > *)
virtual bool isTransformed (Matrix4 *pTrMat) const
const ProjectiongetProjection () const
Vector2 getPixelSize (unsigned resX, unsigned resY) const
void getProjectionPlane (Vector3 &ll, Vector3 &ul, Vector3 &ur, Vector3 &lr) const
virtual Vector2 mapPixelToProjPlane (unsigned posX, unsigned posY, unsigned resX, unsigned resY, PixelSample sample) const
virtual Vector3 getProjectionDirection (const Vector2 &point)
virtual Vector3 getDirection ()
virtual Vector3 getZenith ()
virtual Vector2 project (const Vector3 &point) const
virtual bool projectAndClip (const Vector3 &point, Vector2 *res) const

Static Public Member Functions

static void setOpenGLTransform (const Matrix4 &trMat)

Static Protected Member Functions

static void _set_orthogonal_proj (const Projection &)
static void _set_perspective_proj (const Projection &)

Protected Attributes

Matrix4 * _pTrMat
AutoPtr< Projection > * _pAProjection
Projection_pProjection

Detailed Description

Definition at line 16 of file CameraGL.h.


Member Enumeration Documentation

enum PixelSample [inherited]
 

Enumerator:
PS_CENTROID 
PS_UPPER_LEFT_CORNER 
PS_UPPER_RIGHT_CORNER 
PS_LOWER_RIGHT_CORNER 
PS_LOWER_LEFT_CORNER 
PS_RANDOM 

Definition at line 35 of file Camera.h.


Constructor & Destructor Documentation

CameraGL AutoPtr< Projection > *  pAP  ) 
 

Constuctor

= projection of the camera

Definition at line 36 of file CameraGL.cc.

References Camera::_pProjection, CameraGL::_set_orthogonal_proj(), and CameraGL::_set_perspective_proj().

CameraGL const Camera src  ) 
 

Copy contructor. Both the tranformation and projection matrices are cloned. OpenGL projection and/or transfomation matrices are set.

= source camera

Definition at line 49 of file CameraGL.cc.

References Camera::_pProjection, Camera::_pTrMat, CameraGL::_set_orthogonal_proj(), CameraGL::_set_perspective_proj(), and CameraGL::setOpenGLTransform().


Member Function Documentation

void _set_orthogonal_proj const Projection  )  [static, protected]
 

Definition at line 7 of file CameraGL.cc.

References Projection::getBottomPlane(), Projection::getFarPlane(), Projection::getLeftPlane(), Projection::getNearPlane(), Projection::getRightPlane(), and Projection::getTopPlane().

Referenced by CameraGL::CameraGL(), and CameraGL::setProjection().

void _set_perspective_proj const Projection  )  [static, protected]
 

Definition at line 20 of file CameraGL.cc.

References Projection::getBottomPlane(), Projection::getFarPlane(), Projection::getLeftPlane(), Projection::getNearPlane(), Projection::getRightPlane(), and Projection::getTopPlane().

Referenced by CameraGL::CameraGL(), and CameraGL::setProjection().

Vector3 getDirection  )  [virtual, inherited]
 

Returns:
camera's normalized direction in the world coord. system

Definition at line 186 of file Camera.cc.

References Camera::_pTrMat.

Vector2 getPixelSize unsigned  resX,
unsigned  resY
const [inherited]
 

Return space occupied by single pixel of frame-buffer

Parameters:
resX X resolution of "CCD Chip" (frame-buffer) in pixels
resY Y resolution of "CCD Chip" (frame-buffer) in pixels
Returns:
space occupied by single pixel of the frame-buffer

Definition at line 114 of file Camera.cc.

References Camera::_pProjection, Projection::getBottomPlane(), Projection::getLeftPlane(), Projection::getRightPlane(), and Projection::getTopPlane().

Referenced by RTRender::_render().

const Projection& getProjection  )  const [inline, inherited]
 

Returns:
constant reference to actual projectin matrix

Definition at line 138 of file Camera.h.

Referenced by FrameBufferGL::setColor().

Vector3 getProjectionDirection const Vector2 &  point  )  [virtual, inherited]
 

Return projection direction of the point at projection plane

Parameters:
point point at projection plane, see mapPixelToProjPlane() and project()
Returns:
normalized vector in the world coordinate system going through the point

Definition at line 175 of file Camera.cc.

References Camera::_pProjection, Camera::_pTrMat, and Projection::getProjectionDirection().

Referenced by RTRender::_render_pixel_centroid(), RTRender::_render_pixel_corners(), RTRender::_render_pixel_randomly(), and RTRender::_render_pixel_stratified().

void getProjectionPlane Vector3 &  ll,
Vector3 &  ul,
Vector3 &  ur,
Vector3 &  lr
const [inherited]
 

Returns corners of the projection area in the world coord. system

Parameters:
ll lower-left corner
ul upper-left corner
ur upper-right corner
lr lower-right corner

Definition at line 120 of file Camera.cc.

References Camera::_pProjection, Camera::_pTrMat, and Projection::getProjectionArea().

Referenced by RTRender::_render().

Vector3 getZenith  )  [virtual, inherited]
 

Returns:
normalized 'zenith' direction in the world coord. system

Definition at line 197 of file Camera.cc.

References Camera::_pTrMat.

bool isTransformed Matrix4 *  pTrMat  )  const [virtual, inherited]
 

Check whether the camera is transformed. If so then return tr. mat

Parameters:
pTrMat when non zero and transf. is present then it contains the copy of actual tr. matrix at output
Returns:
true if camera is transformed, false otherwise

Definition at line 95 of file Camera.cc.

References Camera::_pTrMat.

Vector2 mapPixelToProjPlane unsigned  posX,
unsigned  posY,
unsigned  resX,
unsigned  resY,
PixelSample  sample
const [virtual, inherited]
 

Compute position of pixel on the projection plane of camera

Parameters:
posX X pixel position, 0 = left
posY Y pixel position, 0 = bottom
resX X resolution of "CCD Chip" (frame-buffer) in pixels
resY Y resolution of "CCD Chip" (frame-buffer) in pixels
sample relative point inside the pixel that is sampled
Returns:
point in coord system of camera lieing at the projection plane; (0,0) is lower left corner

Definition at line 134 of file Camera.cc.

References Camera::_pProjection, Projection::getBottomPlane(), Projection::getLeftPlane(), Projection::getRightPlane(), Projection::getTopPlane(), Camera::PS_CENTROID, Camera::PS_LOWER_LEFT_CORNER, Camera::PS_LOWER_RIGHT_CORNER, Camera::PS_RANDOM, Camera::PS_UPPER_LEFT_CORNER, and Camera::PS_UPPER_RIGHT_CORNER.

Referenced by RTRender::_render_pixel_centroid(), RTRender::_render_pixel_corners(), and RTRender::_render_pixel_randomly().

Vector2 project const Vector3 &  point  )  const [virtual, inherited]
 

Project point is space onto the projection plane

Parameters:
point projecting point in space (in the world coord. system)
Returns:
position of the point at the projection plane (coord. system of the camera), [0,0] = lower-left corner of projection plane

Definition at line 208 of file Camera.cc.

References Camera::_pProjection, Camera::_pTrMat, Projection::getBottomPlane(), Projection::getLeftPlane(), and Projection::project().

Referenced by RTRender::_render_pixel_stratified().

bool projectAndClip const Vector3 &  point,
Vector2 *  res
const [virtual, inherited]
 

Project point is space onto the projection plane and then clip it

Parameters:
point projecting point in space (in the world coord. system)
res projected point ([0,0] = lower-left corner of projection plane)
Returns:
false if clipped, true otherwise

Definition at line 225 of file Camera.cc.

References Camera::_pProjection, Camera::_pTrMat, Projection::getBottomPlane(), Projection::getLeftPlane(), and Projection::projectAndClip().

void rotate float  ,
const Vector3 & 
[virtual]
 

Rotates the camera around axis

Parameters:
angle = angle in radians
axis = axis to rotate around to

Reimplemented from Camera.

Definition at line 123 of file CameraGL.cc.

References Camera::_pTrMat, Camera::rotate(), and CameraGL::setOpenGLTransform().

void rotateX float   )  [virtual]
 

Rotates the camera around axis

= angle in radians = axis to rotate around to

Reimplemented from Camera.

Definition at line 105 of file CameraGL.cc.

References Camera::_pTrMat, Camera::rotateX(), and CameraGL::setOpenGLTransform().

void rotateY float   )  [virtual]
 

Rotates the camera around Y axis

Parameters:
angle = angle in radians

Reimplemented from Camera.

Definition at line 111 of file CameraGL.cc.

References Camera::_pTrMat, Camera::rotateY(), and CameraGL::setOpenGLTransform().

void rotateZ float   )  [virtual]
 

Rotates the camera around Z axis

Parameters:
angle = angle in radians

Reimplemented from Camera.

Definition at line 117 of file CameraGL.cc.

References Camera::_pTrMat, Camera::rotateZ(), and CameraGL::setOpenGLTransform().

void setOpenGLTransform const Matrix4 &  trMat  )  [static]
 

Do OpenGL transformation

= new transformation matrix

Definition at line 64 of file CameraGL.cc.

Referenced by CameraGL::CameraGL(), CameraGL::rotate(), CameraGL::rotateX(), CameraGL::rotateY(), CameraGL::rotateZ(), CameraGL::setTransform(), and CameraGL::translate().

void setProjection AutoPtr< Projection > *   )  [virtual]
 

Set new projection

= new projection

Reimplemented from Camera.

Definition at line 142 of file CameraGL.cc.

References Camera::_pProjection, CameraGL::_set_orthogonal_proj(), CameraGL::_set_perspective_proj(), and Camera::setProjection().

void setTransform const Matrix4 &  trMat  )  [virtual]
 

Tranform camera

= new transformation matrix

Reimplemented from Camera.

Definition at line 99 of file CameraGL.cc.

References CameraGL::setOpenGLTransform(), and Camera::setTransform().

void translate float  ,
float  ,
float 
[virtual]
 

Traslates the camera , , = translation vector

Reimplemented from Camera.

Definition at line 129 of file CameraGL.cc.

References Camera::_pTrMat, CameraGL::setOpenGLTransform(), and Camera::translate().

void unsetTransform  )  [virtual]
 

Clear camera transformations

Reimplemented from Camera.

Definition at line 135 of file CameraGL.cc.

References Camera::unsetTransform().


Member Data Documentation

AutoPtr<Projection>* _pAProjection [protected, inherited]
 

Definition at line 31 of file Camera.h.

Referenced by Camera::Camera(), Camera::setProjection(), and Camera::~Camera().

Projection* _pProjection [protected, inherited]
 

Definition at line 32 of file Camera.h.

Referenced by Camera::Camera(), CameraGL::CameraGL(), Camera::getPixelSize(), Camera::getProjectionDirection(), Camera::getProjectionPlane(), Camera::mapPixelToProjPlane(), Camera::project(), Camera::projectAndClip(), CameraGL::setProjection(), and Camera::setProjection().

Matrix4* _pTrMat [protected, inherited]
 

Definition at line 30 of file Camera.h.

Referenced by Camera::Camera(), CameraGL::CameraGL(), Camera::getDirection(), Camera::getProjectionDirection(), Camera::getProjectionPlane(), Camera::getZenith(), Camera::isTransformed(), Camera::project(), Camera::projectAndClip(), CameraGL::rotate(), Camera::rotate(), CameraGL::rotateX(), Camera::rotateX(), CameraGL::rotateY(), Camera::rotateY(), CameraGL::rotateZ(), Camera::rotateZ(), Camera::setTransform(), CameraGL::translate(), Camera::translate(), Camera::unsetTransform(), and Camera::~Camera().


The documentation for this class was generated from the following files:
Generated on Tue Nov 21 15:11:43 2006 for gra by  doxygen 1.4.6