MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoShader/Inventor/elements/SoGLVertexAttributeElement.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 
00006 
00007 
00008 #ifndef  _SO_GL_VERTEX_ATTRIBUTE_ELEMENT_
00009 #define  _SO_GL_VERTEX_ATTRIBUTE_ELEMENT_
00010 
00011 #include "SoShaderSystem.h"
00012 #include <Inventor/elements/SoAccumulatedElement.h>
00013 #include <Inventor/SoLists.h>
00014 #include <Inventor/misc/SoVBO.h>
00015 #include <vector>
00016 
00018 struct INVENTOR_SHADER_API SoVertexAttributeInfo
00019 {
00020 public:
00021   SoVertexAttributeInfo();
00022 
00024   SbString _name;
00025 
00027   SoNode*  _node;
00028 
00030   const void* _data;
00032   uint32_t    _numBytes;
00034   uint32_t    _numValues;
00035 
00037   GLenum _type;
00039   int    _numComponents;
00041   bool   _normalized;
00042 
00044   SoVBO    _vbo;
00045 
00048   GLint    _index;
00049 
00051   bool _shouldFlipRGBAOnLittleEndian;
00052 };
00053 
00054 class SoVertexShape;
00055 class SoGLRenderAction;
00056 
00058 class INVENTOR_SHADER_API SoGLVertexAttributeElement : public SoAccumulatedElement
00059 {
00060   typedef SoAccumulatedElement inherited;
00061 
00062   SO_ELEMENT_HEADER(SoGLVertexAttributeElement);
00063   
00064   public:
00065     typedef std::vector<SoVertexAttributeInfo*> AttributeList;
00066 
00068     virtual void init(SoState *state);
00069 
00071     static  void add(SoState *state, SoVertexAttributeInfo* info);
00072 
00074     static  void clear(SoState *state, SoNode *node);
00075 
00077     static  const AttributeList& get(SoState *state);
00078 
00080     virtual void push(SoState *state);
00081 
00082     SoINTERNAL public:
00083 
00085     static void initClass();
00086 
00087   protected:
00088     static void enableVertexAttributesCB(SoVertexShape* shape, SoGLRenderAction* action, bool useVbo, uint32_t numVertices);
00089     static void disableVertexAttributesCB(SoVertexShape* shape, SoGLRenderAction* action, bool useVbo, uint32_t numVertices);
00090 
00092     AttributeList _attributes;
00093 };
00094 
00095 #endif