00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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/SoMFMatrix.h>
00060 #include <Inventor/fields/SoSFNode.h>
00061 #include <Inventor/fields/SoMFNode.h>
00062 #include <Inventor/fields/SoSFEnum.h>
00063
00064 typedef unsigned int GLenum;
00065
00066 class SoGLShaderObject ;
00067 class SoShaderObject ;
00068 class SoShaderProgram ;
00069
00070 typedef WINGDIAPI void APIENTRY SoVPCacheFunc(const char *const);
00071 typedef WINGDIAPI void APIENTRY SoVPCacheFunc2(int, const char *const);
00072
00073
00074
00137 class SoShaderParameter : public SoNode {
00138
00139 SO_NODE_ABSTRACT_HEADER(SoShaderParameter);
00140
00141 public:
00146 SoSFString name;
00147
00152 SoSFInt32 identifier;
00153
00154
00155 private:
00156 static void initClass() ;
00157 static void exitClass() ;
00158
00159 SbBool isInternal() const;
00160
00161 private:
00165 SoShaderParameter();
00166
00167
00168 virtual ~SoShaderParameter();
00169
00170 };
00171
00314 class SoUniformShaderParameter : public SoShaderParameter {
00315
00316 SO_NODE_ABSTRACT_HEADER(SoUniformShaderParameter);
00317 public:SoDEPRECATED enum
00322 ShaderType {
00327 VERTEX,
00332 FRAGMENT
00333 };
00334
00343 SoSFEnum SoDEPRECATED shaderType;
00344
00345 virtual bool isEqual(const SoUniformShaderParameter* param) const = 0;
00346
00347 private:
00348 static void initClass() ;
00349 static void exitClass() ;
00350
00351
00352 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj)=0;
00353
00354
00355
00356
00357
00358
00359 SbBool isRegularBehavior() const
00360 { return m_isRegularBehavior ; }
00361 private:
00362 void GLRender(SoGLRenderAction *action);
00363
00364 private:
00368 SoUniformShaderParameter();
00369
00370 SbBool m_isRegularBehavior ;
00371
00372
00373 virtual ~SoUniformShaderParameter();
00374
00375 };
00376
00377
00418 class SoShaderParameter1f : public SoUniformShaderParameter {
00419
00420 SO_NODE_HEADER(SoShaderParameter1f);
00421
00422 public:
00423
00428 SoSFFloat value;
00429
00433 SoShaderParameter1f();
00434
00438 virtual bool isEqual(const SoUniformShaderParameter* param) const;
00439
00440 private:
00441
00442 static void initClass() ;
00443 static void exitClass() ;
00444
00445
00446 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
00447
00448 private:
00449
00450 virtual ~SoShaderParameter1f();
00451 };
00452
00453
00494 class SoShaderParameter1i : public SoUniformShaderParameter {
00495
00496 SO_NODE_HEADER(SoShaderParameter1i);
00497
00498 public:
00502 SoSFInt32 value;
00503
00507 SoShaderParameter1i();
00508
00509 virtual bool isEqual(const SoUniformShaderParameter* param) const;
00510
00511 private:
00512 static void initClass() ;
00513 static void exitClass() ;
00514
00515
00516 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
00517
00518 private:
00519
00520 virtual ~SoShaderParameter1i();
00521 };
00522
00523
00564 class SoShaderParameter2f : public SoUniformShaderParameter {
00565
00566 SO_NODE_HEADER(SoShaderParameter2f);
00567
00568 public:
00572 SoSFVec2f value;
00573
00577 SoShaderParameter2f();
00578
00579 virtual bool isEqual(const SoUniformShaderParameter* param) const;
00580
00581 private:
00582 static void initClass() ;
00583 static void exitClass() ;
00584
00585
00586 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
00587
00588 private:
00589
00590 virtual ~SoShaderParameter2f();
00591 };
00592
00593
00634 class SoShaderParameter2i : public SoUniformShaderParameter {
00635
00636 SO_NODE_HEADER(SoShaderParameter2i);
00637
00638 public:
00642 SoSFVec2i32 value;
00643
00647 SoShaderParameter2i();
00648
00649 virtual bool isEqual(const SoUniformShaderParameter* param) const;
00650
00651 private:
00652 static void initClass() ;
00653 static void exitClass() ;
00654
00655
00656 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
00657
00658 private:
00659
00660 virtual ~SoShaderParameter2i();
00661 };
00662
00663
00704 class SoShaderParameter3f : public SoUniformShaderParameter {
00705
00706 SO_NODE_HEADER(SoShaderParameter3f);
00707
00708 public:
00712 SoSFVec3f value;
00713
00717 SoShaderParameter3f();
00718
00719 virtual bool isEqual(const SoUniformShaderParameter* param) const;
00720
00721 private:
00722 static void initClass() ;
00723 static void exitClass() ;
00724
00725
00726 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
00727
00728 private:
00729
00730 virtual ~SoShaderParameter3f();
00731 };
00732
00733
00774 class SoShaderParameter3i : public SoUniformShaderParameter {
00775
00776 SO_NODE_HEADER(SoShaderParameter3i);
00777
00778 public:
00782 SoSFVec3i32 value;
00783
00787 SoShaderParameter3i();
00788
00789 virtual bool isEqual(const SoUniformShaderParameter* param) const;
00790
00791 private:
00792 static void initClass() ;
00793 static void exitClass() ;
00794
00795
00796 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
00797
00798 private:
00799
00800 virtual ~SoShaderParameter3i();
00801
00802 };
00803
00804
00845 class SoShaderParameter4f : public SoUniformShaderParameter {
00846
00847 SO_NODE_HEADER(SoShaderParameter4f);
00848
00849 public:
00853 SoSFVec4f value;
00854
00858 SoShaderParameter4f();
00859
00860 virtual bool isEqual(const SoUniformShaderParameter* param) const;
00861
00862 private:
00863 static void initClass() ;
00864 static void exitClass() ;
00865
00866
00867 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
00868
00869 private:
00870
00871 virtual ~SoShaderParameter4f();
00872 };
00873
00874
00915 class SoShaderParameter4i : public SoUniformShaderParameter {
00916
00917 SO_NODE_HEADER(SoShaderParameter4i);
00918
00919 public:
00923 SoSFVec4i32 value;
00924
00928 SoShaderParameter4i();
00929
00930 virtual bool isEqual(const SoUniformShaderParameter* param) const;
00931
00932 private:
00933 static void initClass() ;
00934 static void exitClass() ;
00935
00936
00937 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
00938
00939 private:
00940
00941 virtual ~SoShaderParameter4i();
00942 };
00943
00944
00987 class SoShaderParameterArray1f : public SoUniformShaderParameter {
00988
00989 SO_NODE_HEADER(SoShaderParameterArray1f);
00990
00991 public:
00995 SoMFFloat value;
00996
01000 SoShaderParameterArray1f();
01001
01002 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01003
01004 private:
01005 static void initClass() ;
01006 static void exitClass() ;
01007
01008
01009 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01010
01011 private:
01012
01013 virtual ~SoShaderParameterArray1f();
01014 };
01015
01016
01059 class SoShaderParameterArray1i : public SoUniformShaderParameter {
01060
01061 SO_NODE_HEADER(SoShaderParameterArray1i);
01062
01063 public:
01067 SoMFInt32 value;
01068
01072 SoShaderParameterArray1i();
01073
01074 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01075
01076 private:
01077 static void initClass() ;
01078 static void exitClass() ;
01079
01080
01081 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01082
01083 private:
01084
01085 virtual ~SoShaderParameterArray1i();
01086 };
01087
01088
01131 class SoShaderParameterArray2f : public SoUniformShaderParameter {
01132
01133 SO_NODE_HEADER(SoShaderParameterArray2f);
01134
01135 public:
01139 SoMFVec2f value;
01140
01144 SoShaderParameterArray2f();
01145
01146 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01147
01148 private:
01149 static void initClass() ;
01150 static void exitClass() ;
01151
01152
01153 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01154
01155 private:
01156
01157 virtual ~SoShaderParameterArray2f();
01158 };
01159
01160
01203 class SoShaderParameterArray2i : public SoUniformShaderParameter {
01204
01205 SO_NODE_HEADER(SoShaderParameterArray2i);
01206
01207 public:
01211 SoMFVec2i32 value;
01212
01216 SoShaderParameterArray2i();
01217
01218 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01219
01220 private:
01221 static void initClass() ;
01222 static void exitClass() ;
01223
01224
01225 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01226
01227 private:
01228
01229 virtual ~SoShaderParameterArray2i();
01230 };
01231
01232
01275 class SoShaderParameterArray3f : public SoUniformShaderParameter {
01276
01277 SO_NODE_HEADER(SoShaderParameterArray3f);
01278
01279 public:
01283 SoMFVec3f value;
01284
01288 SoShaderParameterArray3f();
01289
01290 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01291
01292 private:
01293 static void initClass() ;
01294 static void exitClass() ;
01295
01296
01297 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01298
01299 private:
01300
01301 virtual ~SoShaderParameterArray3f();
01302 };
01303
01304
01348 class SoShaderParameterArray3i : public SoUniformShaderParameter {
01349
01350 SO_NODE_HEADER(SoShaderParameterArray3i);
01351
01352 public:
01356 SoMFVec3i32 value;
01357
01361 SoShaderParameterArray3i();
01362
01363 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01364
01365 private:
01366 static void initClass() ;
01367 static void exitClass() ;
01368
01369
01370 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01371
01372 private:
01373
01374 virtual ~SoShaderParameterArray3i();
01375 };
01376
01377
01421 class SoShaderParameterArray4f : public SoUniformShaderParameter {
01422
01423 SO_NODE_HEADER(SoShaderParameterArray4f);
01424
01425 public:
01429 SoMFVec4f value;
01430
01434 SoShaderParameterArray4f();
01435
01436 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01437
01438 private:
01439 static void initClass() ;
01440 static void exitClass() ;
01441
01442
01443 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01444
01445 private:
01446
01447 virtual ~SoShaderParameterArray4f();
01448
01449 };
01450
01451
01496 class SoShaderParameterArray4i : public SoUniformShaderParameter {
01497
01498 SO_NODE_HEADER(SoShaderParameterArray4i);
01499
01500 public:
01504 SoMFVec4i32 value;
01505
01509 SoShaderParameterArray4i();
01510
01511 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01512
01513 private:
01514 static void initClass() ;
01515 static void exitClass() ;
01516
01517
01518 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01519
01520 private:
01521
01522 virtual ~SoShaderParameterArray4i();
01523 };
01524
01525
01581 class SoShaderParameterMatrix : public SoUniformShaderParameter {
01582
01583 SO_NODE_HEADER(SoShaderParameterMatrix);
01584
01585 public:
01589 SoSFMatrix value;
01590
01594 SoShaderParameterMatrix();
01595
01596 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01597
01598 private:
01599 static void initClass() ;
01600 static void exitClass() ;
01601
01602
01603 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01604
01605 private:
01606
01607 virtual ~SoShaderParameterMatrix();
01608
01609 };
01610
01611
01656 class SoShaderParameterMatrixArray : public SoUniformShaderParameter {
01657
01658 SO_NODE_HEADER(SoShaderParameterMatrixArray);
01659
01660 public:
01664 SoMFMatrix value;
01665
01669 SoShaderParameterMatrixArray();
01670
01671 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01672
01673 private:
01674 static void initClass() ;
01675 static void exitClass() ;
01676
01677
01678 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01679
01680 private:
01681
01682 virtual ~SoShaderParameterMatrixArray();
01683 };
01684
01685
01739 class SoShaderStateMatrixParameter : public SoUniformShaderParameter {
01740
01741 SO_NODE_HEADER(SoShaderStateMatrixParameter);
01742
01743 public:
01744
01746 enum MatrixType {
01750 MODELVIEW,
01751
01755 PROJECTION,
01756
01760 TEXTURE,
01761
01765 MODELVIEW_PROJECTION
01766 };
01767
01769 enum MatrixTransform {
01773 IDENTITY,
01774
01778 TRANSPOSE,
01779
01783 INVERSE,
01784
01788 INVERSE_TRANSPOSE
01789 };
01790
01794 SoSFEnum matrixType;
01795
01799 SoSFEnum matrixTransform;
01800
01804 SoShaderStateMatrixParameter();
01805
01806 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01807
01808 private:
01809 static void initClass() ;
01810 static void exitClass() ;
01811
01812
01813 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01814
01815 private:
01816
01817 virtual ~SoShaderStateMatrixParameter();
01818
01819 };
01820
01821
01862 class SoShaderParameterStruct : public SoUniformShaderParameter {
01863
01864 SO_NODE_HEADER(SoShaderParameterStruct);
01865
01866 public:
01870 SoShaderParameterStruct();
01874 SoMFNode value;
01875
01876 virtual bool isEqual(const SoUniformShaderParameter* param) const;
01877
01878 private:
01879 static void initClass();
01880 static void exitClass();
01881
01882
01883 virtual void updateParameter(SoGLRenderAction* action, SoGLShaderObject *glShadObj);
01884
01885 private:
01886
01887 virtual ~SoShaderParameterStruct();
01888 };
01889
01890
01891
02000 class SoVertexShaderParameter : public SoShaderParameter {
02001
02002 SO_NODE_ABSTRACT_HEADER(SoVertexShaderParameter);
02003
02004 private:
02005 virtual void doAction(SoAction *action);
02006 virtual void GLRender(SoGLRenderAction *action);
02007 virtual void callback(SoCallbackAction *action);
02008 virtual void getBoundingBox( SoGetBoundingBoxAction *action );
02009 virtual void rayPick(SoRayPickAction *action );
02010 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action );
02011
02012 private:
02013 static void initClass();
02014 static void exitClass();
02015
02016 static SbBool areVertexAttribFuncAvailable();
02017 static SbBool areVertexAttribDivisorFuncAvailable();
02018
02019 void getVertexAttribIndex(SoState * state, int& firstInd, int& size);
02020
02021 virtual SoVPCacheFunc2 * getVertexAttribFunc() = 0;
02022
02023 virtual const char * getVertexAttribPtr(int i=0) = 0;
02024 virtual size_t getVertexAttribStride() = 0;
02025 virtual int getVertexAttribNum() = 0;
02026 virtual GLenum getVertexAttribType() = 0;
02027 virtual int getVertexAttribSize() = 0;
02028 virtual SbBool getVertexAttribIsToNormalize() = 0;
02029 virtual unsigned int getVertexAttribDivisor() { return 0; }
02030 private:
02034 SoVertexShaderParameter();
02035
02036
02037 virtual ~SoVertexShaderParameter();
02038
02039 };
02040
02041
02077 class SoVertexShaderParameter1f : public SoVertexShaderParameter {
02078
02079 SO_NODE_HEADER(SoVertexShaderParameter1f);
02080
02081 public:
02085 SoVertexShaderParameter1f();
02086
02090 SoMFFloat value;
02091
02092 private:
02093 static void initClass();
02094 static void exitClass();
02095
02096 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02097
02098 virtual const char * getVertexAttribPtr( int ) { return (char *)value.getValues(0); }
02099 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02100 virtual int getVertexAttribNum() { return value.getNum(); }
02101 virtual GLenum getVertexAttribType();
02102 virtual int getVertexAttribSize() { return 1; }
02103 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; }
02104
02105 private:
02106
02107 virtual ~SoVertexShaderParameter1f();
02108 };
02109
02110
02111
02147 class SoVertexShaderParameter1s : public SoVertexShaderParameter {
02148
02149 SO_NODE_HEADER(SoVertexShaderParameter1s);
02150
02151 public:
02155 SoVertexShaderParameter1s();
02156
02160 SoMFShort value;
02161
02162 private:
02163 static void initClass();
02164 static void exitClass();
02165
02166 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02167
02168 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02169 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02170 virtual int getVertexAttribNum() { return value.getNum(); }
02171 virtual GLenum getVertexAttribType();
02172 virtual int getVertexAttribSize() { return 1; }
02173 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; }
02174
02175 private:
02176
02177 virtual ~SoVertexShaderParameter1s();
02178 };
02179
02180
02181
02217 class SoVertexShaderParameter2f : public SoVertexShaderParameter {
02218
02219 SO_NODE_HEADER(SoVertexShaderParameter2f);
02220
02221 public:
02225 SoVertexShaderParameter2f();
02226
02230 SoMFVec2f value;
02231
02232 private:
02233 static void initClass();
02234 static void exitClass();
02235
02236 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02237
02238 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02239 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02240 virtual int getVertexAttribNum() { return value.getNum(); }
02241 virtual GLenum getVertexAttribType();
02242 virtual int getVertexAttribSize() { return 2; }
02243 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; }
02244
02245 private:
02246
02247 virtual ~SoVertexShaderParameter2f();
02248 };
02249
02250
02251
02287 class SoVertexShaderParameter2s : public SoVertexShaderParameter {
02288
02289 SO_NODE_HEADER(SoVertexShaderParameter2s);
02290
02291 public:
02295 SoVertexShaderParameter2s();
02296
02300 SoMFVec2s value;
02301
02302 private:
02303 static void initClass();
02304 static void exitClass();
02305
02306 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02307
02308 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02309 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02310 virtual int getVertexAttribNum() { return value.getNum(); }
02311 virtual GLenum getVertexAttribType();
02312 virtual int getVertexAttribSize() { return 2; }
02313 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; }
02314
02315 private:
02316
02317 virtual ~SoVertexShaderParameter2s();
02318 };
02319
02320
02321
02357 class SoVertexShaderParameter3f : public SoVertexShaderParameter {
02358
02359 SO_NODE_HEADER(SoVertexShaderParameter3f);
02360
02361 public:
02365 SoVertexShaderParameter3f();
02366
02370 SoMFVec3f value;
02371
02372 private:
02373 static void initClass();
02374 static void exitClass();
02375
02376 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02377
02378 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02379 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02380 virtual int getVertexAttribNum() { return value.getNum(); }
02381 virtual GLenum getVertexAttribType();
02382 virtual int getVertexAttribSize() { return 3; }
02383 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; }
02384
02385 private:
02386
02387 virtual ~SoVertexShaderParameter3f();
02388 };
02389
02390
02391
02427 class SoVertexShaderParameter3s : public SoVertexShaderParameter {
02428
02429 SO_NODE_HEADER(SoVertexShaderParameter3s);
02430
02431 public:
02435 SoVertexShaderParameter3s();
02436
02440 SoMFVec3s value;
02441
02442 private:
02443 static void initClass();
02444 static void exitClass();
02445
02446 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02447
02448 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02449 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02450 virtual int getVertexAttribNum() { return value.getNum(); }
02451 virtual GLenum getVertexAttribType();
02452 virtual int getVertexAttribSize() { return 3; }
02453 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; }
02454
02455 private:
02456
02457 virtual ~SoVertexShaderParameter3s();
02458 };
02459
02460
02461
02497 class SoVertexShaderParameter4f : public SoVertexShaderParameter {
02498
02499 SO_NODE_HEADER(SoVertexShaderParameter4f);
02500
02501 public:
02505 SoVertexShaderParameter4f();
02506
02510 SoMFVec4f value;
02511
02512 private:
02513 static void initClass();
02514 static void exitClass();
02515
02516 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02517
02518 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02519 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02520 virtual int getVertexAttribNum() { return value.getNum(); }
02521 virtual GLenum getVertexAttribType();
02522 virtual int getVertexAttribSize() { return 4; }
02523 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; }
02524
02525 private:
02526
02527 virtual ~SoVertexShaderParameter4f();
02528 };
02529
02530
02531
02574 class SoVertexShaderParameter4i : public SoVertexShaderParameter {
02575
02576 SO_NODE_HEADER(SoVertexShaderParameter4i);
02577
02578 public:
02582 SoVertexShaderParameter4i();
02583
02587 SoMFVec4i32 value;
02588
02592 SoSFBool rangeScaling;
02593
02594 private:
02595 static void initClass();
02596 static void exitClass();
02597
02598 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02599
02600 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02601 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02602 virtual int getVertexAttribNum() { return value.getNum(); }
02603 virtual GLenum getVertexAttribType();
02604 virtual int getVertexAttribSize() { return 4; }
02605 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); }
02606
02607 private:
02608
02609 virtual ~SoVertexShaderParameter4i();
02610 };
02611
02612
02613
02656 class SoVertexShaderParameter4s : public SoVertexShaderParameter {
02657
02658 SO_NODE_HEADER(SoVertexShaderParameter4s);
02659
02660 public:
02664 SoVertexShaderParameter4s();
02665
02669 SoMFVec4s value;
02670
02674 SoSFBool rangeScaling;
02675
02676 private:
02677 static void initClass();
02678 static void exitClass();
02679
02680 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02681
02682 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02683 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02684 virtual int getVertexAttribNum() { return value.getNum(); }
02685 virtual GLenum getVertexAttribType();
02686 virtual int getVertexAttribSize() { return 4; }
02687 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); }
02688
02689 private:
02690
02691 virtual ~SoVertexShaderParameter4s();
02692 };
02693
02694
02695
02738 class SoVertexShaderParameter4b : public SoVertexShaderParameter {
02739
02740 SO_NODE_HEADER(SoVertexShaderParameter4b);
02741
02742 public:
02746 SoVertexShaderParameter4b();
02747
02751 SoMFVec4b value;
02752
02756 SoSFBool rangeScaling;
02757
02758 private:
02759 static void initClass();
02760 static void exitClass();
02761
02762 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02763
02764 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02765 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02766 virtual int getVertexAttribNum() { return value.getNum(); }
02767 virtual GLenum getVertexAttribType();
02768 virtual int getVertexAttribSize() { return 4; }
02769 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); }
02770
02771 private:
02772
02773 virtual ~SoVertexShaderParameter4b();
02774 };
02775
02776
02777
02820 class SoVertexShaderParameter4ui : public SoVertexShaderParameter {
02821
02822 SO_NODE_HEADER(SoVertexShaderParameter4ui);
02823
02824 public:
02828 SoVertexShaderParameter4ui();
02829
02833 SoMFVec4ui32 value;
02834
02838 SoSFBool rangeScaling;
02839
02840 private:
02841 static void initClass();
02842 static void exitClass();
02843
02844 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02845
02846 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02847 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02848 virtual int getVertexAttribNum() { return value.getNum(); }
02849 virtual GLenum getVertexAttribType();
02850 virtual int getVertexAttribSize() { return 4; }
02851 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); }
02852
02853 private:
02854
02855 virtual ~SoVertexShaderParameter4ui();
02856 };
02857
02858
02859
02903 class SoVertexShaderParameter4us : public SoVertexShaderParameter {
02904
02905 SO_NODE_HEADER(SoVertexShaderParameter4us);
02906
02907 public:
02911 SoVertexShaderParameter4us();
02912
02916 SoMFVec4us value;
02917
02921 SoSFBool rangeScaling;
02922
02923 private:
02924 static void initClass();
02925 static void exitClass();
02926
02927 virtual SoVPCacheFunc2 * getVertexAttribFunc();
02928
02929 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
02930 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
02931 virtual int getVertexAttribNum() { return value.getNum(); }
02932 virtual GLenum getVertexAttribType();
02933 virtual int getVertexAttribSize() { return 4; }
02934 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); }
02935
02936 private:
02937
02938 virtual ~SoVertexShaderParameter4us();
02939 };
02940
02941
02942
02986 class SoVertexShaderParameter4ub : public SoVertexShaderParameter {
02987
02988 SO_NODE_HEADER(SoVertexShaderParameter4ub);
02989
02990 public:
02994 SoVertexShaderParameter4ub();
02995
02999 SoMFVec4ub value;
03000
03004 SoSFBool rangeScaling;
03005
03006 private:
03007 static void initClass();
03008 static void exitClass();
03009
03010 virtual SoVPCacheFunc2 * getVertexAttribFunc();
03011
03012 virtual const char * getVertexAttribPtr(int) { return (char *)value.getValues(0); }
03013 virtual size_t getVertexAttribStride() { return value.getValueSize(); }
03014 virtual int getVertexAttribNum() { return value.getNum(); }
03015 virtual GLenum getVertexAttribType();
03016 virtual int getVertexAttribSize() { return 4; }
03017 virtual SbBool getVertexAttribIsToNormalize() { return rangeScaling.getValue(); }
03018
03019 private:
03020
03021 virtual ~SoVertexShaderParameter4ub();
03022 };
03023
03024
03025
03064 class SoVertexShaderParameterMatrix : public SoVertexShaderParameter {
03065
03066 SO_NODE_HEADER(SoVertexShaderParameterMatrix);
03067
03068 public:
03072 SoVertexShaderParameterMatrix();
03073
03077 SoMFMatrix value;
03078
03079 private:
03080 virtual void doAction(SoAction *action);
03081
03082 private:
03083 static void initClass();
03084 static void exitClass();
03085
03086 virtual SoVPCacheFunc2 * getVertexAttribFunc();
03087
03088 virtual const char * getVertexAttribPtr(int i=0);
03089 virtual size_t getVertexAttribStride() { return sizeof(SbMat); }
03090 virtual int getVertexAttribNum() { return value.getNum(); }
03091 virtual GLenum getVertexAttribType();
03092 virtual int getVertexAttribSize() { return 4; }
03093 virtual SbBool getVertexAttribIsToNormalize() { return FALSE; }
03094
03095 private:
03096
03097 virtual ~SoVertexShaderParameterMatrix();
03098
03099 private:
03100
03101
03102
03103
03104 SbMat * m_columnMajorOrderMatrices;
03105 int m_matricesNumber;
03106 void storeColumnMajorOrderMatrices(int startIndex);
03107 };
03108
03109
03110
03111
03150 class SoVertexShaderParameterBufferObject : public SoVertexShaderParameter {
03151
03152 SO_NODE_HEADER(SoVertexShaderParameterBufferObject);
03153
03154 public:
03158 SoVertexShaderParameterBufferObject();
03159
03163 SoSFBufferObject value;
03164
03169 SoSFInt32 components;
03170
03175 SoSFEnum type;
03176
03181 SoSFInt32 offset;
03182
03188 SoSFInt32 stride;
03189
03194 SoSFBool shouldBeNormalized;
03195
03196 private:
03197 virtual void doAction(SoAction *action);
03198
03199 private:
03200
03201 static void initClass();
03202 static void exitClass();
03203
03204 virtual SoVPCacheFunc2 * getVertexAttribFunc();
03205
03206 virtual const char * getVertexAttribPtr(int)
03207 {
03208 uintptr_t castedOffest = (uintptr_t)offset.getValue();
03209 return reinterpret_cast<char*>(castedOffest);
03210 }
03211 virtual size_t getVertexAttribStride();
03212 virtual int getVertexAttribNum();
03213 virtual GLenum getVertexAttribType();
03214 virtual int getVertexAttribSize() { return components.getValue(); }
03215 virtual SbBool getVertexAttribIsToNormalize() { return shouldBeNormalized.getValue(); }
03216
03217 private:
03218
03219 virtual ~SoVertexShaderParameterBufferObject();
03220 };
03221
03222
03223
03224
03225
03226 #endif
03227
03228