MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / drawOpenGL

Method drawOpenGL

examples/ExampleBrowser/GL_ShapeDrawer.cpp:233–649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231inline void glDrawVector(const btVector3& v) { glVertex3d(v[0], v[1], v[2]); }
232
233void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, const btVector3& color, int debugMode, const btVector3& worldBoundsMin, const btVector3& worldBoundsMax)
234{
235 if (shape->getShapeType() == CUSTOM_CONVEX_SHAPE_TYPE)
236 {
237 btVector3 org(m[12], m[13], m[14]);
238 btVector3 dx(m[0], m[1], m[2]);
239 btVector3 dy(m[4], m[5], m[6]);
240 // btVector3 dz(m[8], m[9], m[10]);
241 const btBoxShape* boxShape = static_cast<const btBoxShape*>(shape);
242 btVector3 halfExtent = boxShape->getHalfExtentsWithMargin();
243 dx *= halfExtent[0];
244 dy *= halfExtent[1];
245 // dz *= halfExtent[2];
246 glColor3f(1, 1, 1);
247 glDisable(GL_LIGHTING);
248 glLineWidth(2);
249
250 glBegin(GL_LINE_LOOP);
251 glDrawVector(org - dx - dy);
252 glDrawVector(org - dx + dy);
253 glDrawVector(org + dx + dy);
254 glDrawVector(org + dx - dy);
255 glEnd();
256 return;
257 }
258 else if ((shape->getShapeType() == BOX_SHAPE_PROXYTYPE) && (debugMode & btIDebugDraw::DBG_FastWireframe))
259 {
260 btVector3 org(m[12], m[13], m[14]);
261 btVector3 dx(m[0], m[1], m[2]);
262 btVector3 dy(m[4], m[5], m[6]);
263 btVector3 dz(m[8], m[9], m[10]);
264 const btBoxShape* boxShape = static_cast<const btBoxShape*>(shape);
265 btVector3 halfExtent = boxShape->getHalfExtentsWithMargin();
266 dx *= halfExtent[0];
267 dy *= halfExtent[1];
268 dz *= halfExtent[2];
269 glBegin(GL_LINE_LOOP);
270 glDrawVector(org - dx - dy - dz);
271 glDrawVector(org + dx - dy - dz);
272 glDrawVector(org + dx + dy - dz);
273 glDrawVector(org - dx + dy - dz);
274 glDrawVector(org - dx + dy + dz);
275 glDrawVector(org + dx + dy + dz);
276 glDrawVector(org + dx - dy + dz);
277 glDrawVector(org - dx - dy + dz);
278 glEnd();
279 glBegin(GL_LINES);
280 glDrawVector(org + dx - dy - dz);
281 glDrawVector(org + dx - dy + dz);
282 glDrawVector(org + dx + dy - dz);
283 glDrawVector(org + dx + dy + dz);
284 glDrawVector(org - dx - dy - dz);
285 glDrawVector(org - dx + dy - dz);
286 glDrawVector(org - dx - dy + dz);
287 glDrawVector(org - dx + dy + dz);
288 glEnd();
289 return;
290 }

Callers

nothing calls this directly

Calls 15

glDrawVectorFunction · 0.85
btPlaneSpace1Function · 0.85
numTrianglesMethod · 0.80
numIndicesMethod · 0.80
numVerticesMethod · 0.80
btVector3Class · 0.50
getShapeTypeMethod · 0.45
getChildShapeMethod · 0.45
getNumChildShapesMethod · 0.45
getChildTransformMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected