| 1092 | } |
| 1093 | |
| 1094 | void b2World::DrawJoint(b2Joint* joint) |
| 1095 | { |
| 1096 | b2Body* bodyA = joint->GetBodyA(); |
| 1097 | b2Body* bodyB = joint->GetBodyB(); |
| 1098 | const b2Transform& xf1 = bodyA->GetTransform(); |
| 1099 | const b2Transform& xf2 = bodyB->GetTransform(); |
| 1100 | b2Vec2 x1 = xf1.p; |
| 1101 | b2Vec2 x2 = xf2.p; |
| 1102 | b2Vec2 p1 = joint->GetAnchorA(); |
| 1103 | b2Vec2 p2 = joint->GetAnchorB(); |
| 1104 | |
| 1105 | b2Color color(0.5f, 0.8f, 0.8f); |
| 1106 | |
| 1107 | switch (joint->GetType()) |
| 1108 | { |
| 1109 | case e_distanceJoint: |
| 1110 | m_debugDraw->DrawSegment(p1, p2, color); |
| 1111 | break; |
| 1112 | |
| 1113 | case e_pulleyJoint: |
| 1114 | { |
| 1115 | b2PulleyJoint* pulley = (b2PulleyJoint*)joint; |
| 1116 | b2Vec2 s1 = pulley->GetGroundAnchorA(); |
| 1117 | b2Vec2 s2 = pulley->GetGroundAnchorB(); |
| 1118 | m_debugDraw->DrawSegment(s1, p1, color); |
| 1119 | m_debugDraw->DrawSegment(s2, p2, color); |
| 1120 | m_debugDraw->DrawSegment(s1, s2, color); |
| 1121 | } |
| 1122 | break; |
| 1123 | |
| 1124 | case e_mouseJoint: |
| 1125 | // don't draw this |
| 1126 | break; |
| 1127 | |
| 1128 | default: |
| 1129 | m_debugDraw->DrawSegment(x1, p1, color); |
| 1130 | m_debugDraw->DrawSegment(p1, p2, color); |
| 1131 | m_debugDraw->DrawSegment(x2, p2, color); |
| 1132 | } |
| 1133 | } |
| 1134 | |
| 1135 | void b2World::DrawDebugData() |
| 1136 | { |
nothing calls this directly
no test coverage detected