MCPcopy Create free account
hub / github.com/axmolengine/axmol / DebugDraw

Method DebugDraw

3rdparty/box2d/src/dynamics/b2_world.cpp:1107–1215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1105}
1106
1107void b2World::DebugDraw()
1108{
1109 if (m_debugDraw == nullptr)
1110 {
1111 return;
1112 }
1113
1114 uint32 flags = m_debugDraw->GetFlags();
1115
1116 if (flags & b2Draw::e_shapeBit)
1117 {
1118 for (b2Body* b = m_bodyList; b; b = b->GetNext())
1119 {
1120 const b2Transform& xf = b->GetTransform();
1121 for (b2Fixture* f = b->GetFixtureList(); f; f = f->GetNext())
1122 {
1123 if (b->GetType() == b2_dynamicBody && b->m_mass == 0.0f)
1124 {
1125 // Bad body
1126 DrawShape(f, xf, b2Color(1.0f, 0.0f, 0.0f));
1127 }
1128 else if (b->IsEnabled() == false)
1129 {
1130 DrawShape(f, xf, b2Color(0.5f, 0.5f, 0.3f));
1131 }
1132 else if (b->GetType() == b2_staticBody)
1133 {
1134 DrawShape(f, xf, b2Color(0.5f, 0.9f, 0.5f));
1135 }
1136 else if (b->GetType() == b2_kinematicBody)
1137 {
1138 DrawShape(f, xf, b2Color(0.5f, 0.5f, 0.9f));
1139 }
1140 else if (b->IsAwake() == false)
1141 {
1142 DrawShape(f, xf, b2Color(0.6f, 0.6f, 0.6f));
1143 }
1144 else
1145 {
1146 DrawShape(f, xf, b2Color(0.9f, 0.7f, 0.7f));
1147 }
1148 }
1149 }
1150 }
1151
1152 if (flags & b2Draw::e_jointBit)
1153 {
1154 for (b2Joint* j = m_jointList; j; j = j->GetNext())
1155 {
1156 j->Draw(m_debugDraw);
1157 }
1158 }
1159
1160 if (flags & b2Draw::e_pairBit)
1161 {
1162 b2Color color(0.3f, 0.9f, 0.9f);
1163 for (b2Contact* c = m_contactManager.m_contactList; c; c = c->GetNext())
1164 {

Callers 3

updateMethod · 0.45
StepMethod · 0.45
updateMethod · 0.45

Calls 15

GetFlagsMethod · 0.80
GetTransformMethod · 0.80
GetFixtureListMethod · 0.80
IsAwakeMethod · 0.80
GetFixtureAMethod · 0.80
GetFixtureBMethod · 0.80
GetChildIndexAMethod · 0.80
GetChildIndexBMethod · 0.80
GetCenterMethod · 0.80
DrawSegmentMethod · 0.80
DrawTransformMethod · 0.80
DrawShapeFunction · 0.50

Tested by 3

updateMethod · 0.36
StepMethod · 0.36
updateMethod · 0.36