00001 /* 00002 * lib-controler : Un contrôleur générique de scène 3D. 00003 * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC 00004 * http://www.sic.sp2mi.univ-poitiers.fr/ 00005 * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS, 00006 * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/ 00007 * 00008 * This file is part of lib-controler 00009 * 00010 * This program is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU Lesser General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 //****************************************************************************** 00025 #ifndef PRECOMPILE_HH 00026 #define PRECOMPILE_HH 00027 //****************************************************************************** 00028 #include "controler-types.hh" 00029 #include "parameter.hh" 00030 #include <GL/gl.h> 00031 #include <GL/glu.h> 00032 //****************************************************************************** 00036 //****************************************************************************** 00037 #define PLOT( a ) \ 00038 (glVertex3f((a)->getX(), (a)->getY(), (a)->getZ())) 00039 00040 #define LINE(a,b) (PLOT(a), PLOT(b)) 00041 //****************************************************************************** 00042 00054 //****************************************************************************** 00055 class CView; 00056 00057 class CPrecompile 00058 { 00059 public: 00060 //@name Constructeurs et destructeur. 00062 00064 CPrecompile( unsigned int ANb=0 ); 00065 00068 CPrecompile( const CPrecompile & ); 00069 00072 virtual ~CPrecompile(); 00073 00077 virtual CPrecompile * copy() const = 0; 00079 00080 //@name Méthodes virtuelles pures à implémenter dans les classes filles. 00082 00083 //@name Méthodes pour l'affichage 00085 00087 virtual TPrecompile getType() const = 0; 00088 00090 void draw(); 00091 00094 void update(); 00095 00099 virtual void pick(int, int, CView*); 00100 00102 00109 virtual void setParameter(CParameter * AParameter) = 0; 00110 00115 virtual CParameter* getParameter() const = 0; 00116 00117 //@name Méthodes pour gérer la mise à jour 00119 00126 bool needToUpdate(); 00127 00132 void setToUpdate(); 00133 00138 void unsetToUpdate(); 00139 00141 00142 //@name Méthodes pour activer ou désactiver le précompile 00144 00149 void enable(); 00150 00157 void disable(); 00158 00163 bool isEnabled(); 00164 00166 00167 //@name Méthodes pour compter le nombre de vue totale contenant ce précompile 00169 unsigned int getNbView(); 00170 void incNbView(unsigned int ADec=1); 00171 void decNbView(unsigned int ADec=1); 00173 00174 //@name Méthodes pour compter le nombre de vue active contenant ce précompile 00176 unsigned int getNbEnabledView(); 00177 void incNbEnabledView(unsigned int ADec=1); 00178 void decNbEnabledView(unsigned int ADec=1); 00180 00181 protected: 00182 00188 void compileModel(); 00189 00195 virtual void drawModel() = 0; 00196 00197 private: 00199 bool FToUpdate; 00200 00202 bool FEnable; 00203 00205 unsigned int FNbView; 00206 00208 unsigned int FNbEnabledView; 00209 00211 GLint FCompiledList; 00212 }; 00213 00214 //****************************************************************************** 00215 #endif // PRECOMPILE_HH 00216 //******************************************************************************
1.5.8