Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces 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/tulipconf.h>
25 #include <tulip/Color.h>
26 #include <tulip/Coord.h>
27 #include <tulip/Size.h>
28 #include <tulip/Matrix.h>
29 
30 #if defined(_MSC_VER)
31 #include <Windows.h>
32 #endif
33 
34 #if defined(__APPLE__)
35 #include <OpenGL/gl.h>
36 #else
37 #include <GL/gl.h>
38 #endif
39 
40 namespace tlp {
41 
42 struct BoundingBox;
43 
44 typedef Matrix<float, 4> MatrixGL;
45 TLP_GL_SCOPE void glTest(const std::string &message = std::string("(no description)"));
46 TLP_GL_SCOPE void setColor(const Color &c);
47 TLP_GL_SCOPE void setColor(GLfloat *);
48 TLP_GL_SCOPE void setMaterial(const Color &c);
49 TLP_GL_SCOPE bool cameraIs3D();
50 /*
51  * Project point on screnn according to the transformation matrix (modelview * projection)
52  * and the viewport (x, y, width, height) given in parmaeter.
53  */
54 TLP_GL_SCOPE Coord projectPoint(const Coord &obj,
55  const MatrixGL &,
56  const Vector<int, 4> &viewport);
57 /*
58  * UnProject point from screen to 3D world according to the inverse transformation matrix (modelview * projection)^-1
59  * and the viewport (x, y, width, height) given in parmaeter.
60  */
61 TLP_GL_SCOPE Coord unprojectPoint(const Coord &obj,
62  const MatrixGL &,
63  const tlp::Vector<int, 4> &viewport);
64 TLP_GL_SCOPE GLfloat projectSize(const BoundingBox& bb,
65  const MatrixGL &, const MatrixGL &,const Vector<int, 4> &viewport);
66 TLP_GL_SCOPE GLfloat projectSize(const Coord& position,const Size& size,
67  const MatrixGL &, const MatrixGL &,const Vector<int, 4> &viewport);
68 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);
69 TLP_GL_SCOPE float calculate2DLod(const BoundingBox& bb,const Vector<int, 4>& globalViewport,const Vector<int, 4>& currentViewport);
70 }
71 
72 #endif //DOXYGEN_NOTFOR_DEVEL
73 #endif
74 ///@endcond