Overview     Modules     Class Hierarchy     Classes     Members  

tlp::Camera Class Reference

Tulip OpenGL camera object. More...

#include <Camera.h>

Collaboration diagram for tlp::Camera:

List of all members.

Public Member Functions


Detailed Description

Tulip OpenGL camera object.

This camera can be a 2D or 3D camera After setup you can do some basic operation :

  • Move, rotate, strafeLeftRight and strafeUpDown to modify poitn of view
  • You can directly modify camera infor mation with setSceneRadius, setZoomFactor, setEyes, setCenter and setUp
  • You can transform screen coordinates to 3D world coordinates with screenTo3DWorld function and vise versa with worldTo2DScreen function

Constructor & Destructor Documentation

tlp::Camera::Camera ( GlScene scene,
Coord  center = Coord(0, 0, 0),
Coord  eyes = Coord(0, 0, 10),
Coord  up = Coord(0,-1, 0),
double  zoomFactor = 0.5,
double  sceneRadius = 10 
)

Constructor

tlp::Camera::Camera ( GlScene scene,
bool  d3 
)

Constructor : use for 2D camera

tlp::Camera::~Camera (  ) 

Destructor


Member Function Documentation

void tlp::Camera::addObjectTransformation ( const Coord &  translation,
const Coord &  scale,
const Coord &  baseCoord 
)

Set translate/scale transformation of object It use to compute lod of nodes/edges in metanodes

Coord tlp::Camera::getCenter (  )  [inline]

Return the center

Coord tlp::Camera::getEyes (  )  [inline]

Return the eyes

void tlp::Camera::getModelviewMatrix ( Matrix< float, 4 > &  modelviewMatrix  )  [inline]

Get the modelview matrix

void tlp::Camera::getObjectTransformation ( std::vector< Coord > &  translation,
std::vector< Coord > &  scale,
std::vector< Coord > &  objectCoord 
)

Get translate/scale transformation of object It use to compute lod of nodes/edges in metanodes

void tlp::Camera::getProjAndMVMatrix ( const Vector< int, 4 > &  viewport,
Matrix< float, 4 > &  projectionMatrix,
Matrix< float, 4 > &  modelviewMatrix 
)

Get the projection and the modelview matrix generated with the given viewport

void tlp::Camera::getProjectionMatrix ( Matrix< float, 4 > &  projectionMatrix  )  [inline]

Get the projection matrix

GlScene* tlp::Camera::getScene (  )  [inline]

Return the camera's scene

double tlp::Camera::getSceneRadius (  )  [inline]

Return the scene radius

void tlp::Camera::getTransformMatrix ( const Vector< int, 4 > &  viewport,
Matrix< float, 4 > &  transformMatrix 
)

Get the transform matrix generated with the given viewport

void tlp::Camera::getTransformMatrix ( Matrix< float, 4 > &  transformMatrix  )  [inline]

Get the transform matrix : transformMatrix = projectionMatrix * modelviewMatrix

Coord tlp::Camera::getUp (  )  [inline]

Return the up vector

Vector<int, 4> tlp::Camera::getViewport (  ) 

Return the viewport of the attached scene

void tlp::Camera::getXML ( xmlNodePtr  rootNode  ) 

Get the camera's data in XML form

double tlp::Camera::getZoomFactor (  )  [inline]

Return the zoom factor

bool tlp::Camera::haveObjectTransformation (  ) 

Return true if object transformation is set

void tlp::Camera::initGl (  ) 

Init Gl parameters

void tlp::Camera::initLight (  ) 

Init light

void tlp::Camera::initModelView (  ) 

Init modelview

void tlp::Camera::initProjection ( bool  reset = true  ) 

Init projection with the scene viewport. Load identity matrix if reset is set as true

void tlp::Camera::initProjection ( const Vector< int, 4 > &  viewport,
bool  reset = true 
)

Init projection with the gived viewport. Load identity matrix if reset is set as true

bool tlp::Camera::is3D (  )  [inline]

Return if the camera is a 3D one

void tlp::Camera::move ( float  speed  ) 

This moves the camera forward or backward depending on the speed

void tlp::Camera::rotate ( float  angle,
float  x,
float  y,
float  z 
)

This rotates the camera's eyes around the center depending on the values passed in.

Coord tlp::Camera::screenTo3DWorld ( const Coord &  point  ) 

Return the 3D world coordinate for the given screen point

Warning:
This function set up the projection and modelview matrix
void tlp::Camera::setCenter ( const Coord &  center  ) 

Set the center

void tlp::Camera::setEyes ( const Coord &  eyes  ) 

Set the eye

void tlp::Camera::setScene ( GlScene scene  ) 

Set the camera's scene : the viewport is store in the scene, so we must attach camera to a scene

void tlp::Camera::setSceneRadius ( double  sceneRadius,
const BoundingBox  sceneBoundingBox = BoundingBox() 
)

Set the scene radius

void tlp::Camera::setUp ( const Coord &  up  ) 

Set the up vector

void tlp::Camera::setWithXML ( xmlNodePtr  rootNode  ) 

Set the camera's data with XML

void tlp::Camera::setZoomFactor ( double  zoomFactor  ) 

Set the zoom factor

void tlp::Camera::strafeLeftRight ( float  speed  ) 

This strafes the camera left and right depending on the speed (-/+)

void tlp::Camera::strafeUpDown ( float  speed  ) 

This strafes the camera up and down depending on the speed (-/+)

Coord tlp::Camera::worldTo2DScreen ( const Coord &  obj  ) 

Return the screen position for the given 3D coordinate

Warning:
This function set up the projection and modelview matrix


Tulip Software by LaBRI Visualization Team    2001 - 2011