-
Notifications
You must be signed in to change notification settings - Fork 0
/
vertexbufferlayout.hpp
54 lines (40 loc) · 1.06 KB
/
vertexbufferlayout.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// vertexbufferlayout.hpp
// OpenGL
//
// Created by Andrew Diggs on 7/27/22.
//
#ifndef vertexbufferlayout_hpp
#define vertexbufferlayout_hpp
#include <stdio.h>
#include <vector>
#include "Render.hpp"
struct Element{
unsigned int count;
unsigned int type;
bool norm;
};
class VertexBufferLayout{
std::vector<Element> m_elements;
unsigned int m_stride;
public:
VertexBufferLayout()
: m_stride(0){}
template<typename t>
void Push(unsigned int count){
//static_assert(false);
}
template<>
void Push<float>(unsigned int count){
m_elements.push_back({GL_FLOAT, count, false});
m_stride += sizeof(GLfloat);
}
template<>
void Push<unsigned int>(unsigned int count){
m_elements.push_back({GL_UNSIGNED_INT, count, false});
m_stride += sizeof(GLuint);
}
inline const std::vector<Element> GetElements() const& {return m_elements;}
inline unsigned int GetStride() const { return m_stride;}
};
#endif /* vertexbufferlayout_hpp */