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

Function visualizeFaceNormals

physx/source/physx/src/NpShapeManager.cpp:525–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525static void visualizeFaceNormals( PxReal fscale, RenderOutput& out, const TriangleMesh& mesh, PxU32 nbTriangles, const PxVec3* vertices,
526 const void* indices, bool has16Bit, const PxU32* results, const Matrix34& absPose, const PxMat44& midt)
527{
528 if(fscale==0.0f)
529 return;
530
531 out << midt << PxU32(PxDebugColor::eARGB_DARKRED); // PT: no need to output this for each segment!
532
533 for(PxU32 i=0; i<nbTriangles; i++)
534 {
535 const PxU32 index = results ? results[i] : i;
536 PxVec3 wp[3];
537 getTriangle(mesh, index, wp, vertices, indices, absPose, has16Bit);
538
539 const PxVec3 center = (wp[0] + wp[1] + wp[2]) / 3.0f;
540 PxVec3 normal = (wp[0] - wp[1]).cross(wp[0] - wp[2]);
541 PX_ASSERT(!normal.isZero());
542 normal = normal.getNormalized();
543
544 out << DebugArrow(center, normal * fscale);
545 }
546}
547
548static PX_FORCE_INLINE void outputTriangle(PxDebugLine* segments, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxU32 color)
549{

Callers 1

visualizeTriangleMeshFunction · 0.85

Calls 5

getTriangleFunction · 0.85
DebugArrowClass · 0.85
crossMethod · 0.45
isZeroMethod · 0.45
getNormalizedMethod · 0.45

Tested by

no test coverage detected