| 1029 | } |
| 1030 | |
| 1031 | void b2World::DrawShape(b2Fixture* fixture, const b2Transform& xf, const b2Color& color) |
| 1032 | { |
| 1033 | switch (fixture->GetType()) |
| 1034 | { |
| 1035 | case b2Shape::e_circle: |
| 1036 | { |
| 1037 | b2CircleShape* circle = (b2CircleShape*)fixture->GetShape(); |
| 1038 | |
| 1039 | b2Vec2 center = b2Mul(xf, circle->m_p); |
| 1040 | float32 radius = circle->m_radius; |
| 1041 | b2Vec2 axis = b2Mul(xf.q, b2Vec2(1.0f, 0.0f)); |
| 1042 | |
| 1043 | m_debugDraw->DrawSolidCircle(center, radius, axis, color); |
| 1044 | } |
| 1045 | break; |
| 1046 | |
| 1047 | case b2Shape::e_edge: |
| 1048 | { |
| 1049 | b2EdgeShape* edge = (b2EdgeShape*)fixture->GetShape(); |
| 1050 | b2Vec2 v1 = b2Mul(xf, edge->m_vertex1); |
| 1051 | b2Vec2 v2 = b2Mul(xf, edge->m_vertex2); |
| 1052 | m_debugDraw->DrawSegment(v1, v2, color); |
| 1053 | } |
| 1054 | break; |
| 1055 | |
| 1056 | case b2Shape::e_chain: |
| 1057 | { |
| 1058 | b2ChainShape* chain = (b2ChainShape*)fixture->GetShape(); |
| 1059 | int32 count = chain->m_count; |
| 1060 | const b2Vec2* vertices = chain->m_vertices; |
| 1061 | |
| 1062 | b2Vec2 v1 = b2Mul(xf, vertices[0]); |
| 1063 | for (int32 i = 1; i < count; ++i) |
| 1064 | { |
| 1065 | b2Vec2 v2 = b2Mul(xf, vertices[i]); |
| 1066 | m_debugDraw->DrawSegment(v1, v2, color); |
| 1067 | m_debugDraw->DrawCircle(v1, 0.05f, color); |
| 1068 | v1 = v2; |
| 1069 | } |
| 1070 | } |
| 1071 | break; |
| 1072 | |
| 1073 | case b2Shape::e_polygon: |
| 1074 | { |
| 1075 | b2PolygonShape* poly = (b2PolygonShape*)fixture->GetShape(); |
| 1076 | int32 vertexCount = poly->m_vertexCount; |
| 1077 | b2Assert(vertexCount <= b2_maxPolygonVertices); |
| 1078 | b2Vec2 vertices[b2_maxPolygonVertices]; |
| 1079 | |
| 1080 | for (int32 i = 0; i < vertexCount; ++i) |
| 1081 | { |
| 1082 | vertices[i] = b2Mul(xf, poly->m_vertices[i]); |
| 1083 | } |
| 1084 | |
| 1085 | m_debugDraw->DrawSolidPolygon(vertices, vertexCount, color); |
| 1086 | } |
| 1087 | break; |
| 1088 |
nothing calls this directly
no test coverage detected