delay computation and declare const
This commit is contained in:
		| @@ -249,11 +249,6 @@ void b3Simplex::Solve3(const b3Vec3& Q) | |||||||
| 	b3Barycentric(wBC, B.point, C.point, Q); | 	b3Barycentric(wBC, B.point, C.point, Q); | ||||||
| 	b3Barycentric(wCA, C.point, A.point, Q); | 	b3Barycentric(wCA, C.point, A.point, Q); | ||||||
| 	 | 	 | ||||||
| 	// Test edge regions		 |  | ||||||
| 	float32 wABC[4]; |  | ||||||
| 	b3Barycentric(wABC, A.point, B.point, C.point, Q); |  | ||||||
|  |  | ||||||
| 	// Test vertex regions |  | ||||||
| 	// R A | 	// R A | ||||||
| 	if (wAB[1] <= 0.0f && wCA[0] <= 0.0f) | 	if (wAB[1] <= 0.0f && wCA[0] <= 0.0f) | ||||||
| 	{ | 	{ | ||||||
| @@ -282,6 +277,9 @@ void b3Simplex::Solve3(const b3Vec3& Q) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Test edge regions		 | 	// Test edge regions		 | ||||||
|  | 	float32 wABC[4]; | ||||||
|  | 	b3Barycentric(wABC, A.point, B.point, C.point, Q); | ||||||
|  | 	 | ||||||
| 	// This is used to help testing if the face degenerates  | 	// This is used to help testing if the face degenerates  | ||||||
| 	// into an edge. | 	// into an edge. | ||||||
| 	float32 area = wABC[3]; | 	float32 area = wABC[3]; | ||||||
| @@ -364,19 +362,6 @@ void b3Simplex::Solve4(const b3Vec3& Q) | |||||||
| 	b3Barycentric(wCD, C.point, D.point, Q); | 	b3Barycentric(wCD, C.point, D.point, Q); | ||||||
| 	b3Barycentric(wDB, D.point, B.point, Q); | 	b3Barycentric(wDB, D.point, B.point, Q); | ||||||
| 	 | 	 | ||||||
| 	// Test edge regions |  | ||||||
| 	float32 wACB[4], wABD[4], wADC[4], wBCD[4]; |  | ||||||
| 	b3Barycentric(wACB, A.point, C.point, B.point, Q); |  | ||||||
| 	b3Barycentric(wABD, A.point, B.point, D.point, Q); |  | ||||||
| 	b3Barycentric(wADC, A.point, D.point, C.point, Q); |  | ||||||
| 	b3Barycentric(wBCD, B.point, C.point, D.point, Q); |  | ||||||
| 	 |  | ||||||
| 	// Test face regions |  | ||||||
| 	float32 wABCD[5]; |  | ||||||
| 	b3Barycentric(wABCD, A.point, B.point, C.point, D.point, Q); |  | ||||||
|  |  | ||||||
| 	// Test vertex regions |  | ||||||
| 	 |  | ||||||
| 	// R A | 	// R A | ||||||
| 	if (wAB[1] <= 0.0f && wAC[1] <= 0.0f && wAD[1] <= 0.0f) | 	if (wAB[1] <= 0.0f && wAC[1] <= 0.0f && wAD[1] <= 0.0f) | ||||||
| 	{ | 	{ | ||||||
| @@ -414,6 +399,11 @@ void b3Simplex::Solve4(const b3Vec3& Q) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Test edge regions | 	// Test edge regions | ||||||
|  | 	float32 wACB[4], wABD[4], wADC[4], wBCD[4]; | ||||||
|  | 	b3Barycentric(wACB, A.point, C.point, B.point, Q); | ||||||
|  | 	b3Barycentric(wABD, A.point, B.point, D.point, Q); | ||||||
|  | 	b3Barycentric(wADC, A.point, D.point, C.point, Q); | ||||||
|  | 	b3Barycentric(wBCD, B.point, C.point, D.point, Q); | ||||||
|  |  | ||||||
| 	// R AB | 	// R AB | ||||||
| 	if (wABD[2] <= 0.0f && wACB[1] <= 0.0f && wAB[0] > 0.0f && wAB[1] > 0.0f) | 	if (wABD[2] <= 0.0f && wACB[1] <= 0.0f && wAB[0] > 0.0f && wAB[1] > 0.0f) | ||||||
| @@ -500,6 +490,8 @@ void b3Simplex::Solve4(const b3Vec3& Q) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Test face regions | 	// Test face regions | ||||||
|  | 	float32 wABCD[5]; | ||||||
|  | 	b3Barycentric(wABCD, A.point, B.point, C.point, D.point, Q); | ||||||
|  |  | ||||||
| 	// R ACB  | 	// R ACB  | ||||||
| 	if (wABCD[3] <= 0.0f && wACB[0] > 0.0f && wACB[1] > 0.0f && wACB[2] > 0.0f) | 	if (wABCD[3] <= 0.0f && wACB[0] > 0.0f && wACB[1] > 0.0f && wACB[2] > 0.0f) | ||||||
|   | |||||||
| @@ -164,9 +164,9 @@ static B3_FORCE_INLINE b3Vec4 q_to_v(const b3Quat& q) | |||||||
| 	return b3Vec4(q.w, q.x, q.y, q.z); | 	return b3Vec4(q.w, q.x, q.y, q.z); | ||||||
| } | } | ||||||
|  |  | ||||||
| static b3Mat34 P = P_mat(); | static const b3Mat34 P = P_mat(); | ||||||
| static b3Mat43 PT = b3Transpose(P); | static const b3Mat43 PT = b3Transpose(P); | ||||||
| static b3Mat24 P_hinge = P_hinge_mat(); | static const b3Mat24 P_hinge = P_hinge_mat(); | ||||||
|  |  | ||||||
| void b3RevoluteJointDef::Initialize(b3Body* bA, b3Body* bB, | void b3RevoluteJointDef::Initialize(b3Body* bA, b3Body* bB, | ||||||
| 	const b3Vec3& axis, const b3Vec3& anchor, | 	const b3Vec3& axis, const b3Vec3& anchor, | ||||||
|   | |||||||
| @@ -86,9 +86,9 @@ static b3Vec4 q_to_v(const b3Quat& q) | |||||||
| 	return b3Vec4(q.w, q.x, q.y, q.z); | 	return b3Vec4(q.w, q.x, q.y, q.z); | ||||||
| } | } | ||||||
|  |  | ||||||
| static b3Mat34 P = P_mat(); | static const b3Mat34 P = P_mat(); | ||||||
| static b3Mat43 PT = b3Transpose(P); | static const b3Mat43 PT = b3Transpose(P); | ||||||
| static b3Mat34 P_lock = P_lock_mat(); | static const b3Mat34 P_lock = P_lock_mat(); | ||||||
|  |  | ||||||
| void b3WeldJointDef::Initialize(b3Body* bA, b3Body* bB, const b3Vec3& anchor) | void b3WeldJointDef::Initialize(b3Body* bA, b3Body* bB, const b3Vec3& anchor) | ||||||
| { | { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user