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 & operator= (const Camera &camera)
- ~Camera ()
- void setScene (GlScene *scene)
- GlScene * getScene () const
- void move (float speed)
- void strafeLeftRight (float speed)
- void strafeUpDown (float speed)
- void rotate (float angle, float x, float y, float z)
- bool is3D () const
- Vector< int, 4 > getViewport () const
- 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 () const
- void setZoomFactor (double zoomFactor)
- double getZoomFactor () const
- void setEyes (const Coord &eyes)
- Coord getEyes () const
- void setCenter (const Coord ¢er)
- Coord getCenter () const
- void setUp (const Coord &up)
- Coord getUp () const
- 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) const
- void getProjectionMatrix (Matrix< float, 4 > &projectionMatrix) const
- void getTransformMatrix (Matrix< float, 4 > &transformMatrix) const
- void getProjAndMVMatrix (const Vector< int, 4 > &viewport, Matrix< float, 4 > &projectionMatrix, Matrix< float, 4 > &modelviewMatrix) const
- void getTransformMatrix (const Vector< int, 4 > &viewport, Matrix< float, 4 > &transformMatrix) const
- Coord screenTo3DWorld (const Coord &point) const
- Coord worldTo2DScreen (const Coord &obj) const
- 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 |
|
) |
| |
Constructor : use for 2D camera
Member Function Documentation
Set translate/scale transformation of object It use to compute lod of nodes/edges in metanodes
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 |
|
) |
| const |
Get the projection and the modelview matrix generated with the given viewport
Get the projection matrix
Return the camera's scene
Get the transform matrix : transformMatrix = projectionMatrix * modelviewMatrix
Get the transform matrix generated with the given viewport
Return the viewport of the attached scene
Get the camera's data in XML form
Return true if object transformation is set
Init projection with the gived viewport. Load identity matrix if reset is set as true
Init projection with the scene viewport. Load identity matrix if reset is set as true
Return if the camera is a 3D one
This moves the camera forward or backward depending on the speed
This rotates the camera's eyes around the center depending on the values passed in.
Return the 3D world coordinate for the given screen point
- Warning:
- This function set up the projection and modelview matrix
Set the camera's scene : the viewport is store in the scene, so we must attach camera to a scene
Set the camera's data with XML
This strafes the camera left and right depending on the speed (-/+)
This strafes the camera up and down depending on the speed (-/+)
Return the screen position for the given 3D coordinate
- Warning:
- This function set up the projection and modelview matrix
|