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.

37 lines
862 B

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