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
857 B
37 lines
857 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 edgeCompliance, float triangleCompliance=0, float tetrahedronCompliance=0);
|
|
uint32_t firstIndex = 0;
|
|
int32_t vertexOffset = 0;
|
|
|
|
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);
|
|
}; |