-
Notifications
You must be signed in to change notification settings - Fork 1
/
ConstraintSolver.h
55 lines (41 loc) · 992 Bytes
/
ConstraintSolver.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _CONSTRAINT_SOLVER_H_
#define _CONSTRAINT_SOLVER_H_
#include <vector>
#include <cstdint>
#include "Constraints.h"
enum class PBD_MODE
{
PBD,
XPBD
};
class ConstraintSolver
{
public:
ConstraintSolver() = delete;
ConstraintSolver(PBD_MODE mode);
~ConstraintSolver();
bool SolveConstraints(
const float &dt,
std::vector<Constraint*>& static_constraints,
std::vector<Constraint*>& collision_constraints
);
// setter
void setSolverIteration(uint32_t iteration_num);
void setPBDMode(PBD_MODE mode);
//getter
uint32_t getSolverIteration() { return m_solver_iteration; }
PBD_MODE getPBDMode() { return m_mode; }
private:
bool SolvePBDConstraints(
std::vector<Constraint*>& static_constraints,
std::vector<Constraint*>& collision_constraints
);
bool SolveXPBDConstraints(
const float &dt,
std::vector<Constraint*>& static_constraints,
std::vector<Constraint*>& collision_constraints
);
uint32_t m_solver_iteration;
PBD_MODE m_mode;
};
#endif