Browse Source

Merged in aidalgol/love-scaling (pull request #6)

Bart van Strien 13 years ago
parent
commit
4a04c48891

+ 2 - 2
src/modules/physics/box2d/Contact.cpp

@@ -61,8 +61,8 @@ namespace box2d
 		love::luax_assert_argc(L, 1, 1);
 		love::luax_assert_argc(L, 1, 1);
 		b2WorldManifold manifold;
 		b2WorldManifold manifold;
 		contact->GetWorldManifold(&manifold);
 		contact->GetWorldManifold(&manifold);
-		lua_pushnumber(L, Physics::scaleUp(manifold.normal.x));
-		lua_pushnumber(L, Physics::scaleUp(manifold.normal.y));
+		lua_pushnumber(L, manifold.normal.x);
+		lua_pushnumber(L, manifold.normal.y);
 		return 2;
 		return 2;
 	}
 	}
 
 

+ 2 - 2
src/modules/physics/box2d/Fixture.cpp

@@ -269,8 +269,8 @@ namespace box2d
 		b2RayCastOutput output;
 		b2RayCastOutput output;
 		if (!fixture->RayCast(&output, input, childIndex))
 		if (!fixture->RayCast(&output, input, childIndex))
 			return 0; // Nothing hit.
 			return 0; // Nothing hit.
-		lua_pushnumber(L, Physics::scaleUp(output.normal.x));
-		lua_pushnumber(L, Physics::scaleUp(output.normal.y));
+		lua_pushnumber(L, output.normal.x);
+		lua_pushnumber(L, output.normal.y);
 		lua_pushnumber(L, output.fraction);
 		lua_pushnumber(L, output.fraction);
 		return 3;
 		return 3;
 	}
 	}

+ 6 - 2
src/modules/physics/box2d/RopeJoint.cpp

@@ -37,8 +37,12 @@ namespace box2d
 		b2RopeJointDef def;
 		b2RopeJointDef def;
 		def.bodyA = body1->body;
 		def.bodyA = body1->body;
 		def.bodyB = body2->body;
 		def.bodyB = body2->body;
-		body1->getLocalPoint(Physics::scaleDown(x1), Physics::scaleDown(y1), def.localAnchorA.x, def.localAnchorA.y);
-		body2->getLocalPoint(Physics::scaleDown(x2), Physics::scaleDown(y2), def.localAnchorB.x, def.localAnchorB.y);
+		body1->getLocalPoint(x1, y1, x1, y1);
+		body2->getLocalPoint(x2, y2, x2, y2);
+		def.localAnchorA.x = Physics::scaleDown(x1);
+		def.localAnchorA.y = Physics::scaleDown(y1);
+		def.localAnchorB.x = Physics::scaleDown(x2);
+		def.localAnchorB.y = Physics::scaleDown(y2);
 		def.maxLength = Physics::scaleDown(maxLength);
 		def.maxLength = Physics::scaleDown(maxLength);
 		def.collideConnected = collideConnected;
 		def.collideConnected = collideConnected;
 		joint = (b2RopeJoint*)createJoint(&def);
 		joint = (b2RopeJoint*)createJoint(&def);

+ 2 - 2
src/modules/physics/box2d/Shape.cpp

@@ -111,8 +111,8 @@ namespace box2d
 		b2RayCastOutput output;
 		b2RayCastOutput output;
 		if (!shape->RayCast(&output, input, transform, childIndex))
 		if (!shape->RayCast(&output, input, transform, childIndex))
 			return 0; // No hit.
 			return 0; // No hit.
-		lua_pushnumber(L, Physics::scaleUp(output.normal.x));
-		lua_pushnumber(L, Physics::scaleUp(output.normal.y));
+		lua_pushnumber(L, output.normal.x);
+		lua_pushnumber(L, output.normal.y);
 		lua_pushnumber(L, output.fraction);
 		lua_pushnumber(L, output.fraction);
 		return 3;
 		return 3;
 	}
 	}

+ 2 - 3
src/modules/physics/box2d/World.cpp

@@ -190,9 +190,8 @@ namespace box2d
 			b2Vec2 scaledPoint = Physics::scaleUp(point);
 			b2Vec2 scaledPoint = Physics::scaleUp(point);
 			lua_pushnumber(L, scaledPoint.x);
 			lua_pushnumber(L, scaledPoint.x);
 			lua_pushnumber(L, scaledPoint.y);
 			lua_pushnumber(L, scaledPoint.y);
-			b2Vec2 scaledNormal = Physics::scaleUp(normal);
-			lua_pushnumber(L, scaledNormal.x);
-			lua_pushnumber(L, scaledNormal.y);
+			lua_pushnumber(L, normal.x);
+			lua_pushnumber(L, normal.y);
 			lua_pushnumber(L, fraction);
 			lua_pushnumber(L, fraction);
 			lua_call(L, 6, 1);
 			lua_call(L, 6, 1);
 			if (!lua_isnumber(L, -1))
 			if (!lua_isnumber(L, -1))