Code_TYMPAN  4.2.0
Industrial site acoustic simulation
TYOpenGLRenderer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14 */
15 
28 #ifndef __TY_OPENGL_RENDERER__
29 #define __TY_OPENGL_RENDERER__
30 
31 
32 
33 #ifdef _WIN32
34 #include<windows.h>
35 #endif
36 #include <GL/gl.h>
37 #include <GL/glu.h>
38 
39 
41 
43 
47 
48 class TYGeometryNode;
49 
55 {
56 
57 public:
58 private:
62  TYOpenGLRenderer(const TYOpenGLRenderer&); // Not implemented.
66  void operator=(const TYOpenGLRenderer&); // Not implemented.
67 
68 public:
69 
74 
79 
83  void init(int width, int height);
84 
88  void updateDisplayList(void);
96  void updateDisplayListOverlay(TYGeometryNode* pElement, TYGeometryNode* pDansCeRepere);
97 
105  int OpenGLUpdateGeometry(GLenum mode = GL_RENDER, int x = 0, int y = 0);
106 
114  void OpenGLDeviceRender(GLenum mode = GL_RENDER, int x = 0, int y = 0);
115 
123  void OpenGLRender(GLenum mode = GL_RENDER, int x = 0, int y = 0);
124 
129  void Render();
130 
134  void setElement(LPTYElement pElt) {_pElement = pElt;}
135 
140 
145 
149  void drawElement(GLenum mode = GL_RENDER);
150 
156  void addOGLElement(OGLElement* pOGLElement);
157 
158  void addLight(OGLLightElement* pOGLElementLight);
159  void removeLights();
160  std::vector<OGLLightElement*> getLights();
161 
162  void setActiveCamera(OGLCamera* pCamera) { _pActiveCamera = pCamera;};
164 
165  void setBackground(double* bgColor) {_pBackgroundColor[0] = bgColor[0]; _pBackgroundColor[1] = bgColor[1]; _pBackgroundColor[2] = bgColor[2];};
166 
172  void removeOGLElement(OGLElement* pOGLElement);
173 
174  void setRenderType(int renderType) {m_renderType = renderType;};
175 
176  void addSelectedElement(TYElement* pElement);
177  void removeSelectedElement(TYElement* pElement);
179 
180 protected :
183 
185  GLuint _displayList;
190 
191  std::vector<OGLElement*> _tabOGLElement;
192 
193  //Elements selectionnes
194  std::vector<TYElement*> _tabSelectedElements;
195 
196  //Liste des lumieres dans la scene 3D
197  std::vector<OGLLightElement*> _tabLights;
198 
201  int m_width;
202  int m_height;
203 
204  int m_renderType; // 0 --> render all, 1 --> render 2D, 2 --> render 3D
205 };
206 
207 #endif // __TY_OPENGL_RENDERER__
GLuint _polygoneMode
Mode de rendu.
GLuint _displayListOverlay
Display liste pour les deplacements.
void init(int width, int height)
void deepCopyElement(LPTYElement pElt)
void addOGLElement(OGLElement *pOGLElement)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYElement.cpp:319
void setRenderType(int renderType)
double * _pBackgroundColor
OGLCamera * getActiveCamera()
void setBackground(double *bgColor)
void updateDisplayList(void)
TYElement * _pElement
Element a representer.
LPTYElement getElement()
void drawElement(GLenum mode=GL_RENDER)
Realise le rendu VTK et le rendu OpenGL.
std::vector< OGLLightElement * > _tabLights
void setActiveCamera(OGLCamera *pCamera)
std::vector< OGLElement * > _tabOGLElement
std::vector< TYElement * > _tabSelectedElements
void operator=(const TYOpenGLRenderer &)
void updateDisplayListOverlay(TYGeometryNode *pElement, TYGeometryNode *pDansCeRepere)
void setElement(LPTYElement pElt)
int OpenGLUpdateGeometry(GLenum mode=GL_RENDER, int x=0, int y=0)
void removeOGLElement(OGLElement *pOGLElement)
void removeSelectedElement(TYElement *pElement)
GLuint _displayList
Display liste globale.
void addSelectedElement(TYElement *pElement)
void addLight(OGLLightElement *pOGLElementLight)
OGLCamera * _pActiveCamera
void OpenGLRender(GLenum mode=GL_RENDER, int x=0, int y=0)
void OpenGLDeviceRender(GLenum mode=GL_RENDER, int x=0, int y=0)
std::vector< OGLLightElement * > getLights()