| 492 | #define FIRST_VERSION |
| 493 | #ifdef FIRST_VERSION |
| 494 | void AABBTree::refitMarkedNodes(const PxBounds3* boxes) |
| 495 | { |
| 496 | if(!mRefitBitmask.getBits()) |
| 497 | return; // No refit needed |
| 498 | |
| 499 | { |
| 500 | /*const*/ PxU32* bits = const_cast<PxU32*>(mRefitBitmask.getBits()); |
| 501 | PxU32 size = mRefitHighestSetWord+1; |
| 502 | #ifdef _DEBUG |
| 503 | if(1) |
| 504 | { |
| 505 | const PxU32 totalSize = mRefitBitmask.getSize(); |
| 506 | for(PxU32 i=size;i<totalSize;i++) |
| 507 | { |
| 508 | PX_ASSERT(!bits[i]); |
| 509 | } |
| 510 | } |
| 511 | PxU32 nbRefit=0; |
| 512 | #endif |
| 513 | const PxU32* indices = mIndices; |
| 514 | AABBTreeRuntimeNode* const nodeBase = mRuntimePool; |
| 515 | |
| 516 | while(size--) |
| 517 | { |
| 518 | // Test 32 bits at a time |
| 519 | const PxU32 currentBits = bits[size]; |
| 520 | if(!currentBits) |
| 521 | continue; |
| 522 | |
| 523 | PxU32 index = (size+1)<<5; |
| 524 | PxU32 mask = PxU32(1<<((index-1)&31)); |
| 525 | PxU32 _Count=32; |
| 526 | while(_Count--) |
| 527 | { |
| 528 | index--; |
| 529 | Ps::prefetch(nodeBase + index); |
| 530 | |
| 531 | PX_ASSERT(size==index>>5); |
| 532 | PX_ASSERT(mask==PxU32(1<<(index&31))); |
| 533 | if(currentBits & mask) |
| 534 | { |
| 535 | refitNode(nodeBase + index, boxes, indices, nodeBase); |
| 536 | #ifdef _DEBUG |
| 537 | nbRefit++; |
| 538 | #endif |
| 539 | } |
| 540 | mask>>=1; |
| 541 | } |
| 542 | bits[size] = 0; |
| 543 | } |
| 544 | |
| 545 | mRefitHighestSetWord = 0; |
| 546 | // mRefitBitmask.clearAll(); |
| 547 | } |
| 548 | } |
| 549 | #endif |
| 550 | |
| 551 |
no test coverage detected