/usr/include/tulip/Camera.h is in libtulip-ogl-dev 3.1.2-2.3ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | //-*-c++-*-
/**
Authors: David Auber, Patrick Mary, Morgan Mathiaut
from the LaBRI Visualization Team
Email : auber@tulip-software.org
Last modification : 13/03/2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
#ifndef TLPCAMERA_H
#define TLPCAMERA_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <tulip/Coord.h>
#include <tulip/Vector.h>
#include <tulip/Matrix.h>
#include "tulip/GlXMLTools.h"
namespace tlp {
/**
* Class use to store OpenGl camera
*/
class GlScene;
class TLP_GL_SCOPE Camera {
public:
/**
* Constructor
*/
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
*/
Camera(GlScene* scene,bool d3);
/**
* Set the camera's scene : the viewport is store in the scene, so we must attach camera to a scene
*/
void setScene(GlScene *scene);
/**
* Return the camera's scene
*/
GlScene *getScene() {return scene;}
/**
* This moves the camera forward or backward depending on the speed
*/
void move(float speed);
/**
* This strafes the camera left and right depending on the speed (-/+)
*/
void strafeLeftRight(float speed);
/**
* This strafes the camera up and down depending on the speed (-/+)
*/
void strafeUpDown(float speed);
/**
* This rotates the camera's eyes around the center depending on the values passed in.
*/
void rotate(float angle, float x, float y, float z);
/**
* Return if the camera is a 3D one
*/
bool is3D() {return d3;}
/**
* Return the viewport of the attached scene
*/
Vector<int, 4> getViewport();
/**
* Init Gl parameters
*/
void initGl();
/**
* Init light
*/
void initLight();
/**
* Init projection with the gived viewport. Load identity matrix if reset is set as true
*/
void initProjection(const Vector<int, 4>& viewport,bool reset=true);
/**
* Init projection with the scene viewport. Load identity matrix if reset is set as true
*/
void initProjection(bool reset=true);
/**
* Init modelview
*/
void initModelView();
/**
* Set the scene radius
*/
void setSceneRadius(double sceneRadius) {this->sceneRadius=sceneRadius;matrixCoherent=false;}
/**
* Return the scene radius
*/
double getSceneRadius() {return sceneRadius;}
/**
* Set the zoom factor
*/
void setZoomFactor(double zoomFactor) {this->zoomFactor=zoomFactor;matrixCoherent=false;}
/**
* Return the zoom factor
*/
double getZoomFactor() {return zoomFactor;}
/**
* Set the eye
*/
void setEyes(const Coord& eyes) {this->eyes=eyes;matrixCoherent=false;}
/**
* Return the eyes
*/
Coord getEyes() {return eyes;}
/**
* Set the center
*/
void setCenter(const Coord& center) {this->center=center;matrixCoherent=false;}
/**
* Return the center
*/
Coord getCenter() {return center;}
/**
* Set the up vector
*/
void setUp(const Coord& up) {this->up=up;matrixCoherent=false;}
/**
* Return the up vector
*/
Coord getUp() {return up;}
/**
* Set translate/scale transformation of object
* It use to compute lod of nodes/edges in metanodes
*/
void addObjectTransformation(const Coord &translation,const Coord &scale, const Coord &baseCoord);
/**
* Get translate/scale transformation of object
* It use to compute lod of nodes/edges in metanodes
*/
void getObjectTransformation(std::vector<Coord> &translation, std::vector<Coord> &scale, std::vector<Coord> &objectCoord);
/**
* Return true if object transformation is set
*/
bool haveObjectTransformation();
/**
* Get the modelview matrix
*/
void getModelviewMatrix(Matrix<float, 4> &modelviewMatrix) { modelviewMatrix=this->modelviewMatrix;}
/**
* Get the projection matrix
*/
void getProjectionMatrix(Matrix<float, 4> &projectionMatrix) { projectionMatrix=this->projectionMatrix;}
/**
* Get the transform matrix : transformMatrix = projectionMatrix * modelviewMatrix
*/
void getTransformMatrix(Matrix<float, 4> &transformMatrix) { transformMatrix=this->transformMatrix;}
/**
* Get the projection and the modelview matrix generated with the given viewport
*/
void getProjAndMVMatrix(const Vector<int, 4>& viewport,Matrix<float, 4> &projectionMatrix,Matrix<float, 4> &modelviewMatrix);
/**
* Get the transform matrix generated with the given viewport
*/
void getTransformMatrix(const Vector<int, 4>& viewport,Matrix<float, 4> &transformMatrix);
/**
* Return the 3D world coordinate for the givedn screen point
*/
Coord screenTo3DWorld(const Coord &point);
/**
* Return the screen position for the given 3D coordinate
*/
Coord worldTo2DScreen(const Coord &obj);
/**
* Get the camera's data in XML form
*/
void getXML(xmlNodePtr rootNode);
/**
* Set the camera's data with XML
*/
void setWithXML(xmlNodePtr rootNode);
private:
bool matrixCoherent;
Coord center,eyes,up;
double zoomFactor;
double sceneRadius;
GlScene* scene;
Matrix<float, 4> modelviewMatrix;
Matrix<float, 4> projectionMatrix;
Matrix<float, 4> transformMatrix;
std::vector<Coord> objectTranslation;
std::vector<Coord> objectScale;
std::vector<Coord> objectCoord;
bool objectTransformation;
bool d3;
};
}
#endif
|