Tulip  5.1.0
Large graphs analysis and drawing
tlp::Camera Class Reference

#include <Camera.h>

+ Inheritance diagram for tlp::Camera:
+ Collaboration diagram for tlp::Camera:

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 ()
 
BoundingBox getBoundingBox () const
 
Coord getCenter () const
 
Coord getEyes () const
 
GlScenegetScene () const
 
double getSceneRadius () const
 
Coord getUp () const
 
Vector< int, 4 > getViewport () const
 
virtual void getXML (std::string &outString)
 
double getZoomFactor () const
 
bool is3D () const
 
void loadCameraParametersWith (const Camera &camera)
 
void move (float speed)
 
Cameraoperator= (const Camera &camera)
 
void rotate (float angle, float x, float y, float z)
 
Coord screenTo3DWorld (const Coord &point) const
 
void setCenter (const Coord &center)
 
void setEyes (const Coord &eyes)
 
void setScene (GlScene *scene)
 
void setUp (const Coord &up)
 
virtual void setWithXML (const std::string &inString, unsigned int &currentPosition)
 
void setZoomFactor (double zoomFactor)
 
void strafeLeftRight (float speed)
 
void strafeUpDown (float speed)
 
Coord viewportTo3DWorld (const Coord &point) const
 
Coord worldTo2DScreen (const Coord &obj) const
 
Coord worldTo2DViewport (const Coord &obj) const
 
- Public Member Functions inherited from tlp::Observable
void addListener (Observable *const listener) const
 
void addObserver (Observable *const observer) const
 
unsigned int countListeners () const
 
unsigned int countObservers () const
 
unsigned int getReceived () const
 
unsigned int getSent () const
 
void removeListener (Observable *const listener) const
 
void removeObserver (Observable *const observerver) const
 

Additional Inherited Members

- Static Public Member Functions inherited from tlp::Observable
static tlp::node getNode (const tlp::Observable *obs)
 
static ObservablegetObject (tlp::node n)
 
static const tlp::VectorGraph & getObservableGraph ()
 
static unsigned int getScheduled (tlp::node n)
 
static void holdObservers ()
 
static bool isAlive (tlp::node n)
 
static unsigned int observersHoldCounter ()
 
static void unholdObservers ()
 
- Protected Member Functions inherited from tlp::Observable
 Observable (const Observable &)
 
tlp::Iterator< tlp::Observable * > * getObservables () const
 
bool hasOnlookers () const
 
void notifyObservers ()
 
void observableDeleted ()
 
Observableoperator= (const Observable &)
 
void sendEvent (const Event &message)
 
virtual void treatEvent (const Event &message)
 
virtual void treatEvents (const std::vector< Event > &events)
 

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 parameters with setSceneRadius, setZoomFactor, setEyes, setCenter and setUp
  • You can transform viewport coordinates to 3D world coordinates with viewportTo3DWorld() function and 3D world coordinates to viewport coordinates with worldTo2DViewport() function A camera is a main component of GlLayer and GlScene
    See also
    GlLayer
    GlScene

Definition at line 45 of file Camera.h.

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.

Parameters
sceneA layer is attached to a scene so we have to specify it in the constructor
center3D coordinates of point visualized by the camera
eye3D position of the camera
upnormalized up 3D coordinates of the camera
zoomFactorlevel of zoom of the camera
sceneRadiusscene radius of the camera
tlp::Camera::Camera ( GlScene scene,
bool  d3 
)

Constructor : used to create a 2D camera.

tlp::Camera::~Camera ( )

Destructor.

Member Function Documentation

BoundingBox tlp::Camera::getBoundingBox ( ) const

Return the camera bounding box.

This bounding box is the part of the scene visualized by this camera.

Coord tlp::Camera::getCenter ( ) const
inline

Return the center.

3D coordinates of point visualized by the camera

Definition at line 176 of file Camera.h.

Coord tlp::Camera::getEyes ( ) const
inline

Return the eyes.

3D position of the camera

Definition at line 161 of file Camera.h.

GlScene* tlp::Camera::getScene ( ) const
inline

Return the camera's scene.

Definition at line 81 of file Camera.h.

double tlp::Camera::getSceneRadius ( ) const
inline

Return the scene radius.

Definition at line 131 of file Camera.h.

Coord tlp::Camera::getUp ( ) const
inline

Return the up vector.

normalized up 3D coordinates of the camera

Definition at line 191 of file Camera.h.

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

Return the viewport of the attached scene.

virtual void tlp::Camera::getXML ( std::string &  outString)
virtual

Function to export data in outString (in XML format)

double tlp::Camera::getZoomFactor ( ) const
inline

Return the zoom factor.

level of zoom of the camera

Definition at line 146 of file Camera.h.

bool tlp::Camera::is3D ( ) const
inline

Return if the camera is a 3D one.

Definition at line 119 of file Camera.h.

void tlp::Camera::loadCameraParametersWith ( const Camera camera)
inline

Load this camera parameters (eye, center, zoom factor) with an other camera parameters.

Definition at line 88 of file Camera.h.

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

This function moves the camera forward or backward depending on the speed.

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

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

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

Return the 3D world coordinate for the given viewport point.

Warning
This function set up the projection and modelview matrix

Definition at line 205 of file Camera.h.

void tlp::Camera::setCenter ( const Coord &  center)

Set the center.

3D coordinates of point visualized by the camera

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

Set the eye.

3D position of the camera

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::setUp ( const Coord &  up)

Set the up vector.

normalized up 3D coordinates of the camera

virtual void tlp::Camera::setWithXML ( const std::string &  inString,
unsigned int &  currentPosition 
)
virtual

Function to set data with inString (in XML format)

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

Set the zoom factor.

level of zoom of the camera

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

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

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

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

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

Return the 3D world coordinate for the given viewport point.

Warning
This function set up the projection and modelview matrix
Coord tlp::Camera::worldTo2DScreen ( const Coord &  obj) const
inline

Return the viewport position for the given 3D coordinate.

Warning
This function set up the projection and modelview matrix

Definition at line 219 of file Camera.h.

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

Return the viewport position for the given 3D coordinate.

Warning
This function set up the projection and modelview matrix