00001 /****************************************************************************** 00002 * SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3 * 00003 * (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS * 00004 * * 00005 * This library is free software; you can redistribute it and/or modify it * 00006 * under the terms of the GNU Lesser General Public License as published by * 00007 * the Free Software Foundation; either version 2.1 of the License, or (at * 00008 * your option) any later version. * 00009 * * 00010 * This library is distributed in the hope that it will be useful, but WITHOUT * 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * 00013 * for more details. * 00014 * * 00015 * You should have received a copy of the GNU Lesser General Public License * 00016 * along with this library; if not, write to the Free Software Foundation, * 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 00018 ******************************************************************************* 00019 * SOFA :: Modules * 00020 * * 00021 * Authors: The SOFA Team and external contributors (see Authors.txt) * 00022 * * 00023 * Contact information: contact@sofa-framework.org * 00024 ******************************************************************************/ 00025 #ifndef OGLVARIABLE_H_ 00026 #define OGLVARIABLE_H_ 00027 00028 #include <sofa/core/VisualModel.h> 00029 #include <sofa/core/objectmodel/BaseObject.h> 00030 #include <sofa/defaulttype/Vec3Types.h> 00031 #include <sofa/helper/gl/template.h> 00032 #include <sofa/component/visualmodel/OglShader.h> 00033 00034 namespace sofa 00035 { 00036 00037 namespace component 00038 { 00039 00040 namespace visualmodel 00041 { 00042 00055 class OglVariable : public core::VisualModel, public OglShaderElement 00056 { 00057 private: 00058 00059 public: 00060 OglVariable() { }; 00061 virtual ~OglVariable() { }; 00062 00063 virtual void init() { OglShaderElement::init(); }; 00064 virtual void initVisual() { } 00065 virtual void reinit() { init(); initVisual(); } 00066 }; 00067 00069 class OglIntVariable : public OglVariable 00070 { 00071 private: 00072 Data<int> value; 00073 00074 public: 00075 OglIntVariable(); 00076 virtual ~OglIntVariable() { }; 00077 00078 void initVisual(); 00079 }; 00080 00081 class OglInt2Variable : public OglVariable 00082 { 00083 private: 00084 Data<defaulttype::Vec<2, int> > value; 00085 00086 public: 00087 OglInt2Variable(); 00088 virtual ~OglInt2Variable(){ }; 00089 00090 void initVisual(); 00091 }; 00092 00093 class OglInt3Variable : public OglVariable 00094 { 00095 private: 00096 Data<defaulttype::Vec<3, int> > value; 00097 00098 public: 00099 OglInt3Variable(); 00100 virtual ~OglInt3Variable(){ }; 00101 00102 void initVisual(); 00103 }; 00104 00105 class OglInt4Variable : public OglVariable 00106 { 00107 private: 00108 Data<defaulttype::Vec<4, int> > value; 00109 00110 public: 00111 OglInt4Variable(); 00112 virtual ~OglInt4Variable(){ }; 00113 00114 void initVisual(); 00115 }; 00116 00119 class OglFloatVariable : public OglVariable 00120 { 00121 private: 00122 Data<float> value; 00123 00124 public: 00125 OglFloatVariable(); 00126 virtual ~OglFloatVariable() { }; 00127 00128 void initVisual(); 00129 }; 00130 00131 class OglFloat2Variable : public OglVariable 00132 { 00133 private: 00134 Data<defaulttype::Vec2f> value; 00135 00136 public: 00137 OglFloat2Variable(); 00138 virtual ~OglFloat2Variable(){ }; 00139 00140 void initVisual(); 00141 }; 00142 00143 class OglFloat3Variable : public OglVariable 00144 { 00145 private: 00146 Data<defaulttype::Vec3f> value; 00147 00148 public: 00149 OglFloat3Variable(); 00150 virtual ~OglFloat3Variable(){ }; 00151 00152 void initVisual(); 00153 }; 00154 00155 class OglFloat4Variable : public OglVariable 00156 { 00157 private: 00158 Data<defaulttype::Vec4f> value; 00159 00160 public: 00161 OglFloat4Variable(); 00162 virtual ~OglFloat4Variable(){ }; 00163 00164 void initVisual(); 00165 }; 00166 00168 class OglIntVectorVariable : public OglVariable 00169 { 00170 protected: 00171 Data<helper::vector<GLint> > iv; 00172 00173 public: 00174 OglIntVectorVariable(); 00175 virtual ~OglIntVectorVariable() { }; 00176 00177 virtual void init(); 00178 virtual void initVisual(); 00179 }; 00180 00181 class OglIntVector2Variable : public OglIntVectorVariable 00182 { 00183 00184 public: 00185 OglIntVector2Variable(); 00186 virtual ~OglIntVector2Variable(){ }; 00187 00188 virtual void init(); 00189 virtual void initVisual(); 00190 }; 00191 00192 class OglIntVector3Variable : public OglIntVectorVariable 00193 { 00194 public: 00195 OglIntVector3Variable(); 00196 virtual ~OglIntVector3Variable(){ }; 00197 00198 virtual void init(); 00199 virtual void initVisual(); 00200 }; 00201 00202 class OglIntVector4Variable : public OglIntVectorVariable 00203 { 00204 public: 00205 OglIntVector4Variable(); 00206 virtual ~OglIntVector4Variable(){ }; 00207 00208 virtual void init(); 00209 virtual void initVisual(); 00210 }; 00211 00213 class OglFloatVectorVariable : public OglVariable 00214 { 00215 protected: 00216 Data<helper::vector<float> > fv; 00217 00218 public: 00219 OglFloatVectorVariable(); 00220 virtual ~OglFloatVectorVariable() { }; 00221 00222 virtual void init(); 00223 virtual void initVisual(); 00224 }; 00225 00226 class OglFloatVector2Variable : public OglFloatVectorVariable 00227 { 00228 public: 00229 OglFloatVector2Variable(); 00230 virtual ~OglFloatVector2Variable(){ }; 00231 00232 virtual void init(); 00233 virtual void initVisual(); 00234 }; 00235 00236 class OglFloatVector3Variable : public OglFloatVectorVariable 00237 { 00238 public: 00239 OglFloatVector3Variable(); 00240 virtual ~OglFloatVector3Variable(){ }; 00241 00242 virtual void init(); 00243 virtual void initVisual(); 00244 }; 00245 00246 class OglFloatVector4Variable : public OglFloatVectorVariable 00247 { 00248 public: 00249 OglFloatVector4Variable(); 00250 virtual ~OglFloatVector4Variable(){ }; 00251 00252 virtual void init(); 00253 virtual void initVisual(); 00254 }; 00255 00256 } 00257 00258 } 00259 00260 } 00261 00262 #endif /*OGLVARIABLE_H_*/
1.5.7.1