forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vdrift-20120722-bullet.patch
100 lines (93 loc) · 3.33 KB
/
vdrift-20120722-bullet.patch
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
--- src/cardynamics.cpp Mon Jan 19 23:26:36 1970
+++ src/cardynamics.cpp Mon Jan 19 23:26:36 1970
@@ -1791,23 +1791,29 @@
bool CARDYNAMICS::WheelContactCallback(
btManifoldPoint& cp,
- const btCollisionObject* colObj0,
- int partId0,
+ const btCollisionObjectWrapper* col0,
+ int part0,
int index0,
- const btCollisionObject* colObj1,
- int partId1,
+ const btCollisionObjectWrapper* col1,
+ int part1,
int index1)
{
- // cars are fracture bodies, wheel is a cylinder shape
- const btCollisionShape* shape = colObj0->getCollisionShape();
- if ((colObj0->getInternalType() & CO_FRACTURE_TYPE) &&
+#if (BT_BULLET_VERSION < 281)
+ const btCollisionObject* obj = col0;
+ const btCollisionShape* shape = obj->getCollisionShape();
+ const btCollisionShape* rootshape = obj->getRootCollisionShape();
+#else
+ const btCollisionObject* obj = col0->getCollisionObject();
+ const btCollisionShape* shape = col0->getCollisionShape();
+ const btCollisionShape* rootshape = obj->getCollisionShape();
+#endif
+ if ((obj->getInternalType() & CO_FRACTURE_TYPE) &&
(shape->getShapeType() == CYLINDER_SHAPE_PROXYTYPE))
{
- // is contact within contact patch?
- const btCompoundShape* car = static_cast<const btCompoundShape*>(colObj0->getRootCollisionShape());
- const btCylinderShapeX* wheel = static_cast<const btCylinderShapeX*>(shape);
- btVector3 contactPoint = cp.m_localPointA - car->getChildTransform(cp.m_index0).getOrigin();
- if (-direction::up.dot(contactPoint) > 0.5 * wheel->getRadius())
+ const btCompoundShape* carshape = static_cast<const btCompoundShape*>(rootshape);
+ const btCylinderShapeX* wheelshape = static_cast<const btCylinderShapeX*>(shape);
+ btVector3 contactPoint = cp.m_localPointA - carshape->getChildTransform(cp.m_index0).getOrigin();
+ if (-direction::up.dot(contactPoint) > 0.5 * wheelshape->getRadius())
{
// break contact (hack)
cp.m_normalWorldOnB = btVector3(0, 0, 0);
--- src/cardynamics.h Mon Jan 19 23:26:36 1970
+++ src/cardynamics.h Mon Jan 19 23:26:36 1970
@@ -25,6 +25,12 @@
class FractureBody;
class PTree;
+#if (BT_BULLET_VERSION < 281)
+#define btCollisionObjectWrapper btCollisionObject
+#else
+struct btCollisionObjectWrapper;
+#endif
+
class CARDYNAMICS : public btActionInterface
{
friend class PERFORMANCE_TESTING;
@@ -151,11 +157,11 @@
static bool WheelContactCallback(
btManifoldPoint& cp,
- const btCollisionObject* colObj0,
- int partId0,
+ const btCollisionObjectWrapper* col0,
+ int part0,
int index0,
- const btCollisionObject* colObj1,
- int partId1,
+ const btCollisionObjectWrapper* col1,
+ int part1,
int index1);
protected:
--- src/dynamicsworld.cpp Mon Jan 19 23:26:36 1970
+++ src/dynamicsworld.cpp Mon Jan 19 23:26:36 1970
@@ -105,7 +105,7 @@
int patch_id = -1;
const BEZIER * b = 0;
const TRACKSURFACE * s = TRACKSURFACE::None();
- btCollisionObject * c = 0;
+ const btCollisionObject * c = 0;
MyRayResultCallback ray(origin, p, caster);
rayTest(origin, p, ray);
@@ -221,6 +221,7 @@
void DynamicsWorld::fractureCallback()
{
+#if (BT_BULLET_VERSION < 281)
m_activeConnections.resize(0);
int numManifolds = getDispatcher()->getNumManifolds();
@@ -268,4 +269,5 @@
btRigidBody* child = body->updateConnection(con_id);
if (child) addRigidBody(child);
}
+#endif
}