MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / visualizeConvexMesh

Function visualizeConvexMesh

physx/source/physx/src/NpShapeManager.cpp:430–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430static void visualizeConvexMesh(const PxConvexMeshGeometry& geometry, RenderOutput& out, const PxTransform& absPose)
431{
432 const ConvexMesh* convexMesh = static_cast<const ConvexMesh*>(geometry.convexMesh);
433 const ConvexHullData& hullData = convexMesh->getHull();
434
435 const PxVec3* vertices = hullData.getHullVertices();
436 const PxU8* indexBuffer = hullData.getVertexData8();
437 const PxU32 nbPolygons = convexMesh->getNbPolygonsFast();
438
439 const PxMat44 m44(PxMat33(absPose.q) * geometry.scale.toMat33(), absPose.p);
440
441 out << m44 << gCollisionShapeColor; // PT: no need to output this for each segment!
442
443 for(PxU32 i=0; i<nbPolygons; i++)
444 {
445 const PxU32 pnbVertices = hullData.mPolygons[i].mNbVerts;
446
447 PxVec3 begin = m44.transform(vertices[indexBuffer[0]]); // PT: transform it only once before the loop starts
448 for(PxU32 j=1; j<pnbVertices; j++)
449 {
450 const PxVec3 end = m44.transform(vertices[indexBuffer[j]]);
451 out.outputSegment(begin, end);
452 begin = end;
453 }
454 out.outputSegment(begin, m44.transform(vertices[indexBuffer[0]]));
455
456 indexBuffer += pnbVertices;
457 }
458}
459
460static void getTriangle(const Gu::TriangleMesh&, PxU32 i, PxVec3* wp, const PxVec3* vertices, const void* indices, bool has16BitIndices)
461{

Callers 1

visualizeFunction · 0.85

Calls 5

getHullVerticesMethod · 0.80
getVertexData8Method · 0.80
toMat33Method · 0.80
PxMat33Class · 0.50
transformMethod · 0.45

Tested by

no test coverage detected