-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloth_renderer.h
More file actions
40 lines (32 loc) · 1.61 KB
/
Copy pathcloth_renderer.h
File metadata and controls
40 lines (32 loc) · 1.61 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
#ifndef CLOTH_RENDERER_H
#define CLOTH_RENDERER_H
#include "cloth_handler.h"
#include "cloth_vertex.h"
#include "shader.h"
#include "global.h"
#include <vector>
class ClothRenderer {
public:
ClothRenderer(); // handles all cloth rendering related stuff, the constructor just sets up the vbo and vao
~ClothRenderer();
void RenderCloth(ClothHandler& cloth, Shader& shader);
void RenderVertices(ClothHandler& cloth, Shader& shader); // used to render only the vertices by rendering a dot on each cloth vertex position
void RenderSprings(ClothHandler& cloth, Shader& shader);
private:
void fillVertBuffer(ClothHandler& cloth); // since cloth vertex positions change every frame, the vbo should get updated as soon as they do
void setUpRendering(ClothHandler& cloth, Shader& shader);
glm::vec3 CalculateVertexNormal(ClothHandler& cloth, int i, int j);
unsigned int vertexVBO;
unsigned int vertexVAO;
unsigned int vertexEBO;
// unsigned int vertexEBOs[Global::cloth_rows-1];
unsigned int structuralSpringEBOs[Global::cloth_rows + Global::cloth_cols];
unsigned int sheerSpringEBOs[2];
unsigned int indices[(Global::cloth_rows-1) * (2*Global::cloth_cols+1)];
std::vector<unsigned int> clothIndices;
// unsigned int rowIndices[Global::cloth_rows-1][Global::cloth_cols*2];
unsigned int horizontalStructuralSpringIndices[Global::cloth_rows][Global::cloth_cols];
unsigned int verticalStructuralSpringIndices[Global::cloth_cols][Global::cloth_rows];
unsigned int sheerSpringIndices[2][2*(Global::cloth_rows-1)*(Global::cloth_cols-1)];
};
#endif // !CLOTH_RENDERER_H