Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYRenderWindow.h
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 
26 #ifndef __TY_RENDER_WINDOW__
27 #define __TY_RENDER_WINDOW__
28 
29 #include <array>
30 #include <qopengldebug.h>
31 #include <qpoint.h>
32 #include <qvector3d.h>
33 #include <QOpenGLWidget>
34 #include "TYOpenGLRenderer.h"
36 #include "gui/tools/NxVec3.h"
37 #include "gui/tools/OGLCamera.h"
38 
39 class OGLTextElement;
40 
45 class TYRenderWindow : public QOpenGLWidget
46 {
47  Q_OBJECT
48 
49 public:
56  TYRenderWindow(QWidget* pParent = 0, const char* name = 0);
57 
62 
69 
73  bool getShowInfos()
74  {
75  return _showInfos;
76  }
77 
78  void setActiveCamera(OGLCamera* pCamera)
79  {
80  _viewportNeedsUpdate = true;
81  _pActiveCamera = pCamera;
82  };
83 
85  {
86  return _pActiveCamera;
87  };
88 
92  const TYRenderViewport& getViewport() const;
93 
102  QPoint toViewport(QPoint point);
103 
104 public slots:
105 
109  void showInfos(bool state);
110 
111 protected:
115  virtual void initializeGL();
119  virtual void resizeGL(int w, int h);
123  virtual void paintGL();
124 
125  inline QSizePolicy sizePolicy() const
126  {
127  return QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
128  }
129  inline QSize sizeHint() const
130  {
131  return QSize(50, 50);
132  }
133  inline QSize minimumSizeHint() const
134  {
135  return QSize(50, 50);
136  }
137 
138 private:
143  void initRenderWindow();
144 
152  void handleLoggedMessage(QOpenGLDebugMessage debugMessage);
153 
154 private:
157  std::array<double, 50> renderTime;
161  QOpenGLDebugLogger* _pGLLogger;
163 
168  mutable bool _viewportNeedsUpdate;
170 };
171 
172 #endif // __TY_RENDER_WINDOW__
Realise le rendu VTK et le rendu OpenGL (fichier header)
const char * name
Realise le rendu VTK et le rendu OpenGL.
Combine QOpenGLWidget de Qt pour Tympan.
void setActiveCamera(OGLCamera *pCamera)
void handleLoggedMessage(QOpenGLDebugMessage debugMessage)
std::array< double, 50 > renderTime
virtual void initializeGL()
const TYRenderViewport & getViewport() const
OGLCamera * _pActiveCamera
QSize sizeHint() const
QSizePolicy sizePolicy() const
TYRenderViewport _cachedViewport
virtual void resizeGL(int w, int h)
QPoint toViewport(QPoint point)
QOpenGLDebugLogger * _pGLLogger
QSize minimumSizeHint() const
TYOpenGLRenderer * _pRenderer
void showInfos(bool state)
TYOpenGLRenderer * getRenderer()
OGLCamera * getActiveCamera()
virtual void paintGL()
OGLTextElement * _pOGLTextInfoLabel
TYRenderWindow(QWidget *pParent=0, const char *name=0)