tlp::Camera Class Reference
Tulip OpenGL camera object.
More...
#include <Camera.h>
List of all members.
Public Member Functions
- 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)
- Camera (GlScene *scene, bool d3)
- ~Camera ()
- void setScene (GlScene *scene)
- GlScene * getScene ()
- void move (float speed)
- void strafeLeftRight (float speed)
- void strafeUpDown (float speed)
- void rotate (float angle, float x, float y, float z)
- bool is3D ()
- Vector< int, 4 > getViewport ()
- void initGl ()
- void initLight ()
- void initProjection (const Vector< int, 4 > &viewport, bool reset=true)
- void initProjection (bool reset=true)
- void initModelView ()
- void setSceneRadius (double sceneRadius, const BoundingBox sceneBoundingBox=BoundingBox())
- double getSceneRadius ()
- void setZoomFactor (double zoomFactor)
- double getZoomFactor ()
- void setEyes (const Coord &eyes)
- Coord getEyes ()
- void setCenter (const Coord ¢er)
- Coord getCenter ()
- void setUp (const Coord &up)
- Coord getUp ()
- void addObjectTransformation (const Coord &translation, const Coord &scale, const Coord &baseCoord)
- void getObjectTransformation (std::vector< Coord > &translation, std::vector< Coord > &scale, std::vector< Coord > &objectCoord)
- bool haveObjectTransformation ()
- void getModelviewMatrix (Matrix< float, 4 > &modelviewMatrix)
- void getProjectionMatrix (Matrix< float, 4 > &projectionMatrix)
- void getTransformMatrix (Matrix< float, 4 > &transformMatrix)
- void getProjAndMVMatrix (const Vector< int, 4 > &viewport, Matrix< float, 4 > &projectionMatrix, Matrix< float, 4 > &modelviewMatrix)
- void getTransformMatrix (const Vector< int, 4 > &viewport, Matrix< float, 4 > &transformMatrix)
- Coord screenTo3DWorld (const Coord &point)
- Coord worldTo2DScreen (const Coord &obj)
- void getXML (xmlNodePtr rootNode)
- void setWithXML (xmlNodePtr rootNode)
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 | |
|
) |
| | |
tlp::Camera::Camera |
( |
GlScene * |
scene, |
|
|
bool |
d3 | |
|
) |
| | |
Constructor : use for 2D camera
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] |
Coord tlp::Camera::getEyes |
( |
|
) |
[inline] |
void tlp::Camera::getModelviewMatrix |
( |
Matrix< float, 4 > & |
modelviewMatrix |
) |
[inline] |
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] |
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] |
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] |
bool tlp::Camera::haveObjectTransformation |
( |
|
) |
|
Return true if object transformation is set
void tlp::Camera::initGl |
( |
|
) |
|
void tlp::Camera::initLight |
( |
|
) |
|
void tlp::Camera::initModelView |
( |
|
) |
|
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 |
) |
|
void tlp::Camera::setEyes |
( |
const Coord & |
eyes |
) |
|
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() | |
|
) |
| | |
void tlp::Camera::setUp |
( |
const Coord & |
up |
) |
|
void tlp::Camera::setWithXML |
( |
xmlNodePtr |
rootNode |
) |
|
Set the camera's data with XML
void tlp::Camera::setZoomFactor |
( |
double |
zoomFactor |
) |
|
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
|