forked from LibreCAD/LibreCAD_3
/
shape_entity.h
executable file
·69 lines (50 loc) · 1.31 KB
/
shape_entity.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef SHAPE_ENTITY_H
#define SHAPE_ENTITY_H
#include <GL/glew.h>
#include <GL/gl.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "vertexbuffer.h"
#include "indexbuffer.h"
#include "vertexarray.h"
#include "vertexbufferlayout.h"
#include "shader.h"
#include "gl_entity.h"
namespace lc
{
namespace viewer
{
namespace opengl
{
class Shape_Entity : public GL_Entity
{
private:
VertexArray VAO;
VertexBuffer VBO;
IndexBuffer IBO; // GPU Buffer Objects (vertex data)
glm::mat4 _model; // model matrix
GLenum _render_mode; //mode for render
GLenum _fill_mode; //mode for filling
float _linewidth; //linewidth
Shader* _basic_shader;
public:
Shape_Entity();
~Shape_Entity();
void LoadData(float* vertices,int size,unsigned int* indices,int count);
void ClearData();
void Bind();
void UnBind();
void SetShader(Shader* shader);
void SetModelMatrix(glm::mat4 model);
void SetRenderMode(GLenum rendermode);
void SetFillMode(GLenum fillmode);
void SetLineWidth(float width);
void SetColor(float R,float G,float B,float A);
void Delete();
void Draw(glm::mat4 proj,glm::mat4 view);
};
}
}
}
#endif // SHAPE_ENTITY_H