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 <qopengldebug.h>
30 #include <qpoint.h>
31 #include <qvector3d.h>
32 #include <QOpenGLWidget>
33 #include "TYOpenGLRenderer.h"
35 #include "gui/tools/NxVec3.h"
36 #include "gui/tools/OGLCamera.h"
37 
38 class OGLTextElement;
39 
44 class TYRenderWindow : public QOpenGLWidget
45 {
46  Q_OBJECT
47 
48 public:
55  TYRenderWindow(QWidget* pParent = 0, const char* name = 0);
56 
61 
68 
72  bool getShowInfos()
73  {
74  return _showInfos;
75  }
76 
77  void setActiveCamera(OGLCamera* pCamera)
78  {
79  _viewportNeedsUpdate = true;
80  _pActiveCamera = pCamera;
81  };
82 
84  {
85  return _pActiveCamera;
86  };
87 
91  const TYRenderViewport& getViewport() const;
92 
101  QPoint toViewport(QPoint point);
102 
103 public slots:
104 
108  void showInfos(bool state);
109 
110 protected:
114  virtual void initializeGL();
118  virtual void resizeGL(int w, int h);
122  virtual void paintGL();
123 
124  inline QSizePolicy sizePolicy() const
125  {
126  return QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
127  }
128  inline QSize sizeHint() const
129  {
130  return QSize(50, 50);
131  }
132  inline QSize minimumSizeHint() const
133  {
134  return QSize(50, 50);
135  }
136 
137 private:
142  void initRenderWindow();
143 
151  void handleLoggedMessage(QOpenGLDebugMessage debugMessage);
152 
153 private:
158  QOpenGLDebugLogger* _pGLLogger;
160 
165  mutable bool _viewportNeedsUpdate;
167 };
168 
169 #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)
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)