00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 /* include files */ 00025 #ifndef _SO_SHADER_PARAMETER_H_ 00026 #define _SO_SHADER_PARAMETER_H_ 00027 00028 #include <Inventor/SbBasic.h> 00029 #include <Inventor/nodes/SoNode.h> 00030 #include <Inventor/nodes/SoNode.h> 00031 #include <Inventor/fields/SoSFBufferObject.h> 00032 #include <Inventor/fields/SoSFString.h> 00033 #include <Inventor/fields/SoSFFloat.h> 00034 #include <Inventor/fields/SoSFInt32.h> 00035 #include <Inventor/fields/SoSFVec2f.h> 00036 #include <Inventor/fields/SoSFVec2i32.h> 00037 #include <Inventor/fields/SoSFVec3f.h> 00038 #include <Inventor/fields/SoSFVec3i32.h> 00039 #include <Inventor/fields/SoSFVec4f.h> 00040 #include <Inventor/fields/SoSFVec4i32.h> 00041 #include <Inventor/fields/SoSFBool.h> 00042 #include <Inventor/fields/SoMFFloat.h> 00043 #include <Inventor/fields/SoMFInt32.h> 00044 #include <Inventor/fields/SoMFShort.h> 00045 #include <Inventor/fields/SoMFVec2f.h> 00046 #include <Inventor/fields/SoMFVec2s.h> 00047 #include <Inventor/fields/SoMFVec2i32.h> 00048 #include <Inventor/fields/SoMFVec3f.h> 00049 #include <Inventor/fields/SoMFVec3s.h> 00050 #include <Inventor/fields/SoMFVec3i32.h> 00051 #include <Inventor/fields/SoMFVec4f.h> 00052 #include <Inventor/fields/SoMFVec4i32.h> 00053 #include <Inventor/fields/SoMFVec4s.h> 00054 #include <Inventor/fields/SoMFVec4b.h> 00055 #include <Inventor/fields/SoMFVec4ui32.h> 00056 #include <Inventor/fields/SoMFVec4us.h> 00057 #include <Inventor/fields/SoMFVec4ub.h> 00058 #include <Inventor/fields/SoSFMatrix.h> 00059 #include <Inventor/fields/SoSFMatrix3.h> 00060 #include <Inventor/fields/SoMFMatrix.h> 00061 #include <Inventor/fields/SoSFNode.h> 00062 #include <Inventor/fields/SoMFNode.h> 00063 #include <Inventor/fields/SoSFEnum.h> 00064 #include <Inventor/SbEventHandler.h> 00065 #include <Inventor/renderer/RendererResourceMacro.h> 00066 00067 typedef unsigned int GLenum; 00068 00069 class SoGLShaderObject ; 00070 class SoShaderObject ; 00071 class SoShaderProgram ; 00072 00073 /*----------------------------------------------------------------------------*/ 00074 00136 class SoShaderParameter : public SoNode { 00137 00138 SO_NODE_ABSTRACT_HEADER(SoShaderParameter); 00139 00140 public: 00145 SoSFString name; 00146 00151 SoSFInt32 identifier; 00152 00153 00154 private: 00155 static void initClass() ; 00156 static void exitClass() ; 00157 00158 SbBool isInternal() const; 00159 00160 private: 00164 SoShaderParameter(); 00165 00166 // Destructor 00167 virtual ~SoShaderParameter(); 00168 00169 }; 00170 00312 class SoUniformShaderParameter : public SoShaderParameter { 00313 00314 SO_NODE_ABSTRACT_HEADER(SoUniformShaderParameter); 00315 RENDERER_RESOURCE(SoUniformShaderParameter); 00316 00317 public: 00318 00319 virtual bool isEqual(const SoUniformShaderParameter* param) const = 0; 00320 00321 private: 00322 static void initClass() ; 00323 static void exitClass() ; 00324 00326 virtual void notify(SoNotList *list); 00327 00328 private: 00329 void GLRender(SoGLRenderAction *action); 00330 00331 private: 00335 SoUniformShaderParameter(); 00336 00337 // Destructor 00338 virtual ~SoUniformShaderParameter(); 00339 00340 private: 00341 00342 #if 1 SoDEPRECATED enum 00347 ShaderType { 00352 VERTEX, 00357 FRAGMENT 00358 }; 00359 00368 SoSFEnum SoDEPRECATED shaderType; 00369 #endif 00371 }; 00372 /*----------------------------------------------------------------------------*/ 00373 00413 class SoShaderParameter1f : public SoUniformShaderParameter { 00414 00415 SO_NODE_HEADER(SoShaderParameter1f); 00416 00417 public: 00418 00423 SoSFFloat value; 00424 00428 SoShaderParameter1f(); 00429 00433 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00434 00435 private: 00436 00437 static void initClass() ; 00438 static void exitClass() ; 00439 00440 private: 00441 // Destructor 00442 virtual ~SoShaderParameter1f(); 00443 }; 00444 /*----------------------------------------------------------------------------*/ 00445 00485 class SoShaderParameter1i : public SoUniformShaderParameter { 00486 00487 SO_NODE_HEADER(SoShaderParameter1i); 00488 00489 public: 00493 SoSFInt32 value; 00494 00498 SoShaderParameter1i(); 00499 00500 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00501 00502 private: 00503 static void initClass() ; 00504 static void exitClass() ; 00505 00506 private: 00507 // Destructor 00508 virtual ~SoShaderParameter1i(); 00509 }; 00510 /*----------------------------------------------------------------------------*/ 00511 00551 class SoShaderParameter2f : public SoUniformShaderParameter { 00552 00553 SO_NODE_HEADER(SoShaderParameter2f); 00554 00555 public: 00559 SoSFVec2f value; 00560 00564 SoShaderParameter2f(); 00565 00566 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00567 00568 private: 00569 static void initClass() ; 00570 static void exitClass() ; 00571 00572 private: 00573 // Destructor 00574 virtual ~SoShaderParameter2f(); 00575 }; 00576 /*----------------------------------------------------------------------------*/ 00577 00617 class SoShaderParameter2i : public SoUniformShaderParameter { 00618 00619 SO_NODE_HEADER(SoShaderParameter2i); 00620 00621 public: 00625 SoSFVec2i32 value; 00626 00630 SoShaderParameter2i(); 00631 00632 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00633 00634 private: 00635 static void initClass() ; 00636 static void exitClass() ; 00637 00638 private: 00639 // Destructor 00640 virtual ~SoShaderParameter2i(); 00641 }; 00642 /*----------------------------------------------------------------------------*/ 00643 00683 class SoShaderParameter3f : public SoUniformShaderParameter { 00684 00685 SO_NODE_HEADER(SoShaderParameter3f); 00686 00687 public: 00691 SoSFVec3f value; 00692 00696 SoShaderParameter3f(); 00697 00698 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00699 00700 private: 00701 static void initClass() ; 00702 static void exitClass() ; 00703 00704 private: 00705 // Destructor 00706 virtual ~SoShaderParameter3f(); 00707 }; 00708 /*----------------------------------------------------------------------------*/ 00709 00749 class SoShaderParameter3i : public SoUniformShaderParameter { 00750 00751 SO_NODE_HEADER(SoShaderParameter3i); 00752 00753 public: 00757 SoSFVec3i32 value; 00758 00762 SoShaderParameter3i(); 00763 00764 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00765 00766 private: 00767 static void initClass() ; 00768 static void exitClass() ; 00769 00770 private: 00771 // Destructor 00772 virtual ~SoShaderParameter3i(); 00773 00774 }; 00775 /*----------------------------------------------------------------------------*/ 00776 00816 class SoShaderParameter4f : public SoUniformShaderParameter { 00817 00818 SO_NODE_HEADER(SoShaderParameter4f); 00819 00820 public: 00824 SoSFVec4f value; 00825 00829 SoShaderParameter4f(); 00830 00831 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00832 00833 private: 00834 static void initClass() ; 00835 static void exitClass() ; 00836 00837 private: 00838 // Destructor 00839 virtual ~SoShaderParameter4f(); 00840 }; 00841 /*----------------------------------------------------------------------------*/ 00842 00882 class SoShaderParameter4i : public SoUniformShaderParameter { 00883 00884 SO_NODE_HEADER(SoShaderParameter4i); 00885 00886 public: 00890 SoSFVec4i32 value; 00891 00895 SoShaderParameter4i(); 00896 00897 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00898 00899 private: 00900 static void initClass() ; 00901 static void exitClass() ; 00902 00903 private: 00904 // Destructor 00905 virtual ~SoShaderParameter4i(); 00906 }; 00907 /*----------------------------------------------------------------------------*/ 00908 00950 class SoShaderParameterArray1f : public SoUniformShaderParameter { 00951 00952 SO_NODE_HEADER(SoShaderParameterArray1f); 00953 00954 public: 00958 SoMFFloat value; 00959 00963 SoShaderParameterArray1f(); 00964 00965 virtual bool isEqual(const SoUniformShaderParameter* param) const; 00966 00967 private: 00968 static void initClass() ; 00969 static void exitClass() ; 00970 00971 private: 00972 // Destructor 00973 virtual ~SoShaderParameterArray1f(); 00974 }; 00975 /*----------------------------------------------------------------------------*/ 00976 01018 class SoShaderParameterArray1i : public SoUniformShaderParameter { 01019 01020 SO_NODE_HEADER(SoShaderParameterArray1i); 01021 01022 public: 01026 SoMFInt32 value; 01027 01031 SoShaderParameterArray1i(); 01032 01033 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01034 01035 private: 01036 static void initClass() ; 01037 static void exitClass() ; 01038 01039 private: 01040 // Destructor 01041 virtual ~SoShaderParameterArray1i(); 01042 }; 01043 /*----------------------------------------------------------------------------*/ 01044 01086 class SoShaderParameterArray2f : public SoUniformShaderParameter { 01087 01088 SO_NODE_HEADER(SoShaderParameterArray2f); 01089 01090 public: 01094 SoMFVec2f value; 01095 01099 SoShaderParameterArray2f(); 01100 01101 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01102 01103 private: 01104 static void initClass() ; 01105 static void exitClass() ; 01106 01107 private: 01108 // Destructor 01109 virtual ~SoShaderParameterArray2f(); 01110 }; 01111 /*----------------------------------------------------------------------------*/ 01112 01154 class SoShaderParameterArray2i : public SoUniformShaderParameter { 01155 01156 SO_NODE_HEADER(SoShaderParameterArray2i); 01157 01158 public: 01162 SoMFVec2i32 value; 01163 01167 SoShaderParameterArray2i(); 01168 01169 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01170 01171 private: 01172 static void initClass() ; 01173 static void exitClass() ; 01174 01175 private: 01176 // Destructor 01177 virtual ~SoShaderParameterArray2i(); 01178 }; 01179 /*----------------------------------------------------------------------------*/ 01180 01222 class SoShaderParameterArray3f : public SoUniformShaderParameter { 01223 01224 SO_NODE_HEADER(SoShaderParameterArray3f); 01225 01226 public: 01230 SoMFVec3f value; 01231 01235 SoShaderParameterArray3f(); 01236 01237 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01238 01239 private: 01240 static void initClass() ; 01241 static void exitClass() ; 01242 01243 private: 01244 // Destructor 01245 virtual ~SoShaderParameterArray3f(); 01246 }; 01247 /*----------------------------------------------------------------------------*/ 01248 01291 class SoShaderParameterArray3i : public SoUniformShaderParameter { 01292 01293 SO_NODE_HEADER(SoShaderParameterArray3i); 01294 01295 public: 01299 SoMFVec3i32 value; 01300 01304 SoShaderParameterArray3i(); 01305 01306 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01307 01308 private: 01309 static void initClass() ; 01310 static void exitClass() ; 01311 01312 private: 01313 // Destructor 01314 virtual ~SoShaderParameterArray3i(); 01315 }; 01316 /*----------------------------------------------------------------------------*/ 01317 01360 class SoShaderParameterArray4f : public SoUniformShaderParameter { 01361 01362 SO_NODE_HEADER(SoShaderParameterArray4f); 01363 01364 public: 01368 SoMFVec4f value; 01369 01373 SoShaderParameterArray4f(); 01374 01375 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01376 01377 private: 01378 static void initClass() ; 01379 static void exitClass() ; 01380 01381 private: 01382 // Destructor 01383 virtual ~SoShaderParameterArray4f(); 01384 01385 }; 01386 /*----------------------------------------------------------------------------*/ 01387 01431 class SoShaderParameterArray4i : public SoUniformShaderParameter { 01432 01433 SO_NODE_HEADER(SoShaderParameterArray4i); 01434 01435 public: 01439 SoMFVec4i32 value; 01440 01444 SoShaderParameterArray4i(); 01445 01446 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01447 01448 private: 01449 static void initClass() ; 01450 static void exitClass() ; 01451 01452 private: 01453 // Destructor 01454 virtual ~SoShaderParameterArray4i(); 01455 }; 01456 /*----------------------------------------------------------------------------*/ 01457 01505 class SoShaderParameterMatrix : public SoUniformShaderParameter { 01506 01507 SO_NODE_HEADER(SoShaderParameterMatrix); 01508 01509 public: 01513 SoSFMatrix value; 01514 01518 SoShaderParameterMatrix(); 01519 01520 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01521 01522 private: 01523 static void initClass() ; 01524 static void exitClass() ; 01525 01526 private: 01527 // Destructor 01528 virtual ~SoShaderParameterMatrix(); 01529 01530 }; 01531 /*----------------------------------------------------------------------------*/ 01532 01575 class SoShaderParameterMatrix3 : public SoUniformShaderParameter { 01576 01577 SO_NODE_HEADER(SoShaderParameterMatrix3); 01578 01579 public: 01583 SoSFMatrix3 value; 01584 01588 SoShaderParameterMatrix3(); 01589 01590 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01591 01592 private: 01593 static void initClass() ; 01594 static void exitClass() ; 01595 01596 private: 01597 // Destructor 01598 virtual ~SoShaderParameterMatrix3(); 01599 01600 }; 01601 /*----------------------------------------------------------------------------*/ 01602 01603 01647 class SoShaderParameterMatrixArray : public SoUniformShaderParameter { 01648 01649 SO_NODE_HEADER(SoShaderParameterMatrixArray); 01650 01651 public: 01655 SoMFMatrix value; 01656 01660 SoShaderParameterMatrixArray(); 01661 01662 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01663 01664 private: 01665 static void initClass() ; 01666 static void exitClass() ; 01667 01668 private: 01669 // Destructor 01670 virtual ~SoShaderParameterMatrixArray(); 01671 }; 01672 /*----------------------------------------------------------------------------*/ 01673 01726 class SoShaderStateMatrixParameter : public SoUniformShaderParameter { 01727 01728 SO_NODE_HEADER(SoShaderStateMatrixParameter); 01729 01730 public: 01731 01733 enum MatrixType { 01737 MODELVIEW, 01738 01742 PROJECTION, 01743 01747 TEXTURE, 01748 01752 MODELVIEW_PROJECTION 01753 }; 01754 01756 enum MatrixTransform { 01760 IDENTITY, 01761 01765 TRANSPOSE, 01766 01770 INVERSE, 01771 01775 INVERSE_TRANSPOSE 01776 }; 01777 01781 SoSFEnum matrixType; 01782 01786 SoSFEnum matrixTransform; 01787 01791 SoShaderStateMatrixParameter(); 01792 01793 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01794 01795 private: 01796 static void initClass() ; 01797 static void exitClass() ; 01798 01799 private: 01800 // Destructor 01801 virtual ~SoShaderStateMatrixParameter(); 01802 01803 }; 01804 /*----------------------------------------------------------------------------*/ 01805 01845 class SoShaderParameterStruct : public SoUniformShaderParameter { 01846 01847 SO_NODE_HEADER(SoShaderParameterStruct); 01848 01849 public: 01853 SoShaderParameterStruct(); 01857 SoMFNode value; 01858 01859 virtual bool isEqual(const SoUniformShaderParameter* param) const; 01860 01861 private: 01862 static void initClass(); 01863 static void exitClass(); 01864 01865 private: 01866 // Destructor 01867 virtual ~SoShaderParameterStruct(); 01868 }; 01869 01870 /*----------------------------------------------------------------------------*/ 01871 01979 class SoVertexShaderParameter : public SoShaderParameter { 01980 01981 SO_NODE_ABSTRACT_HEADER(SoVertexShaderParameter); 01982 01983 private: 01984 virtual void doAction(SoAction *action); 01985 virtual void GLRender(SoGLRenderAction *action); 01986 virtual void callback(SoCallbackAction *action); 01987 virtual void getBoundingBox( SoGetBoundingBoxAction *action ); 01988 virtual void rayPick(SoRayPickAction *action ); 01989 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action ); 01990 01991 private: 01992 static void initClass(); 01993 static void exitClass(); 01994 01995 static SbBool areVertexAttribFuncAvailable(); 01996 static SbBool areVertexAttribDivisorFuncAvailable(); 01997 01998 void getVertexAttribIndex(SoState * state, int& firstInd, int& size); 01999 02000 virtual size_t getVertexAttribOffset(int) { return 0; } 02001 virtual const char * getVertexAttribPtr(int i=0) = 0; 02002 virtual size_t getVertexAttribStride() = 0; 02003 virtual int getVertexAttribNum() = 0; 02004 virtual GLenum getVertexAttribType() = 0; 02005 virtual int getVertexAttribSize() = 0; 02006 virtual SbBool getVertexAttribIsToNormalize() = 0; 02007 virtual unsigned int getVertexAttribDivisor() { return 0; } 02008 private: 02012 SoVertexShaderParameter(); 02013 02014 // Destructor 02015 virtual ~SoVertexShaderParameter(); 02016 02017 }; 02018 /*----------------------------------------------------------------------------*/ 02019 02054 class SoVertexShaderParameter1f : public SoVertexShaderParameter { 02055 02056 SO_NODE_HEADER(SoVertexShaderParameter1f); 02057 02058 public: 02062 SoVertexShaderParameter1f(); 02063 02067 SoMFFloat value; 02068 02069 private: 02070 static void initClass(); 02071 static void exitClass(); 02072 02073 virtual const char * getVertexAttribPtr( int ) { return (char *)value.getValues(0); } 02074 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02075 virtual int getVertexAttribNum() { return value.getNum(); } 02076 virtual GLenum getVertexAttribType(); 02077 virtual int getVertexAttribSize() { return 1; } 02078 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; } 02079 02080 private: 02081 // Destructor 02082 virtual ~SoVertexShaderParameter1f(); 02083 }; 02084 02085 /*----------------------------------------------------------------------------*/ 02086 02121 class SoVertexShaderParameter1s : public SoVertexShaderParameter { 02122 02123 SO_NODE_HEADER(SoVertexShaderParameter1s); 02124 02125 public: 02129 SoVertexShaderParameter1s(); 02130 02134 SoMFShort value; 02135 02136 private: 02137 static void initClass(); 02138 static void exitClass(); 02139 02140 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02141 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02142 virtual int getVertexAttribNum() { return value.getNum(); } 02143 virtual GLenum getVertexAttribType(); 02144 virtual int getVertexAttribSize() { return 1; } 02145 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; } 02146 02147 private: 02148 // Destructor 02149 virtual ~SoVertexShaderParameter1s(); 02150 }; 02151 02152 /*----------------------------------------------------------------------------*/ 02153 02188 class SoVertexShaderParameter2f : public SoVertexShaderParameter { 02189 02190 SO_NODE_HEADER(SoVertexShaderParameter2f); 02191 02192 public: 02196 SoVertexShaderParameter2f(); 02197 02201 SoMFVec2f value; 02202 02203 private: 02204 static void initClass(); 02205 static void exitClass(); 02206 02207 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02208 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02209 virtual int getVertexAttribNum() { return value.getNum(); } 02210 virtual GLenum getVertexAttribType(); 02211 virtual int getVertexAttribSize() { return 2; } 02212 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; } 02213 02214 private: 02215 // Destructor 02216 virtual ~SoVertexShaderParameter2f(); 02217 }; 02218 02219 /*----------------------------------------------------------------------------*/ 02220 02255 class SoVertexShaderParameter2s : public SoVertexShaderParameter { 02256 02257 SO_NODE_HEADER(SoVertexShaderParameter2s); 02258 02259 public: 02263 SoVertexShaderParameter2s(); 02264 02268 SoMFVec2s value; 02269 02270 private: 02271 static void initClass(); 02272 static void exitClass(); 02273 02274 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02275 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02276 virtual int getVertexAttribNum() { return value.getNum(); } 02277 virtual GLenum getVertexAttribType(); 02278 virtual int getVertexAttribSize() { return 2; } 02279 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; } 02280 02281 private: 02282 // Destructor 02283 virtual ~SoVertexShaderParameter2s(); 02284 }; 02285 02286 /*----------------------------------------------------------------------------*/ 02287 02322 class SoVertexShaderParameter3f : public SoVertexShaderParameter { 02323 02324 SO_NODE_HEADER(SoVertexShaderParameter3f); 02325 02326 public: 02330 SoVertexShaderParameter3f(); 02331 02335 SoMFVec3f value; 02336 02337 private: 02338 static void initClass(); 02339 static void exitClass(); 02340 02341 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02342 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02343 virtual int getVertexAttribNum() { return value.getNum(); } 02344 virtual GLenum getVertexAttribType(); 02345 virtual int getVertexAttribSize() { return 3; } 02346 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; } 02347 02348 private: 02349 // Destructor 02350 virtual ~SoVertexShaderParameter3f(); 02351 }; 02352 02353 /*----------------------------------------------------------------------------*/ 02354 02389 class SoVertexShaderParameter3s : public SoVertexShaderParameter { 02390 02391 SO_NODE_HEADER(SoVertexShaderParameter3s); 02392 02393 public: 02397 SoVertexShaderParameter3s(); 02398 02402 SoMFVec3s value; 02403 02404 private: 02405 static void initClass(); 02406 static void exitClass(); 02407 02408 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02409 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02410 virtual int getVertexAttribNum() { return value.getNum(); } 02411 virtual GLenum getVertexAttribType(); 02412 virtual int getVertexAttribSize() { return 3; } 02413 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; } 02414 02415 private: 02416 // Destructor 02417 virtual ~SoVertexShaderParameter3s(); 02418 }; 02419 02420 /*----------------------------------------------------------------------------*/ 02421 02456 class SoVertexShaderParameter4f : public SoVertexShaderParameter { 02457 02458 SO_NODE_HEADER(SoVertexShaderParameter4f); 02459 02460 public: 02464 SoVertexShaderParameter4f(); 02465 02469 SoMFVec4f value; 02470 02471 private: 02472 static void initClass(); 02473 static void exitClass(); 02474 02475 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02476 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02477 virtual int getVertexAttribNum() { return value.getNum(); } 02478 virtual GLenum getVertexAttribType(); 02479 virtual int getVertexAttribSize() { return 4; } 02480 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; } 02481 02482 private: 02483 // Destructor 02484 virtual ~SoVertexShaderParameter4f(); 02485 }; 02486 02487 /*----------------------------------------------------------------------------*/ 02488 02530 class SoVertexShaderParameter4i : public SoVertexShaderParameter { 02531 02532 SO_NODE_HEADER(SoVertexShaderParameter4i); 02533 02534 public: 02538 SoVertexShaderParameter4i(); 02539 02543 SoMFVec4i32 value; 02544 02548 SoSFBool rangeScaling; 02549 02550 private: 02551 static void initClass(); 02552 static void exitClass(); 02553 02554 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02555 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02556 virtual int getVertexAttribNum() { return value.getNum(); } 02557 virtual GLenum getVertexAttribType(); 02558 virtual int getVertexAttribSize() { return 4; } 02559 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); } 02560 02561 private: 02562 // Destructor 02563 virtual ~SoVertexShaderParameter4i(); 02564 }; 02565 02566 /*----------------------------------------------------------------------------*/ 02567 02609 class SoVertexShaderParameter4s : public SoVertexShaderParameter { 02610 02611 SO_NODE_HEADER(SoVertexShaderParameter4s); 02612 02613 public: 02617 SoVertexShaderParameter4s(); 02618 02622 SoMFVec4s value; 02623 02627 SoSFBool rangeScaling; 02628 02629 private: 02630 static void initClass(); 02631 static void exitClass(); 02632 02633 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02634 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02635 virtual int getVertexAttribNum() { return value.getNum(); } 02636 virtual GLenum getVertexAttribType(); 02637 virtual int getVertexAttribSize() { return 4; } 02638 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); } 02639 02640 private: 02641 // Destructor 02642 virtual ~SoVertexShaderParameter4s(); 02643 }; 02644 02645 /*----------------------------------------------------------------------------*/ 02646 02688 class SoVertexShaderParameter4b : public SoVertexShaderParameter { 02689 02690 SO_NODE_HEADER(SoVertexShaderParameter4b); 02691 02692 public: 02696 SoVertexShaderParameter4b(); 02697 02701 SoMFVec4b value; 02702 02706 SoSFBool rangeScaling; 02707 02708 private: 02709 static void initClass(); 02710 static void exitClass(); 02711 02712 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02713 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02714 virtual int getVertexAttribNum() { return value.getNum(); } 02715 virtual GLenum getVertexAttribType(); 02716 virtual int getVertexAttribSize() { return 4; } 02717 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); } 02718 02719 private: 02720 // Destructor 02721 virtual ~SoVertexShaderParameter4b(); 02722 }; 02723 02724 /*----------------------------------------------------------------------------*/ 02725 02767 class SoVertexShaderParameter4ui : public SoVertexShaderParameter { 02768 02769 SO_NODE_HEADER(SoVertexShaderParameter4ui); 02770 02771 public: 02775 SoVertexShaderParameter4ui(); 02776 02780 SoMFVec4ui32 value; 02781 02785 SoSFBool rangeScaling; 02786 02787 private: 02788 static void initClass(); 02789 static void exitClass(); 02790 02791 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02792 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02793 virtual int getVertexAttribNum() { return value.getNum(); } 02794 virtual GLenum getVertexAttribType(); 02795 virtual int getVertexAttribSize() { return 4; } 02796 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); } 02797 02798 private: 02799 // Destructor 02800 virtual ~SoVertexShaderParameter4ui(); 02801 }; 02802 02803 /*----------------------------------------------------------------------------*/ 02804 02847 class SoVertexShaderParameter4us : public SoVertexShaderParameter { 02848 02849 SO_NODE_HEADER(SoVertexShaderParameter4us); 02850 02851 public: 02855 SoVertexShaderParameter4us(); 02856 02860 SoMFVec4us value; 02861 02865 SoSFBool rangeScaling; 02866 02867 private: 02868 static void initClass(); 02869 static void exitClass(); 02870 02871 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02872 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02873 virtual int getVertexAttribNum() { return value.getNum(); } 02874 virtual GLenum getVertexAttribType(); 02875 virtual int getVertexAttribSize() { return 4; } 02876 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); } 02877 02878 private: 02879 // Destructor 02880 virtual ~SoVertexShaderParameter4us(); 02881 }; 02882 02883 /*----------------------------------------------------------------------------*/ 02884 02927 class SoVertexShaderParameter4ub : public SoVertexShaderParameter { 02928 02929 SO_NODE_HEADER(SoVertexShaderParameter4ub); 02930 02931 public: 02935 SoVertexShaderParameter4ub(); 02936 02940 SoMFVec4ub value; 02941 02945 SoSFBool rangeScaling; 02946 02947 private: 02948 static void initClass(); 02949 static void exitClass(); 02950 02951 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); } 02952 virtual size_t getVertexAttribStride() { return value.getValueSize(); } 02953 virtual int getVertexAttribNum() { return value.getNum(); } 02954 virtual GLenum getVertexAttribType(); 02955 virtual int getVertexAttribSize() { return 4; } 02956 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); } 02957 02958 private: 02959 // Destructor 02960 virtual ~SoVertexShaderParameter4ub(); 02961 }; 02962 02963 /*----------------------------------------------------------------------------*/ 02964 03002 class SoVertexShaderParameterMatrix : public SoVertexShaderParameter { 03003 03004 SO_NODE_HEADER(SoVertexShaderParameterMatrix); 03005 03006 public: 03010 SoVertexShaderParameterMatrix(); 03011 03015 SoMFMatrix value; 03016 03017 private: 03018 virtual void doAction(SoAction *action); 03019 03020 private: 03021 static void initClass(); 03022 static void exitClass(); 03023 03024 virtual const char * getVertexAttribPtr(int i=0); 03025 virtual size_t getVertexAttribStride() { return sizeof(SbMat); } 03026 virtual int getVertexAttribNum() { return value.getNum(); } 03027 virtual GLenum getVertexAttribType(); 03028 virtual int getVertexAttribSize() { return 4; } 03029 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; } 03030 03031 private: 03032 // Destructor 03033 virtual ~SoVertexShaderParameterMatrix(); 03034 03035 private: 03036 // Storing a list of the transposed matrices of the value field is necessary 03037 // because Open Inventor stores matrices in row major order whereas OpenGL 03038 // load them in column major order. Consequently, this list is necessary, to provide 03039 // values sequentially stored in column major order. 03040 SbMat * m_columnMajorOrderMatrices; 03041 int m_matricesNumber; 03042 void storeColumnMajorOrderMatrices(int startIndex); 03043 }; 03044 03045 /*----------------------------------------------------------------------------*/ 03046 03047 //@TOBEWRAPPED 03085 class SoVertexShaderParameterBufferObject : public SoVertexShaderParameter { 03086 03087 SO_NODE_HEADER(SoVertexShaderParameterBufferObject); 03088 03089 public: 03093 SoVertexShaderParameterBufferObject(); 03094 03098 SoSFBufferObject value; 03099 03104 SoSFInt32 components; 03105 03110 SoSFEnum type; 03111 03116 SoSFInt32 offset; 03117 03123 SoSFInt32 stride; 03124 03129 SoSFBool shouldBeNormalized; 03130 03131 private: 03132 virtual void doAction(SoAction *action); 03133 03134 private: 03135 03136 static void initClass(); 03137 static void exitClass(); 03138 03139 virtual size_t getVertexAttribOffset(int) { return (size_t)offset.getValue(); } 03140 virtual const char* getVertexAttribPtr(int); 03141 03142 virtual size_t getVertexAttribStride(); 03143 virtual int getVertexAttribNum(); 03144 virtual GLenum getVertexAttribType(); 03145 virtual int getVertexAttribSize() { return components.getValue(); } 03146 virtual SbBool getVertexAttribIsToNormalize() { return shouldBeNormalized.getValue(); } 03147 03148 private: 03149 // Destructor 03150 virtual ~SoVertexShaderParameterBufferObject(); 03151 }; 03152 03153 /*----------------------------------------------------------------------------*/ 03154 03155 03156 03157 #endif /*_SO_SHADER_PARAMETER_H_*/ 03158 03159