MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / drawConcaveMeshShape

Method drawConcaveMeshShape

src/utils/DebugRenderer.cpp:350–382  ·  view source on GitHub ↗

Draw a concave mesh shape

Source from the content-addressed store, hash-verified

348
349// Draw a concave mesh shape
350void DebugRenderer::drawConcaveMeshShape(const Transform& transform, const ConcaveMeshShape* concaveMeshShape,
351 uint32 colorShape, uint32 colorShapeNormals) {
352
353 const bool drawShape = getIsDebugItemDisplayed(DebugItem::COLLISION_SHAPE);
354 const bool drawNormal = getIsDebugItemDisplayed(DebugItem::COLLISION_SHAPE_NORMAL);
355
356 if (drawShape) {
357
358 // For each triangle of the mesh
359 for (uint32 t = 0; t < concaveMeshShape->getNbTriangles(); t++) {
360
361 Vector3 v1, v2, v3;
362 concaveMeshShape->getTriangleVertices(t, v1, v2, v3);
363
364 v1 = transform * v1;
365 v2 = transform * v2;
366 v3 = transform * v3;
367
368 mTriangles.add(DebugTriangle(v1, v2, v3, colorShape));
369 }
370 }
371
372 if (drawNormal) {
373
374 // For each vertex of the mesh
375 for (uint32 v = 0; v < concaveMeshShape->getNbVertices(); v++) {
376
377 const Vector3& vertex = transform * concaveMeshShape->getVertex(v);
378 const Vector3 normalPoint = vertex + transform.getOrientation() * concaveMeshShape->getVertexNormal(v) * mCollisionShapeNormalLength;
379 mLines.add(DebugLine(vertex, normalPoint, colorShapeNormals));
380 }
381 }
382}
383
384// Draw a height field shape
385void DebugRenderer::drawHeightFieldShape(const Transform& transform, const HeightFieldShape* heightFieldShape,

Callers

nothing calls this directly

Calls 8

DebugTriangleClass · 0.85
DebugLineClass · 0.85
getVertexNormalMethod · 0.80
getNbTrianglesMethod · 0.45
getTriangleVerticesMethod · 0.45
addMethod · 0.45
getNbVerticesMethod · 0.45
getVertexMethod · 0.45

Tested by

no test coverage detected