| 395 | } |
| 396 | |
| 397 | void BlastFamily::fillDebugRender(DebugRenderBuffer& debugRenderBuffer, DebugRenderMode mode, float renderScale) |
| 398 | { |
| 399 | const NvBlastChunk* chunks = m_tkFamily->getAsset()->getChunks(); |
| 400 | const NvBlastBond* bonds = m_tkFamily->getAsset()->getBonds(); |
| 401 | const NvBlastSupportGraph graph = m_tkFamily->getAsset()->getGraph(); |
| 402 | const float bondHealthMax = m_blastAsset.getBondHealthMax(); |
| 403 | const uint32_t chunkCount = m_tkFamily->getAsset()->getChunkCount(); |
| 404 | |
| 405 | for (const ExtPxActor* pxActor : m_actors) |
| 406 | { |
| 407 | TkActor& actor = pxActor->getTkActor(); |
| 408 | uint32_t lineStartIndex = (uint32_t)debugRenderBuffer.m_lines.size(); |
| 409 | |
| 410 | uint32_t nodeCount = actor.getGraphNodeCount(); |
| 411 | if (nodeCount == 0) // subsupport chunks don't have graph nodes |
| 412 | continue; |
| 413 | |
| 414 | std::vector<uint32_t> nodes(nodeCount); |
| 415 | actor.getGraphNodeIndices(nodes.data(), static_cast<uint32_t>(nodes.size())); |
| 416 | |
| 417 | if (DEBUG_RENDER_HEALTH_GRAPH <= mode && mode <= DEBUG_RENDER_HEALTH_GRAPH_CENTROIDS) |
| 418 | { |
| 419 | const float* bondHealths = actor.getBondHealths(); |
| 420 | |
| 421 | const ExtPxChunk* pxChunks = m_blastAsset.getPxAsset()->getChunks(); |
| 422 | |
| 423 | for (uint32_t node0 : nodes) |
| 424 | { |
| 425 | const uint32_t chunkIndex0 = graph.chunkIndices[node0]; |
| 426 | const NvBlastChunk& blastChunk0 = chunks[chunkIndex0]; |
| 427 | const ExtPxChunk& assetChunk0 = pxChunks[chunkIndex0]; |
| 428 | |
| 429 | for (uint32_t adjacencyIndex = graph.adjacencyPartition[node0]; adjacencyIndex < graph.adjacencyPartition[node0 + 1]; adjacencyIndex++) |
| 430 | { |
| 431 | uint32_t node1 = graph.adjacentNodeIndices[adjacencyIndex]; |
| 432 | const uint32_t chunkIndex1 = graph.chunkIndices[node1]; |
| 433 | const NvBlastChunk& blastChunk1 = chunks[chunkIndex1]; |
| 434 | const ExtPxChunk& assetChunk1 = pxChunks[chunkIndex1]; |
| 435 | if (node0 > node1) |
| 436 | continue; |
| 437 | |
| 438 | bool invisibleBond = chunkIndex0 >= chunkCount || chunkIndex1 >= chunkCount || assetChunk0.subchunkCount == 0 || assetChunk1.subchunkCount == 0; |
| 439 | |
| 440 | // health |
| 441 | uint32_t bondIndex = graph.adjacentBondIndices[adjacencyIndex]; |
| 442 | float healthVal = PxClamp(bondHealths[bondIndex] / bondHealthMax, 0.0f, 1.0f); |
| 443 | |
| 444 | DirectX::XMFLOAT4 color = bondHealthColor(healthVal); |
| 445 | |
| 446 | const NvBlastBond& solverBond = bonds[bondIndex]; |
| 447 | const PxVec3& centroid = reinterpret_cast<const PxVec3&>(solverBond.centroid); |
| 448 | |
| 449 | // centroid |
| 450 | if (mode == DEBUG_RENDER_HEALTH_GRAPH_CENTROIDS || mode == DEBUG_RENDER_CENTROIDS) |
| 451 | { |
| 452 | const PxVec3& normal = reinterpret_cast<const PxVec3&>(solverBond.normal); |
| 453 | pushCentroid(debugRenderBuffer.m_lines, centroid, XMFLOAT4ToU32Color(invisibleBond ? BOND_INVISIBLE_COLOR : color), solverBond.area, normal.getNormalized()); |
| 454 | } |
nothing calls this directly
no test coverage detected