00001 #ifndef VERTEXBUFFER_H 00002 #define VERTEXBUFFER_H 00003 00004 #include "AbstractPropertyContainer.h" 00005 #include "RenderInterface.h" 00006 00007 using namespace std; 00008 00009 namespace RenderTools { 00010 00011 class Vertexbuffer : public RenderInterface, public AbstractPropertyContainer { 00012 public: 00013 00014 Vertexbuffer( void ); 00015 ~Vertexbuffer( void ); 00016 00017 static PropertyPtr create( const XMLNodePtr & xml = XMLNodePtr() ); 00018 virtual void createProperties( void ); 00019 virtual const string getTypeName( bool ofComponent = false ) const; 00020 00021 virtual void onInitialize( void ); 00022 virtual void onRender( void ); 00023 00024 bool getDirectRendering( void ) const; 00025 bool getUseProgram( void ) const; 00026 GLenum getUsage( void ) const; 00027 GLenum getMode( void ) const; 00028 GLuint getNumVertices( void ) const; 00029 void setUsage( GLenum usage ); 00030 void setMode( GLenum mode ); 00031 void setNumVertices( GLuint numVertices ); 00032 void setDirectRendering( bool state = true ); 00033 void setUseProgram( bool state = true ); 00034 void setVertexAttribute( GLuint vertexIndex, const string attribName, const GLfloat * data ); 00035 void setVertexAttribute( GLuint vertexIndex, GLuint attribIndex, const GLfloat * data ); 00036 void addAttribute( GLuint numFloats, const string name ); 00037 GLuint getNumAttributes( void ); 00038 GLuint getVertexSize( void ); 00039 const vector<GLuint> & getAttributeSizes( void ); 00040 const vector<GLuint> & getAttributeOffsets( void ); 00041 const vector<string> & getAttributeNames( void ); 00042 00043 private: 00044 void resize( void ); 00045 00046 bool m_useProgram; 00047 bool m_directRendering; 00048 00049 GLuint m_id; 00050 GLenum m_usage; 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 GLenum m_mode; 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 GLuint m_numVertices; 00072 GLuint m_numAttributes; 00073 GLuint m_vertexSize; 00074 vector<GLuint> m_offsets; 00075 vector<GLuint> m_sizes; 00076 vector<string> m_names; 00077 GLfloat * m_data; 00078 }; 00079 00080 }; // namespace RenderTools 00081 00082 #endif
1.5.8