-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloth_handler.h
More file actions
36 lines (27 loc) · 1.31 KB
/
Copy pathcloth_handler.h
File metadata and controls
36 lines (27 loc) · 1.31 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
#ifndef CLOTH_HANDLER_H
#define CLOTH_HANDLER_H
#include <glad/glad.h>
#include <glm/detail/type_vec.hpp>
#include <glm/glm.hpp>
#include <iostream>
#include <cmath>
#include "cloth_vertex.h"
#include "spring.h"
#include "global.h"
class ClothHandler { // used to store and work with cloth vertices
public:
ClothVertex cloth_vertices[Global::cloth_rows][Global::cloth_cols];
Spring horizontal_structural_springs[Global::cloth_rows][Global::cloth_cols-1];
Spring vertical_structural_springs[Global::cloth_rows-1][Global::cloth_cols];
Spring falling_shear_springs[Global::cloth_rows-1][Global::cloth_cols-1];
Spring rising_shear_springs[Global::cloth_rows-1][Global::cloth_cols-1];
Spring horizontal_bend_springs[Global::cloth_rows][Global::cloth_cols-3];
Spring vertical_bend_springs[Global::cloth_rows-3][Global::cloth_cols];
glm::vec3 cloth_position = glm::vec3(0.0f, 0.0f, -2.0f);
ClothHandler(glm::vec3 positions[Global::cloth_rows][Global::cloth_cols], float masses[Global::cloth_rows][Global::cloth_cols], float spring_stiffness, float spring_rest_len, glm::vec3 pos);
void CalculateVertexNextPos(float delta_t);
void UpdateVertexPositions();
void UpdateVertexNormals();
void PinVertices(glm::vec2 v1, glm::vec2 v2);
};
#endif // !CLOTH_HANDLER_H