Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
view-precompile.hh
Go to the documentation of this file.
1 /*
2  * lib-controler : Un contrôleur générique de scène 3D.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-controler
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #ifndef VIEW_PRECOMPILE_HH
26 #define VIEW_PRECOMPILE_HH
27 //******************************************************************************
28 #include "controler-types.hh"
29 #include "view.hh"
30 #include "vertex.hh"
31 
32 #ifdef _WINDOWS
33 #include <windows.h>
34 #endif
35 
36 #ifdef __APPLE__
37 #include <OpenGL/glu.h>
38 #include <GLUT/glut.h>
39 #else
40 #include <GL/glu.h>
41 #include <GL/glut.h>
42 #endif
43 
44 #include <list>
45 //******************************************************************************
49 //******************************************************************************
50 
56 class CParameter;
57 class CPrecompile;
60 class CParameterDrawing;
61 
62  //****************************************************************************
63 class CViewPrecompile : public CView
64 {
65 public:
66  //@name Constructeur et destructeur.
68 
70  CParameterAimedPosition* AAimedPosition,
71  CParameterDrawing * ADrawing);
72 
74  virtual ~CViewPrecompile();
76 
78 
80  virtual void update();
81 
88  virtual void initScene();
89 
94  virtual void drawScene();
95 
97  virtual void pick(int AX, int AY);
99 
101 
110  CPrecompile* findPrecompile(TPrecompile APrecompileType);
111 
118  void addPrecompile(CPrecompile* APrecompile);
119 
129  CPrecompile* removePrecompile(TPrecompile APrecompileType);
130 
139 
141 
143 
149 
155 
160  CVertex getLookAt();
161 
167  CVertex getEyeDirection();
168 
177  void unproject(float Ax, float Ay, float ARes[]);
178 
188  void project(float Ax, float Ay, float Az, float ARes[]);
189 
191 
193 
197 
200  void setParameterDrawing (CParameterDrawing* AParam);
201 
202  CParameter* getParameter(TParameter AParameterType) const;
203  void setParameter(CParameter* AParameter);
204 
205  void groupParameter (CViewPrecompile* AView, TParameter AParameterType);
206  void ungroupParameter(TParameter AParameterType);
207 
209 
210  //@name Méthodes pour activer ou désactiver la vue
212 
217  virtual void enable();
218 
223  virtual void disable();
224 
226 
227 protected:
228 
234 
240  virtual void setScenePosition() = 0;
241 
247 
253  virtual void display();
254 
257 
260 
263 
265  float FRatio;
266 
267 private:
269  GLint FViewport[4];
270  GLdouble FModelViewMatrix[16], FProjectionMatrix[16];
271 
273  std::list<CPrecompile*> FListPrecompile;
274 };
275 
276 //******************************************************************************
277 #endif // VIEW_PRECOMPILE_HH
278 //******************************************************************************