-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrimitives.h
67 lines (53 loc) · 2.18 KB
/
Primitives.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
#ifndef PRIMITIVE_CLASS_H
#define PRIMITIVE_CLASS_H
#include <glad/glad.h>
#include "Mesh.h"
class Primitives {
private:
std::vector<Vertex> plane_vertices = {
// COORDINATES / NORMALS / COLORS / TEXTURE COORDINATES
Vertex{ glm::vec3( -1.0f, 1.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 0.0f ), glm::vec3( 1.0f, 1.0f, 0.0f ), glm::vec2( 0.0f, 0.0f ) },
Vertex{ glm::vec3( -1.0f, -1.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 1.0f ), glm::vec2( 0.0f, 1.0f ) },
Vertex{ glm::vec3( 1.0f, -1.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 0.0f ), glm::vec3( 1.0f, 0.0f, 1.0f ), glm::vec2( 1.0f, 1.0f ) },
Vertex{ glm::vec3( 1.0f, 1.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 0.0f ), glm::vec3( 1.0f, 0.5f, 0.4f ), glm::vec2( 1.0f, 0.0f ) }
};
std::vector<GLuint> plane_indices = {
0, 3, 2,
0, 2, 1
};
std::vector<Vertex> triangle_vertices = {
// COORDINATES / NORMALS / COLORS / TEXTURE COORDINATES
Vertex{ glm::vec3( -0.5f, 0.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 0.0f ), glm::vec3( 1.0f, 1.0f, 0.0f ), glm::vec2( 0.0f, 0.0f ) },
Vertex{ glm::vec3( 0.5f, 0.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 1.0f ), glm::vec2( 0.0f, 1.0f ) },
Vertex{ glm::vec3( 0.0f, -0.5f, 0.0f ), glm::vec3( 0.0f, 1.0f, 0.0f ), glm::vec3( 1.0f, 0.0f, 1.0f ), glm::vec2( 1.0f, 1.0f ) },
};
std::vector<GLuint> triangle_indices = {
0, 2, 1
};
std::vector<Texture> tex;
public:
Mesh* circleMesh;
Mesh* rectangleMesh;
Primitives();
Mesh* CreateCircleMesh();
Mesh* CreateRectangleMesh();
void DrawCircle (
Shader& shader,
Camera& camera,
glm::mat4 matrix = glm::mat4( 1.0f ),
glm::vec3 translation = glm::vec3( 0.0f, 0.0f, 0.0f ),
glm::quat rotation = glm::quat( 1.0f, 0.0f, 0.0f, 0.0f ),
glm::vec3 scale = glm::vec3( 1.0f, 1.0f, 1.0f ),
bool isWire = false
) const;
void DrawRectangle (
Shader& shader,
Camera& camera,
glm::mat4 matrix = glm::mat4( 1.0f ),
glm::vec3 translation = glm::vec3( 0.0f, 0.0f, 0.0f ),
glm::quat rotation = glm::quat( 1.0f, 0.0f, 0.0f, 0.0f ),
glm::vec3 scale = glm::vec3( 1.0f, 1.0f, 1.0f ),
bool isWire = false
) const;
};
#endif