| 523 | } |
| 524 | |
| 525 | static 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 | |
| 548 | static PX_FORCE_INLINE void outputTriangle(PxDebugLine* segments, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxU32 color) |
| 549 | { |
no test coverage detected