-
Notifications
You must be signed in to change notification settings - Fork 0
/
Geom.h
46 lines (35 loc) · 950 Bytes
/
Geom.h
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
#pragma once
#include <stdinc.h>
#include "Shader.h"
using namespace std;
class Geom {
public:
Geom(vector<float> vertices, vector<unsigned int> elements, vector<float> uvs);
~Geom();
vector<float> vertexes;
vector<float> uvs;
vector<unsigned int> elements;
GLuint vao;
GLuint vbo;
GLuint ebo;
string shaderName;
// Shader shader;
GLint drawType = GL_STATIC_DRAW;
void bufferElements();
void bufferVertexData(shared_ptr<Shader> shader, vector<float> data);
void combineVertexData(vector<float> *data);
void draw();
void setMaterialCallback(std::function<void(shared_ptr<Shader>)> matcb) {
materialCallback = matcb;
materialCallbackSet = true;
};
private:
void init();
void callMaterial(shared_ptr<Shader> shader) {
if (!materialCallbackSet)
return;
materialCallback(shader);
};
bool materialCallbackSet = false;
std::function<void(shared_ptr<Shader>)> materialCallback;
};