You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

39 lines
814 B

#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <glm/vec3.hpp>
#include <unordered_map>
#include <unordered_set>
#include "constraints.hpp"
using std::unordered_map;
using std::unordered_set;
using std::vector;
struct Vertex;
typedef unordered_map<const Constraint*, vector<const Constraint *>> Graph;
class Mesh;
class SoftBody {
public:
explicit SoftBody(Mesh* mesh, float compliance);
uint32_t firstIndex = 0;
int32_t vertexOffset = 0;
float compliance;
vector<Vertex> vertices;
vector<Face> faces;
ConstraintData constraintData;
void applyVertexOffset(const glm::vec3& offset);
SoftBody& operator =(const SoftBody& other) = delete;
private:
void splitConstraints();
void reorderConstraintIndices(const vector<unordered_set<const Constraint *>> &partitions);
};