forked from SafeKing/ClothSimulation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectMesh.h
More file actions
72 lines (57 loc) · 1.57 KB
/
Copy pathObjectMesh.h
File metadata and controls
72 lines (57 loc) · 1.57 KB
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
70
71
#pragma once
#include <vector>
#include <GL/glew.h>
// Include GLM
#include <glm/gtc/matrix_transform.hpp>
// Include AssImp
//#include <assimp/Importer.hpp> // C++ importer interface
//#include <assimp/scene.h> // Output data structure
//#include <assimp/postprocess.h> // Post processing flags
#include "shader.hpp"
#include "texture.hpp"
#include "controls.hpp"
#define M_PI 3.14159265358979323846
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
class ObjectMesh
{
public:
ObjectMesh(const char * path);
ObjectMesh(void);
~ObjectMesh(void);
struct Vertex {
glm::vec3 position;
glm::vec2 uv;
glm::vec3 normal;
};
std::vector<unsigned short> indices;
std::vector<glm::vec3> vertices;
std::vector<glm::vec2> uvs;
std::vector<glm::vec3> normals;
float ball_radius;
glm::vec3 ball_pos;
GLuint ObjVAO, vertexbuffer,uvbuffer,normalbuffer,elementbuffer,tangentbuffer,bitangentbuffer;
GLuint objTextureID;
GLuint BumpObjVAO;
GLuint PlaneVAO;
int verticesNumber;
GLuint DiffuseTexture ;
GLuint NormalTexture;
GLuint SpecularTexture ;
GLuint sphereVAO;
int elementCount;
GLuint sphereTex, TexturePlane;
bool loadAssImp(
const char * path
/*std::vector<unsigned short> & indices,
std::vector<glm::vec3> & vertices,
std::vector<glm::vec2> & uvs,
std::vector<glm::vec3> & normals*/
);
void GenerateObjectBuffer();
void LinkObjToShader(Shader* shader);
void Render(Shader * shader);
void drawSphere(glm::vec3& position, Shader* shader);
void CreateMesh();
void generatePlaneBuffer(Shader* shader);
void drawPlane(Shader* shader);
};