summaryrefslogtreecommitdiff
path: root/Source/modules/asura-box2d/Physics2D
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-16 08:54:08 +0800
committerchai <chaifix@163.com>2019-08-16 08:54:08 +0800
commita077eb38b01292611f4f6031b75e3e2c1c20f06e (patch)
tree8f760483d7b0290952bbdb5bcd8f3943102aeb3a /Source/modules/asura-box2d/Physics2D
parent6a065c913e9308cc72e1ad0723b6167048f439b6 (diff)
Diffstat (limited to 'Source/modules/asura-box2d/Physics2D')
-rw-r--r--Source/modules/asura-box2d/Physics2D/Body.h64
-rw-r--r--Source/modules/asura-box2d/Physics2D/ChainShape.h29
-rw-r--r--Source/modules/asura-box2d/Physics2D/CircleShape.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/Contact.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/DebugDraw.h9
-rw-r--r--Source/modules/asura-box2d/Physics2D/DistanceJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/EdgeShape.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/Fixture.h17
-rw-r--r--Source/modules/asura-box2d/Physics2D/FrictionJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/GearJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/Joint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/MotorJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/MouseJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/PolygonShape.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/PrismaticJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/PulleyJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/RevoluteJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/RopeJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/Shape.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/WeldJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/WheelJoint.h0
-rw-r--r--Source/modules/asura-box2d/Physics2D/World.h18
-rw-r--r--Source/modules/asura-box2d/Physics2D/binding/_body.cpp171
-rw-r--r--Source/modules/asura-box2d/Physics2D/binding/_world.cpp21
24 files changed, 329 insertions, 0 deletions
diff --git a/Source/modules/asura-box2d/Physics2D/Body.h b/Source/modules/asura-box2d/Physics2D/Body.h
new file mode 100644
index 0000000..d7e79d5
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/Body.h
@@ -0,0 +1,64 @@
+#ifndef __ASURA_BOX2D_BODY_H__
+#define __ASURA_BOX2D_BODY_H__
+
+#include <Box2D/Box2D.h>
+
+#include <asura-base/Classes.h>
+#include <asura-base/Scripting/Scripting.h>
+
+namespace_begin(AsuraEngine)
+namespace_begin(Physics)
+
+class World;
+class Joint;
+
+enum BodyType
+{
+ BODY_TYPE_INVALID,
+ BODY_TYPE_STATIC,
+ BODY_TYPE_DYNAMIC,
+ BODY_TYPE_KINEMATIC
+};
+
+class Body : public AEScripting::Portable<Body>
+{
+public:
+
+private:
+
+ friend class Joint;
+
+ //----------------------------------------------------------------------------//
+
+ LUAX_DECL_FACTORY(Body);
+
+ LUAX_DECL_ENUM(BodyType, 1);
+
+ LUAX_DECL_METHOD(_GetType);
+ LUAX_DECL_METHOD(_GetX);
+ LUAX_DECL_METHOD(_GetY);
+ LUAX_DECL_METHOD(_GetAngle);
+ LUAX_DECL_METHOD(_GetPosition);
+ LUAX_DECL_METHOD(_GetLinearVelocity);
+ LUAX_DECL_METHOD(_GetWorldCenter);
+ LUAX_DECL_METHOD(_GetLocalCenter);
+ LUAX_DECL_METHOD(_GetAngularVelocity);
+ LUAX_DECL_METHOD(_GetMass);
+ LUAX_DECL_METHOD(_GetInertia);
+ LUAX_DECL_METHOD(_GetMassData);
+ LUAX_DECL_METHOD(_GetAngularDamping);
+ LUAX_DECL_METHOD(_GetLinearDamping);
+ LUAX_DECL_METHOD(_GetGravityScale);
+ LUAX_DECL_METHOD(_GetGravityScale);
+
+ //----------------------------------------------------------------------------//
+
+ b2Body* m_Body;
+ World* m_World;
+
+};
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/Source/modules/asura-box2d/Physics2D/ChainShape.h b/Source/modules/asura-box2d/Physics2D/ChainShape.h
new file mode 100644
index 0000000..2403587
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/ChainShape.h
@@ -0,0 +1,29 @@
+#ifndef __ASURA_CHAIN_SHAPE_H__
+#define __ASURA_CHAIN_SHAPE_H__
+
+#include <Box2D/Collision/Shapes/b2ChainShape.h>
+
+#include <asura-base/Scripting/Scripting.h>
+#include <asura-base/Classes.h>
+
+namespace_begin(AsuraEngine)
+namespace_begin(Physics)
+
+class ChainShape
+ : AEScripting::Portable<ChainShape>
+{
+public:
+
+ ChainShape();
+ ~ChainShape();
+
+private:
+
+ b2ChainShape* m_Shape;
+
+};
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/Source/modules/asura-box2d/Physics2D/CircleShape.h b/Source/modules/asura-box2d/Physics2D/CircleShape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/CircleShape.h
diff --git a/Source/modules/asura-box2d/Physics2D/Contact.h b/Source/modules/asura-box2d/Physics2D/Contact.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/Contact.h
diff --git a/Source/modules/asura-box2d/Physics2D/DebugDraw.h b/Source/modules/asura-box2d/Physics2D/DebugDraw.h
new file mode 100644
index 0000000..a92be43
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/DebugDraw.h
@@ -0,0 +1,9 @@
+#ifndef _ASURA_BOX2D_DEBUG_DRAW_H_
+#define _ASURA_BOX2D_DEBUG_DRAW_H_
+
+namespace AsuraEngine
+{
+
+}
+
+#endif \ No newline at end of file
diff --git a/Source/modules/asura-box2d/Physics2D/DistanceJoint.h b/Source/modules/asura-box2d/Physics2D/DistanceJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/DistanceJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/EdgeShape.h b/Source/modules/asura-box2d/Physics2D/EdgeShape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/EdgeShape.h
diff --git a/Source/modules/asura-box2d/Physics2D/Fixture.h b/Source/modules/asura-box2d/Physics2D/Fixture.h
new file mode 100644
index 0000000..69f0153
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/Fixture.h
@@ -0,0 +1,17 @@
+#ifndef _ASRUA_ENGINE_FIXTURE_H_
+#define _ASRUA_ENGINE_FIXTURE_H_
+
+#include <asura-base/Classes.h>
+
+namespace_begin(AsuraEngine)
+namespace_begin(Physics)
+
+class Fixture
+{
+
+};
+
+namespace_end
+namespace_end
+
+#endif
diff --git a/Source/modules/asura-box2d/Physics2D/FrictionJoint.h b/Source/modules/asura-box2d/Physics2D/FrictionJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/FrictionJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/GearJoint.h b/Source/modules/asura-box2d/Physics2D/GearJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/GearJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/Joint.h b/Source/modules/asura-box2d/Physics2D/Joint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/Joint.h
diff --git a/Source/modules/asura-box2d/Physics2D/MotorJoint.h b/Source/modules/asura-box2d/Physics2D/MotorJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/MotorJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/MouseJoint.h b/Source/modules/asura-box2d/Physics2D/MouseJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/MouseJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/PolygonShape.h b/Source/modules/asura-box2d/Physics2D/PolygonShape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/PolygonShape.h
diff --git a/Source/modules/asura-box2d/Physics2D/PrismaticJoint.h b/Source/modules/asura-box2d/Physics2D/PrismaticJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/PrismaticJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/PulleyJoint.h b/Source/modules/asura-box2d/Physics2D/PulleyJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/PulleyJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/RevoluteJoint.h b/Source/modules/asura-box2d/Physics2D/RevoluteJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/RevoluteJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/RopeJoint.h b/Source/modules/asura-box2d/Physics2D/RopeJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/RopeJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/Shape.h b/Source/modules/asura-box2d/Physics2D/Shape.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/Shape.h
diff --git a/Source/modules/asura-box2d/Physics2D/WeldJoint.h b/Source/modules/asura-box2d/Physics2D/WeldJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/WeldJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/WheelJoint.h b/Source/modules/asura-box2d/Physics2D/WheelJoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/WheelJoint.h
diff --git a/Source/modules/asura-box2d/Physics2D/World.h b/Source/modules/asura-box2d/Physics2D/World.h
new file mode 100644
index 0000000..a156c79
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/World.h
@@ -0,0 +1,18 @@
+#ifndef __ASURA_BOX2D_WORLD_H__
+#define __ASURA_BOX2D_WORLD_H__
+
+#include <asura-base/Classes.h>
+#include <asura-base/Scripting/Scripting.h>
+
+namespace_begin(AsuraEngine)
+namespace_begin(Physics)
+
+class World : public AEScripting::Portable<World>
+{
+
+};
+
+namespace_end
+namespace_end
+
+#endif \ No newline at end of file
diff --git a/Source/modules/asura-box2d/Physics2D/binding/_body.cpp b/Source/modules/asura-box2d/Physics2D/binding/_body.cpp
new file mode 100644
index 0000000..0c9e3e8
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/binding/_body.cpp
@@ -0,0 +1,171 @@
+#include "../Body.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Physics
+ {
+
+ LUAX_REGISTRY(Body)
+ {
+ LUAX_REGISTER_METHODS(state,
+ { "GetType", _GetType },
+ { "GetX", _GetX },
+ { "GetY", _GetY },
+ { "GetAngle", _GetAngle },
+ { "GetPosition", _GetPosition },
+ { "GetLinearVelocity", _GetLinearVelocity },
+ { "GetWorldCenter", _GetWorldCenter },
+ { "GetLocalCenter", _GetLocalCenter },
+ { "GetAngularVelocity", _GetAngularVelocity },
+ { "GetMass", _GetMass },
+ { "GetInertia", _GetInertia },
+ { "GetMassData", _GetMassData },
+ { "GetAngularDamping", _GetAngularDamping },
+ { "GetLinearDamping", _GetLinearDamping },
+ { "GetGravityScale", _GetGravityScale },
+ { "GetGravityScale", _GetGravityScale }
+ );
+ }
+
+ LUAX_POSTPROCESS(Body)
+ {
+ LUAX_REGISTER_ENUM(state, "EBodyType",
+ { "INVALID", BODY_TYPE_INVALID },
+ { "STATIC", BODY_TYPE_STATIC },
+ { "DYNAMIC", BODY_TYPE_DYNAMIC },
+ { "KINEMATIC", BODY_TYPE_KINEMATIC }
+ );
+
+ }
+
+ // body:GetType()
+ LUAX_IMPL_METHOD(Body, _GetType)
+ {
+ LUAX_PREPARE(L, Body);
+ return 0;
+ }
+
+ // body:GetX()
+ LUAX_IMPL_METHOD(Body, _GetX)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetY()
+ LUAX_IMPL_METHOD(Body, _GetY)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetAngle()
+ LUAX_IMPL_METHOD(Body, _GetAngle)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetPosition()
+ LUAX_IMPL_METHOD(Body, _GetPosition)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetLinearVelocity()
+ LUAX_IMPL_METHOD(Body, _GetLinearVelocity)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetWorldCenter()
+ LUAX_IMPL_METHOD(Body, _GetWorldCenter)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetLocalCenter()
+ LUAX_IMPL_METHOD(Body, _GetLocalCenter)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetAngularVelocity()
+ LUAX_IMPL_METHOD(Body, _GetAngularVelocity)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetMass()
+ LUAX_IMPL_METHOD(Body, _GetMass)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetInertia()
+ LUAX_IMPL_METHOD(Body, _GetInertia)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetMassData()
+ LUAX_IMPL_METHOD(Body, _GetMassData)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetAngularDamping()
+ LUAX_IMPL_METHOD(Body, _GetAngularDamping)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetLinearDamping()
+ LUAX_IMPL_METHOD(Body, _GetLinearDamping)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetGravityScale()
+ LUAX_IMPL_METHOD(Body, _GetGravityScale)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ // body:GetGravityScale()
+ LUAX_IMPL_METHOD(Body, _GetGravityScale)
+ {
+ LUAX_PREPARE(L, Body);
+
+ return 0;
+ }
+
+ }
+}
diff --git a/Source/modules/asura-box2d/Physics2D/binding/_world.cpp b/Source/modules/asura-box2d/Physics2D/binding/_world.cpp
new file mode 100644
index 0000000..0940959
--- /dev/null
+++ b/Source/modules/asura-box2d/Physics2D/binding/_world.cpp
@@ -0,0 +1,21 @@
+#include "../World.h"
+
+using namespace std;
+
+namespace AsuraEngine
+{
+ namespace Physics
+ {
+ /*
+ LUAX_REGISTRY(World)
+ {
+
+ }
+
+ LUAX_POSTPROCESS(World)
+ {
+
+ }
+*/
+ }
+}