23 #include <tulip/Coord.h>
24 #include <tulip/Matrix.h>
25 #include <tulip/BoundingBox.h>
26 #include <tulip/Observable.h>
58 Camera(
GlScene *scene, Coord center = Coord(0, 0, 0), Coord eyes = Coord(0, 0, 10),
59 Coord up = Coord(0, -1, 0),
double zoomFactor = 0.5,
double sceneRadius = 10);
117 void rotate(
float angle,
float x,
float y,
float z);
209 return viewportTo3DWorld(point);
223 return worldTo2DViewport(obj);
229 virtual void getXML(std::string &outString);
234 virtual void setWithXML(
const std::string &inString,
unsigned int ¤tPosition);
241 void getModelviewMatrix(Matrix<float, 4> &modelviewMatrix)
const {
242 modelviewMatrix = this->modelviewMatrix;
248 void getProjectionMatrix(Matrix<float, 4> &projectionMatrix)
const {
249 projectionMatrix = this->projectionMatrix;
255 void getTransformMatrix(Matrix<float, 4> &transformMatrix)
const {
256 transformMatrix = this->transformMatrix;
262 void getProjAndMVMatrix(
const Vector<int, 4> &viewport, Matrix<float, 4> &projectionMatrix,
263 Matrix<float, 4> &modelviewMatrix)
const;
268 void getTransformMatrix(
const Vector<int, 4> &viewport, Matrix<float, 4> &transformMatrix)
const;
283 void initProjection(
const Vector<int, 4> &viewport,
bool reset =
true);
288 void initProjection(
bool reset =
true);
293 void initModelView();
298 void setSceneRadius(
double sceneRadius,
const BoundingBox sceneBoundingBox = BoundingBox());
305 Coord center, eyes, up;
308 BoundingBox sceneBoundingBox;
312 Matrix<float, 4> modelviewMatrix;
313 Matrix<float, 4> projectionMatrix;
314 Matrix<float, 4> transformMatrix;
Tulip OpenGL camera object.
Coord viewportTo3DWorld(const Coord &point) const
Return the 3D world coordinate for the given viewport point.
void move(float speed)
This function moves the camera forward or backward depending on the speed.
void strafeLeftRight(float speed)
This function strafes the camera left and right depending on the speed (-/+)
const Coord & getUp() const
Return the up vector.
Coord screenTo3DWorld(const Coord &point) const
Return the 3D world coordinate for the given viewport point.
const Coord & getCenter() const
Return the center.
void setEyes(const Coord &eyes)
Set the eye.
BoundingBox getBoundingBox() const
Return the camera bounding box.
void setZoomFactor(double zoomFactor)
Set the zoom factor.
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.
virtual void getXML(std::string &outString)
Function to export data in outString (in XML format)
void 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.
void loadCameraParametersWith(const Camera &camera)
Load this camera parameters (eye, center, zoom factor) with an other camera parameters.
void setScene(GlScene *scene)
Set the camera's scene The viewport is store in the scene, so we must attach camera to a scene.
bool is3D() const
Return if the camera is a 3D one.
double getZoomFactor() const
Return the zoom factor.
const Vector< int, 4 > & getViewport() const
Return the viewport of the attached scene.
GlScene * getScene() const
Return the camera's scene.
void strafeUpDown(float speed)
This function strafes the camera up and down depending on the speed (-/+)
void setCenter(const Coord ¢er)
Set the center.
~Camera() override
Destructor.
Coord worldTo2DScreen(const Coord &obj) const
Return the viewport position for the given 3D coordinate.
Coord worldTo2DViewport(const Coord &obj) const
Return the viewport position for the given 3D coordinate.
const Coord & getEyes() const
Return the eyes.
void setUp(const Coord &up)
Set the up vector.
double getSceneRadius() const
Return the scene radius.
virtual void setWithXML(const std::string &inString, unsigned int ¤tPosition)
Function to set data with inString (in XML format)
Camera(GlScene *scene, bool d3)
Constructor : used to create a 2D camera.
The Observable class is the base of Tulip's observation system.
This class represents the 3D bounding box of an object. It is mostly used to determine whether or not...