Code_TYMPAN  4.4.0
Industrial site acoustic simulation
OGLRectangleElement.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 "OGLRectangleElement.h"
21 
22 #if _WIN32
23  #include <windows.h>
24 #endif //_WIN32
25 
26 #include <GL/gl.h>
27 
28 #include "OGLRectangle.h"
29 
31 {
33  m_oPoint0 = QVector3D(0.0, 0.0, 0.0);
34  m_oPoint1 = QVector3D(0.0, 0.0, 0.0);
35  m_oPoint2 = QVector3D(0.0, 0.0, 0.0);
36  m_oPoint3 = QVector3D(0.0, 0.0, 0.0);
37  m_bIs3D = false;
38  m_bFull = false;
39 }
40 
42 {
44  {
46  }
47 }
48 
50 {
51  m_oColor = oColor;
52 }
53 
55 {
56  if (m_bVisible)
57  {
58  if (m_bIs3D)
59  {
60  // Nouvelle vue
61  glMatrixMode(GL_MODELVIEW);
62  glPushMatrix();
64  // Ancienne vue
65  glPopMatrix();
66  }
67  else
68  {
69  GLint viewport[4];
70  glGetIntegerv(GL_VIEWPORT, viewport);
71  unsigned int width = viewport[2];
72  unsigned int height = viewport[3];
73  // Nouvelle projection
74  glMatrixMode(GL_PROJECTION);
75  glPushMatrix();
76  glLoadIdentity();
77  glOrtho(0, width, 0.0, height, 0.0, 1.0);
78 
79  // Nouvelle vue
80  glMatrixMode(GL_MODELVIEW);
81  glPushMatrix();
82  glLoadIdentity();
83 
85  m_bFull);
86 
87  // Ancienne projection
88  glMatrixMode(GL_PROJECTION);
89  glPopMatrix();
90 
91  // Ancienne vue
92  glMatrixMode(GL_MODELVIEW);
93  glPopMatrix();
94  }
95  }
96 
97  return 0;
98 }
Definition: color.h:31
bool m_bVisible
Definition: OGLElement.h:76
bool m_bIs3D
Definition: OGLElement.h:77
OGLRectangle * m_pOGLRectangleToDisplay
void setColor(const OColor &oColor)
void drawRectangle(const QVector3D &point0, const QVector3D &point1, const QVector3D &point2, const QVector3D &point3, const OColor &oColor, bool bFalse=false) const