Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlTools.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef GLTOOLS_H
22 #define GLTOOLS_H
23 #ifndef DOXYGEN_NOTFOR_DEVEL
24 #include <tulip/OpenGlConfigManager.h>
25 #include <tulip/Color.h>
26 #include <tulip/Coord.h>
27 #include <tulip/Size.h>
28 #include <tulip/Matrix.h>
29 #include <tulip/BoundingBox.h>
30 
31 namespace tlp {
32 typedef Matrix<float, 4> MatrixGL;
33 TLP_GL_SCOPE void glTest(std::string message = "(no description)");
34 TLP_GL_SCOPE void setColor(const Color &c);
35 TLP_GL_SCOPE void setColor(GLfloat *);
36 TLP_GL_SCOPE void setMaterial(const Color &c);
37 TLP_GL_SCOPE bool cameraIs3D();
38 /*
39  * Project point on screnn according to the transformation matrix (modelview * projection)
40  * and the viewport (x, y, width, height) given in parmaeter.
41  */
42 TLP_GL_SCOPE Coord projectPoint(const Coord &obj,
43  const MatrixGL &,
44  const Vector<int, 4> &viewport);
45 /*
46  * UnProject point from screen to 3D world according to the inverse transformation matrix (modelview * projection)^-1
47  * and the viewport (x, y, width, height) given in parmaeter.
48  */
49 TLP_GL_SCOPE Coord unprojectPoint(const Coord &obj,
50  const MatrixGL &,
51  const tlp::Vector<int, 4> &viewport);
52 TLP_GL_SCOPE GLfloat projectSize(const BoundingBox& bb,
53  const MatrixGL &, const MatrixGL &,const Vector<int, 4> &viewport);
54 TLP_GL_SCOPE GLfloat projectSize(const Coord& position,const Size& size,
55  const MatrixGL &, const MatrixGL &,const Vector<int, 4> &viewport);
56 TLP_GL_SCOPE float calculateAABBSize(const BoundingBox& bb,const Coord& eye,const Matrix<float, 4>& transformMatrix,const Vector<int, 4>& globalViewport,const Vector<int, 4>& currentViewport);
57 TLP_GL_SCOPE float calculate2DLod(const BoundingBox& bb,const Vector<int, 4>& globalViewport,const Vector<int, 4>& currentViewport);
58 }
59 
60 #endif //DOXYGEN_NOTFOR_DEVEL
61 #endif
62 ///@endcond