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 #include "buffer.h"
9
10 #include "leak_dumper.h"
11
12 namespace Shared{ namespace Graphics{
13
14 // =====================================================
15 // class VertexBuffer
16 // =====================================================
17
VertexBuffer()18 VertexBuffer::VertexBuffer(){
19 positionPointer= NULL;
20 normalPointer= NULL;
21 for(int i= 0; i<texCoordCount; ++i){
22 texCoordPointers[i]= NULL;
23 texCoordCoordCounts[i]= -1;
24 }
25 for(int i= 0; i<attribCount; ++i){
26 attribPointers[i]= NULL;
27 attribCoordCounts[i]= -1;
28 }
29 }
30
setPositionPointer(void * pointer)31 void VertexBuffer::setPositionPointer(void *pointer){
32 positionPointer= pointer;
33 }
34
setNormalPointer(void * pointer)35 void VertexBuffer::setNormalPointer(void *pointer){
36 normalPointer= pointer;
37 }
38
setTexCoordPointer(void * pointer,int texCoordIndex,int coordCount)39 void VertexBuffer::setTexCoordPointer(void *pointer, int texCoordIndex, int coordCount){
40 texCoordPointers[texCoordIndex]= pointer;
41 texCoordCoordCounts[texCoordIndex]= coordCount;
42 }
43
setAttribPointer(void * pointer,int attribIndex,int coordCount,const string & name)44 void VertexBuffer::setAttribPointer(void *pointer, int attribIndex, int coordCount, const string &name){
45 attribPointers[attribIndex]= pointer;
46 attribCoordCounts[attribIndex]= coordCount;
47 attribNames[attribIndex]= name;
48 }
49
50 // =====================================================
51 // class IndexBuffer
52 // =====================================================
53
IndexBuffer()54 IndexBuffer::IndexBuffer(){
55 indexPointer= NULL;
56 }
57
setIndexPointer(void * pointer)58 void IndexBuffer::setIndexPointer(void *pointer){
59 indexPointer= pointer;
60 }
61
62 }}//end namespace
63