![]() |
http://www.sim.no/ http://www.coin3d.org/ |
00001 #ifndef COIN_SOSHADERPARAMETER_H 00002 #define COIN_SOSHADERPARAMETER_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) by Kongsberg Oil & Gas Technologies. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Kongsberg Oil & Gas Technologies 00018 * about acquiring a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <Inventor/nodes/SoNode.h> 00028 #include <Inventor/nodes/SoSubNode.h> 00029 #include <Inventor/fields/SoSFString.h> 00030 #include <Inventor/fields/SoSFFloat.h> 00031 #include <Inventor/fields/SoSFInt32.h> 00032 #include <Inventor/fields/SoSFVec2f.h> 00033 #include <Inventor/fields/SoSFVec3f.h> 00034 #include <Inventor/fields/SoSFVec4f.h> 00035 #include <Inventor/fields/SoMFFloat.h> 00036 #include <Inventor/fields/SoMFInt32.h> 00037 #include <Inventor/fields/SoMFVec2f.h> 00038 #include <Inventor/fields/SoMFVec3f.h> 00039 #include <Inventor/fields/SoMFVec4f.h> 00040 #include <Inventor/fields/SoSFMatrix.h> 00041 #include <Inventor/fields/SoMFMatrix.h> 00042 #include <Inventor/fields/SoSFNode.h> 00043 #include <Inventor/fields/SoSFEnum.h> 00044 #include <Inventor/fields/SoSFImage.h> 00045 00046 #include <Inventor/fields/SoSFVec2i32.h> 00047 #include <Inventor/fields/SoSFVec3i32.h> 00048 #include <Inventor/fields/SoSFVec4i32.h> 00049 #include <Inventor/fields/SoMFVec2i32.h> 00050 #include <Inventor/fields/SoMFVec3i32.h> 00051 #include <Inventor/fields/SoMFVec4i32.h> 00052 00053 class SoGLShaderParameter; 00054 class SoGLShaderObject; 00055 00056 // ************************************************************************* 00057 00058 // FIXME: split to one header file for each class? 20050120 mortene. 00059 00060 /* ************************************************************************** 00061 * *** SoShaderParameter *** 00062 * **************************************************************************/ 00063 00064 class COIN_DLL_API SoShaderParameter : public SoNode { 00065 typedef SoNode inherited; 00066 SO_NODE_ABSTRACT_HEADER(SoShaderParameter); 00067 00068 public: 00069 SoSFString name; 00070 SoSFInt32 identifier; 00071 00072 SoINTERNAL public: 00073 static void initClass(); 00074 00075 protected: 00076 SoShaderParameter(); 00077 virtual ~SoShaderParameter(); 00078 }; 00079 00080 /* ************************************************************************** 00081 * *** SoUniformShaderParameter *** 00082 * **************************************************************************/ 00083 class SoUniformShaderParameterP; 00084 00085 class COIN_DLL_API SoUniformShaderParameter : public SoShaderParameter { 00086 typedef SoShaderParameter inherited; 00087 SO_NODE_ABSTRACT_HEADER(SoUniformShaderParameter); 00088 00089 SoINTERNAL public: 00090 static void initClass(void); 00091 virtual void updateParameter(SoGLShaderObject *shaderObject) = 0; 00092 00093 protected: 00094 SoUniformShaderParameter(); 00095 virtual ~SoUniformShaderParameter(); 00096 00097 SoGLShaderParameter * getGLShaderParameter(const uint32_t cachecontext); 00098 void ensureParameter(SoGLShaderObject * shader); 00099 00100 private: 00101 SoUniformShaderParameterP * pimpl; 00102 }; 00103 00104 /* ************************************************************************** 00105 * *** SoShaderParameter1f *** 00106 * **************************************************************************/ 00107 00108 class COIN_DLL_API SoShaderParameter1f : public SoUniformShaderParameter { 00109 typedef SoUniformShaderParameter inherited; 00110 SO_NODE_HEADER(SoShaderParameter1f); 00111 00112 public: 00113 SoSFFloat value; 00114 SoShaderParameter1f(); 00115 00116 SoINTERNAL public: 00117 static void initClass(); 00118 virtual void updateParameter(SoGLShaderObject *shaderObject); 00119 00120 protected: 00121 virtual ~SoShaderParameter1f(); 00122 }; 00123 00124 /* ************************************************************************** 00125 * *** SoShaderParameter1i *** 00126 * **************************************************************************/ 00127 00128 class COIN_DLL_API SoShaderParameter1i : public SoUniformShaderParameter { 00129 typedef SoUniformShaderParameter inherited; 00130 SO_NODE_HEADER(SoShaderParameter1i); 00131 00132 public: 00133 SoSFInt32 value; 00134 SoShaderParameter1i(); 00135 00136 SoINTERNAL public: 00137 static void initClass(); 00138 virtual void updateParameter(SoGLShaderObject *shaderObject); 00139 00140 protected: 00141 virtual ~SoShaderParameter1i(); 00142 }; 00143 00144 /* ************************************************************************** 00145 * *** SoShaderParameter2f *** 00146 * **************************************************************************/ 00147 00148 class COIN_DLL_API SoShaderParameter2f : public SoUniformShaderParameter { 00149 typedef SoUniformShaderParameter inherited; 00150 SO_NODE_HEADER(SoShaderParameter2f); 00151 00152 public: 00153 SoSFVec2f value; 00154 SoShaderParameter2f(); 00155 00156 SoINTERNAL public: 00157 static void initClass(); 00158 virtual void updateParameter(SoGLShaderObject *shaderObject); 00159 00160 protected: 00161 virtual ~SoShaderParameter2f(); 00162 }; 00163 00164 /* ************************************************************************** 00165 * *** SoShaderParameter2i *** 00166 * **************************************************************************/ 00167 00168 class COIN_DLL_API SoShaderParameter2i : public SoUniformShaderParameter { 00169 typedef SoUniformShaderParameter inherited; 00170 SO_NODE_HEADER(SoShaderParameter2i); 00171 00172 public: 00173 SoSFVec2i32 value; 00174 SoShaderParameter2i(); 00175 00176 SoINTERNAL public: 00177 static void initClass(); 00178 virtual void updateParameter(SoGLShaderObject *shaderObject); 00179 00180 protected: 00181 virtual ~SoShaderParameter2i(); 00182 }; 00183 00184 /* ************************************************************************** 00185 * *** SoShaderParameter3f *** 00186 * **************************************************************************/ 00187 00188 class COIN_DLL_API SoShaderParameter3f : public SoUniformShaderParameter { 00189 typedef SoUniformShaderParameter inherited; 00190 SO_NODE_HEADER(SoShaderParameter3f); 00191 00192 public: 00193 SoSFVec3f value; 00194 00195 SoShaderParameter3f(); 00196 00197 SoINTERNAL public: 00198 static void initClass(); 00199 virtual void updateParameter(SoGLShaderObject *shaderObject); 00200 00201 protected: 00202 virtual ~SoShaderParameter3f(); 00203 }; 00204 00205 /* ************************************************************************** 00206 * *** SoShaderParameter3i *** 00207 * **************************************************************************/ 00208 00209 class COIN_DLL_API SoShaderParameter3i : public SoUniformShaderParameter { 00210 typedef SoUniformShaderParameter inherited; 00211 SO_NODE_HEADER(SoShaderParameter3i); 00212 00213 public: 00214 SoSFVec3i32 value; 00215 00216 SoShaderParameter3i(); 00217 00218 SoINTERNAL public: 00219 static void initClass(); 00220 virtual void updateParameter(SoGLShaderObject *shaderObject); 00221 00222 protected: 00223 virtual ~SoShaderParameter3i(); 00224 }; 00225 00226 /* ************************************************************************** 00227 * *** SoShaderParameter4f *** 00228 * **************************************************************************/ 00229 00230 class COIN_DLL_API SoShaderParameter4f : public SoUniformShaderParameter { 00231 typedef SoUniformShaderParameter inherited; 00232 SO_NODE_HEADER(SoShaderParameter4f); 00233 00234 public: 00235 SoSFVec4f value; 00236 00237 SoShaderParameter4f(); 00238 00239 SoINTERNAL public: 00240 static void initClass(); 00241 virtual void updateParameter(SoGLShaderObject *shaderObject); 00242 00243 protected: 00244 virtual ~SoShaderParameter4f(); 00245 }; 00246 00247 /* ************************************************************************** 00248 * *** SoShaderParameter4i *** 00249 * **************************************************************************/ 00250 00251 class COIN_DLL_API SoShaderParameter4i : public SoUniformShaderParameter { 00252 typedef SoUniformShaderParameter inherited; 00253 SO_NODE_HEADER(SoShaderParameter4i); 00254 00255 public: 00256 SoSFVec4i32 value; 00257 00258 SoShaderParameter4i(); 00259 00260 SoINTERNAL public: 00261 static void initClass(); 00262 virtual void updateParameter(SoGLShaderObject *shaderObject); 00263 00264 protected: 00265 virtual ~SoShaderParameter4i(); 00266 }; 00267 00268 /* ************************************************************************** 00269 * *** SoShaderParameterArray1f *** 00270 * **************************************************************************/ 00271 00272 class COIN_DLL_API SoShaderParameterArray1f : public SoUniformShaderParameter { 00273 typedef SoUniformShaderParameter inherited; 00274 SO_NODE_HEADER(SoShaderParameterArray1f); 00275 00276 public: 00277 SoMFFloat value; 00278 00279 SoShaderParameterArray1f(); 00280 00281 SoINTERNAL public: 00282 static void initClass(); 00283 virtual void updateParameter(SoGLShaderObject *shaderObject); 00284 00285 protected: 00286 virtual ~SoShaderParameterArray1f(); 00287 }; 00288 00289 /* ************************************************************************** 00290 * *** SoShaderParameterArray1i *** 00291 * **************************************************************************/ 00292 00293 class COIN_DLL_API SoShaderParameterArray1i : public SoUniformShaderParameter { 00294 typedef SoUniformShaderParameter inherited; 00295 SO_NODE_HEADER(SoShaderParameterArray1i); 00296 00297 public: 00298 SoMFInt32 value; 00299 00300 SoShaderParameterArray1i(); 00301 00302 SoINTERNAL public: 00303 static void initClass(); 00304 virtual void updateParameter(SoGLShaderObject *shaderObject); 00305 00306 protected: 00307 virtual ~SoShaderParameterArray1i(); 00308 }; 00309 00310 /* ************************************************************************** 00311 * *** SoShaderParameterArray2f *** 00312 * **************************************************************************/ 00313 00314 class COIN_DLL_API SoShaderParameterArray2f : public SoUniformShaderParameter { 00315 typedef SoUniformShaderParameter inherited; 00316 SO_NODE_HEADER(SoShaderParameterArray2f); 00317 00318 public: 00319 SoMFVec2f value; 00320 00321 SoShaderParameterArray2f(); 00322 00323 SoINTERNAL public: 00324 static void initClass(); 00325 virtual void updateParameter(SoGLShaderObject *shaderObject); 00326 00327 protected: 00328 virtual ~SoShaderParameterArray2f(); 00329 }; 00330 00331 /* ************************************************************************** 00332 * *** SoShaderParameterArray2i *** 00333 * **************************************************************************/ 00334 class COIN_DLL_API SoShaderParameterArray2i : public SoUniformShaderParameter { 00335 typedef SoUniformShaderParameter inherited; 00336 SO_NODE_HEADER(SoShaderParameterArray2i); 00337 00338 public: 00339 SoMFVec2i32 value; 00340 00341 SoShaderParameterArray2i(); 00342 00343 SoINTERNAL public: 00344 static void initClass(); 00345 virtual void updateParameter(SoGLShaderObject *shaderObject); 00346 00347 protected: 00348 virtual ~SoShaderParameterArray2i(); 00349 }; 00350 00351 /* ************************************************************************** 00352 * *** SoShaderParameterArray3f *** 00353 * **************************************************************************/ 00354 00355 class COIN_DLL_API SoShaderParameterArray3f : public SoUniformShaderParameter { 00356 typedef SoUniformShaderParameter inherited; 00357 SO_NODE_HEADER(SoShaderParameterArray3f); 00358 00359 public: 00360 SoMFVec3f value; 00361 00362 SoShaderParameterArray3f(); 00363 00364 SoINTERNAL public: 00365 static void initClass(); 00366 virtual void updateParameter(SoGLShaderObject *shaderObject); 00367 00368 protected: 00369 virtual ~SoShaderParameterArray3f(); 00370 }; 00371 00372 /* ************************************************************************** 00373 * *** SoShaderParameterArray3i *** 00374 * **************************************************************************/ 00375 00376 class COIN_DLL_API SoShaderParameterArray3i : public SoUniformShaderParameter { 00377 typedef SoUniformShaderParameter inherited; 00378 SO_NODE_HEADER(SoShaderParameterArray3i); 00379 00380 public: 00381 SoMFVec3i32 value; 00382 00383 SoShaderParameterArray3i(); 00384 00385 SoINTERNAL public: 00386 static void initClass(); 00387 virtual void updateParameter(SoGLShaderObject *shaderObject); 00388 00389 protected: 00390 virtual ~SoShaderParameterArray3i(); 00391 }; 00392 00393 /* ************************************************************************** 00394 * *** SoShaderParameterArray4f *** 00395 * **************************************************************************/ 00396 00397 class COIN_DLL_API SoShaderParameterArray4f : public SoUniformShaderParameter { 00398 typedef SoUniformShaderParameter inherited; 00399 SO_NODE_HEADER(SoShaderParameterArray4f); 00400 00401 public: 00402 SoMFVec4f value; 00403 00404 SoShaderParameterArray4f(); 00405 00406 SoINTERNAL public: 00407 static void initClass(); 00408 virtual void updateParameter(SoGLShaderObject *shaderObject); 00409 00410 protected: 00411 virtual ~SoShaderParameterArray4f(); 00412 00413 }; 00414 00415 /* ************************************************************************** 00416 * *** SoShaderParameterArray4i *** 00417 * **************************************************************************/ 00418 00419 class COIN_DLL_API SoShaderParameterArray4i : public SoUniformShaderParameter { 00420 typedef SoUniformShaderParameter inherited; 00421 SO_NODE_HEADER(SoShaderParameterArray4i); 00422 00423 public: 00424 SoMFVec4i32 value; 00425 00426 SoShaderParameterArray4i(); 00427 00428 SoINTERNAL public: 00429 static void initClass(); 00430 virtual void updateParameter(SoGLShaderObject *shaderObject); 00431 00432 protected: 00433 virtual ~SoShaderParameterArray4i(); 00434 }; 00435 00436 /* ************************************************************************** 00437 * *** SoShaderParameterMatrix *** 00438 * **************************************************************************/ 00439 00440 class COIN_DLL_API SoShaderParameterMatrix : public SoUniformShaderParameter { 00441 typedef SoUniformShaderParameter inherited; 00442 SO_NODE_HEADER(SoShaderParameterMatrix); 00443 00444 public: 00445 SoSFMatrix value; 00446 00447 SoShaderParameterMatrix(); 00448 00449 SoINTERNAL public: 00450 static void initClass(); 00451 virtual void updateParameter(SoGLShaderObject *shaderObject); 00452 00453 protected: 00454 virtual ~SoShaderParameterMatrix(); 00455 }; 00456 00457 /* ************************************************************************** 00458 * *** SoShaderParameterMatrixArray *** 00459 * **************************************************************************/ 00460 00461 class COIN_DLL_API SoShaderParameterMatrixArray : public SoUniformShaderParameter { 00462 typedef SoUniformShaderParameter inherited; 00463 SO_NODE_HEADER(SoShaderParameterMatrixArray); 00464 00465 public: 00466 SoMFMatrix value; 00467 00468 SoShaderParameterMatrixArray(); 00469 00470 SoINTERNAL public: 00471 static void initClass(); 00472 virtual void updateParameter(SoGLShaderObject *shaderObject); 00473 00474 protected: 00475 virtual ~SoShaderParameterMatrixArray(); 00476 }; 00477 00478 /* ************************************************************************** 00479 * *** SoShaderStateMatrixParameter *** 00480 * **************************************************************************/ 00481 00482 class COIN_DLL_API SoShaderStateMatrixParameter : public SoUniformShaderParameter { 00483 typedef SoUniformShaderParameter inherited; 00484 SO_NODE_HEADER(SoShaderStateMatrixParameter); 00485 00486 public: 00487 00488 enum MatrixType { 00489 MODELVIEW, 00490 PROJECTION, 00491 TEXTURE, 00492 MODELVIEW_PROJECTION 00493 }; 00494 00495 enum MatrixTransform{ 00496 IDENTITY, 00497 TRANSPOSE, 00498 INVERSE, 00499 INVERSE_TRANSPOSE 00500 }; 00501 00502 SoSFEnum matrixType; 00503 SoSFEnum matrixTransform; 00504 00505 SoShaderStateMatrixParameter(); 00506 virtual ~SoShaderStateMatrixParameter(); 00507 00508 static void initClass(void); 00509 virtual void updateParameter(SoGLShaderObject *shaderObject); 00510 }; 00511 00512 #endif /* ! COIN_SOSHADERPARAMETER_H */
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Mon May 10 00:34:53 2010 for Coin by Doxygen 1.6.3.