-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.cpp
57 lines (48 loc) · 1.71 KB
/
render.cpp
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
55
56
57
//#include "render.h"
//Render::Render()
//{
// clear();
//}
//Render::~Render()
//{
// clear();
//}
//void Render::clear()
//{
// mesh_map_.clear();
//// for(auto& it = mesh_map_.begin(); it!=mesh_map_.end();){
//// it = mesh_map_.erase(it);
//// }
//}
//void Render::addMesh(Mesh *mesh, QString textrue_path)
//{
// unique_ptr<QOpenGLShaderProgram> shader(new QOpenGLShaderProgram());
// if (!shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/resource/shaders/hand.vert"))
// return;
// if (!shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/resource/shaders/hand.frag"))
// return;
// if (!shader->link())
// return;
// unique_ptr<QOpenGLTexture> texture(new QOpenGLTexture(QImage(textrue_path).mirrored()));
// texture->setMinificationFilter(QOpenGLTexture::Nearest);
// texture->setMagnificationFilter(QOpenGLTexture::Linear);
// texture->setWrapMode(QOpenGLTexture::Repeat);
// mesh_map_[mesh] = unique_ptr<RenderMesh>(new RenderMesh(mesh, shader, texture));
//}
//void Render::addMesh(Mesh *mesh, QColor color)
//{
// unique_ptr<QOpenGLShaderProgram> shader(new QOpenGLShaderProgram());
// if (!shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/resource/shaders/default.vert"))
// return;
// if (!shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/resource/shaders/default.frag"))
// return;
// if (!shader->link())
// return;
// mesh_map_[mesh] = unique_ptr<RenderMesh>(new RenderMesh(mesh, shader, color));
//}
//void Render::drawAll(QMat4 view, QMat4 projection)
//{
// for(auto& it = mesh_map_.begin(); it != mesh_map_.end();it++){
// it->second->draw(view, projection);
// }
//}