2D_Game_Engine
Loading...
Searching...
No Matches
include
vertexbufferlayout.hpp
Go to the documentation of this file.
1
#pragma once
2
3
struct
VertexBufferElement
{
4
unsigned
int
type
;
5
unsigned
int
count
;
6
bool
normalized
;
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
23
class
VertexBufferLayout
{
24
public
:
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
35
private
:
36
std::vector<VertexBufferElement> m_Elements;
37
unsigned
int
m_Stride;
38
};
VertexBufferLayout
Definition
vertexbufferlayout.hpp:23
VertexBufferLayout::Push
void Push(unsigned int type, unsigned int count, bool normalized)
Definition
vertexbufferlayout.cpp:4
VertexBufferLayout::VertexBufferLayout
VertexBufferLayout()
Definition
vertexbufferlayout.hpp:25
VertexBufferLayout::Clear
void Clear()
Definition
vertexbufferlayout.hpp:30
VertexBufferLayout::GetElements
const std::vector< VertexBufferElement > & GetElements() const
Definition
vertexbufferlayout.hpp:28
VertexBufferLayout::GetStride
unsigned int GetStride() const
Definition
vertexbufferlayout.hpp:29
VertexBufferElement
Definition
vertexbufferlayout.hpp:3
VertexBufferElement::normalized
bool normalized
Definition
vertexbufferlayout.hpp:6
VertexBufferElement::GetSizeOfType
static unsigned int GetSizeOfType(unsigned int type)
Definition
vertexbufferlayout.hpp:8
VertexBufferElement::type
unsigned int type
Definition
vertexbufferlayout.hpp:4
VertexBufferElement::count
unsigned int count
Definition
vertexbufferlayout.hpp:5
Generated by
1.10.0