1 #ifndef _SHARED_GRAPHICS_BUFFER_H_ 2 #define _SHARED_GRAPHICS_BUFFER_H_ 3 4 #include <string> 5 6 using std::string; 7 8 namespace Shared{ namespace Graphics{ 9 10 // ===================================================== 11 // class VertexBuffer 12 // ===================================================== 13 14 class VertexBuffer{ 15 private: 16 static const int texCoordCount = 8; 17 static const int attribCount = 8; 18 19 private: 20 void *positionPointer; 21 void *normalPointer; 22 23 void *texCoordPointers[texCoordCount]; 24 int texCoordCoordCounts[texCoordCount]; 25 26 void *attribPointers[attribCount]; 27 int attribCoordCounts[attribCount]; 28 string attribNames[attribCount]; 29 30 public: 31 VertexBuffer(); ~VertexBuffer()32 virtual ~VertexBuffer(){}; 33 34 virtual void init(int size)= 0; 35 36 void setPositionPointer(void *pointer); 37 void setNormalPointer(void *pointer); 38 void setTexCoordPointer(void *pointer, int texCoordIndex, int coordCount); 39 void setAttribPointer(void *pointer, int attribIndex, int coordCount, const string &name); 40 }; 41 42 // ===================================================== 43 // class IndexBuffer 44 // ===================================================== 45 46 class IndexBuffer{ 47 private: 48 void *indexPointer; 49 50 public: 51 IndexBuffer(); ~IndexBuffer()52 virtual ~IndexBuffer(){} 53 54 virtual void init(int size)= 0; 55 56 void setIndexPointer(void *pointer); 57 }; 58 59 }}//end namespace 60 61 #endif 62