2D_Game_Engine
Loading...
Searching...
No Matches
vertexbufferlayout.hpp
Go to the documentation of this file.
1#pragma once
2
4 unsigned int type;
5 unsigned int count;
7
8 static unsigned int GetSizeOfType(unsigned int type){
9 switch(type){
10 case GL_FLOAT:
11 return sizeof(GLfloat);
12 case GL_UNSIGNED_INT:
13 return sizeof(GLuint);
14 case GL_UNSIGNED_BYTE:
15 return sizeof(GLbyte);
16 default:
17 printf("Wrong type\n");
18 return 0;
19 }
20 }
21};
22
24public:
25 VertexBufferLayout() : m_Stride(0){}
26
27 void Push(unsigned int type,unsigned int count,bool normalized);
28 inline const std::vector<VertexBufferElement> &GetElements() const{ return m_Elements; };
29 inline unsigned int GetStride() const{ return m_Stride; };
30 inline void Clear(){
31 m_Elements.clear();
32 m_Stride=0;
33 }
34
35private:
36 std::vector<VertexBufferElement> m_Elements;
37 unsigned int m_Stride;
38};
void Push(unsigned int type, unsigned int count, bool normalized)
const std::vector< VertexBufferElement > & GetElements() const
unsigned int GetStride() const
static unsigned int GetSizeOfType(unsigned int type)