aboutsummaryrefslogtreecommitdiff
path: root/Client/Source/Phy2D/Dynamic/World.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-11-30 22:25:37 +0800
committerchai <chaifix@163.com>2021-11-30 22:25:37 +0800
commit9e0e01b7f4375063f06e494113187d48614628e0 (patch)
tree21a4901612ad92c121f4c887a33b1bbbe87c6b00 /Client/Source/Phy2D/Dynamic/World.h
+init
Diffstat (limited to 'Client/Source/Phy2D/Dynamic/World.h')
-rw-r--r--Client/Source/Phy2D/Dynamic/World.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/Client/Source/Phy2D/Dynamic/World.h b/Client/Source/Phy2D/Dynamic/World.h
new file mode 100644
index 0000000..d5c652c
--- /dev/null
+++ b/Client/Source/Phy2D/Dynamic/World.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include <vector>
+#include <map>
+#include "../Common/Math.h"
+#include "Arbiter.h"
+
+namespace Phy2D
+{
+
+ struct Body;
+ struct Joint;
+
+ struct World
+ {
+ World(Vec2 gravity, int iterations) : gravity(gravity), iterations(iterations) {}
+
+ void Add(Body* body);
+ void Add(Joint* joint);
+ void Clear();
+
+ void Step(number dt);
+
+ void BroadPhase();
+
+ std::vector<Body*> bodies;
+ std::vector<Joint*> joints;
+ std::map<ArbiterKey, Arbiter> arbiters;
+ Vec2 gravity;
+ int iterations;
+ static bool accumulateImpulses;
+ static bool warmStarting;
+ static bool positionCorrection;
+ };
+
+}