Code_TYMPAN  4.4.0
Industrial site acoustic simulation
OGLRectangle.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
16 /*
17  *
18  */
19 
20 #include "OGLRectangle.h"
21 #include <qvector3d.h>
22 
23 #if _WIN32
24  #include <windows.h>
25 #endif //_WIN32
26 
27 #include <GL/gl.h>
28 
29 #include "Tympan/core/color.h"
31 
33 
35 
36 void OGLRectangle::drawRectangle(const QVector3D& point0, const QVector3D& point1, const QVector3D& point2,
37  const QVector3D& point3, const OColor& oColor, bool bFull /*=false*/) const
38 {
39  float tmpColor[4];
40  glGetFloatv(GL_CURRENT_COLOR, tmpColor);
41  // Couleur de la ligne
42  glColor3fv(oColor);
43 
44  // On dessine
45  if (bFull)
46  {
47  glBegin(GL_QUADS);
48  }
49  else
50  {
51  glBegin(GL_LINES);
52  }
53  // Top Left --> Top Right
54  glVertex3d(point0.x(), point0.y(), point0.z());
55  glVertex3d(point1.x(), point1.y(), point1.z());
56 
57  // Top Right --> Bottom Right
58  glVertex3d(point1.x(), point1.y(), point1.z());
59  glVertex3d(point2.x(), point2.y(), point2.z());
60 
61  // Bottom Right --> Bottom Left
62  glVertex3d(point2.x(), point2.y(), point2.z());
63  glVertex3d(point3.x(), point3.y(), point3.z());
64 
65  // Bottom Left --> Top Left
66  glVertex3d(point3.x(), point3.y(), point3.z());
67  glVertex3d(point0.x(), point0.y(), point0.z());
68  // Fin
69  glEnd();
70  glColor3f(tmpColor[0], tmpColor[1], tmpColor[2]);
71 }
All base classes related to 3D manipulation.
Definition: color.h:31
void drawRectangle(const QVector3D &point0, const QVector3D &point1, const QVector3D &point2, const QVector3D &point3, const OColor &oColor, bool bFalse=false) const
virtual ~OGLRectangle()