1 // ============================================================== 2 // This file is part of MegaGlest Shared Library (www.megaglest.org) 3 // 4 // Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke 5 // The MegaGlest Team, under GNU GPL v3.0 6 // ============================================================== 7 8 #ifndef _SHARED_GRAPHICS_BUFFER_H_ 9 #define _SHARED_GRAPHICS_BUFFER_H_ 10 11 #include <string> 12 #include "leak_dumper.h" 13 14 using std::string; 15 16 namespace Shared{ namespace Graphics{ 17 18 // ===================================================== 19 // class VertexBuffer 20 // ===================================================== 21 22 class VertexBuffer{ 23 private: 24 static const int texCoordCount = 8; 25 static const int attribCount = 8; 26 27 private: 28 void *positionPointer; 29 void *normalPointer; 30 31 void *texCoordPointers[texCoordCount]; 32 int texCoordCoordCounts[texCoordCount]; 33 34 void *attribPointers[attribCount]; 35 int attribCoordCounts[attribCount]; 36 string attribNames[attribCount]; 37 38 public: 39 VertexBuffer(); ~VertexBuffer()40 virtual ~VertexBuffer(){}; 41 42 virtual void init(int size)= 0; 43 44 void setPositionPointer(void *pointer); 45 void setNormalPointer(void *pointer); 46 void setTexCoordPointer(void *pointer, int texCoordIndex, int coordCount); 47 void setAttribPointer(void *pointer, int attribIndex, int coordCount, const string &name); 48 }; 49 50 // ===================================================== 51 // class IndexBuffer 52 // ===================================================== 53 54 class IndexBuffer{ 55 private: 56 void *indexPointer; 57 58 public: 59 IndexBuffer(); ~IndexBuffer()60 virtual ~IndexBuffer(){} 61 62 virtual void init(int size)= 0; 63 64 void setIndexPointer(void *pointer); 65 }; 66 67 }}//end namespace 68 69 #endif 70