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

Method setUpdateData

physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp:500–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500bool BroadPhaseSap::setUpdateData(const BroadPhaseUpdateData& updateData)
501{
502 PX_ASSERT(0==mCreatedPairsSize);
503 PX_ASSERT(0==mDeletedPairsSize);
504
505#if PX_CHECKED
506 if(!BroadPhaseUpdateData::isValid(updateData, *this))
507 {
508 PX_CHECK_MSG(false, "Illegal BroadPhaseUpdateData \n");
509 mCreated = NULL;
510 mCreatedSize = 0;
511 mUpdated = NULL;
512 mUpdatedSize = 0;
513 mRemoved = NULL;
514 mRemovedSize = 0;
515 mBoxBoundsMinMax = updateData.getAABBs();
516 mBoxGroups = updateData.getGroups();
517 return false;
518 }
519#endif
520
521 //Copy across the data ptrs and sizes.
522 mCreated = updateData.getCreatedHandles();
523 mCreatedSize = updateData.getNumCreatedHandles();
524 mUpdated = updateData.getUpdatedHandles();
525 mUpdatedSize = updateData.getNumUpdatedHandles();
526 mRemoved = updateData.getRemovedHandles();
527 mRemovedSize = updateData.getNumRemovedHandles();
528 mBoxBoundsMinMax = updateData.getAABBs();
529 mBoxGroups = updateData.getGroups();
530#ifdef BP_FILTERING_USES_TYPE_IN_GROUP
531 mLUT = updateData.getLUT();
532#endif
533 mContactDistance = updateData.getContactDistance();
534
535 //Do we need more memory to store the positions of each box min/max in the arrays of sorted boxes min/max?
536 if(updateData.getCapacity() > mBoxesCapacity)
537 {
538 const PxU32 oldBoxesCapacity=mBoxesCapacity;
539 const PxU32 newBoxesCapacity=updateData.getCapacity();
540 SapBox1D* newBoxEndPts0 = reinterpret_cast<SapBox1D*>(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*newBoxesCapacity)), "SapBox1D"));
541 SapBox1D* newBoxEndPts1 = reinterpret_cast<SapBox1D*>(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*newBoxesCapacity)), "SapBox1D"));
542 SapBox1D* newBoxEndPts2 = reinterpret_cast<SapBox1D*>(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*newBoxesCapacity)), "SapBox1D"));
543
544 PxMemCopy(newBoxEndPts0, mBoxEndPts[0], sizeof(SapBox1D)*oldBoxesCapacity);
545 PxMemCopy(newBoxEndPts1, mBoxEndPts[1], sizeof(SapBox1D)*oldBoxesCapacity);
546 PxMemCopy(newBoxEndPts2, mBoxEndPts[2], sizeof(SapBox1D)*oldBoxesCapacity);
547 for(PxU32 i=oldBoxesCapacity;i<newBoxesCapacity;i++)
548 {
549 newBoxEndPts0[i].mMinMax[0]=BP_INVALID_BP_HANDLE;
550 newBoxEndPts0[i].mMinMax[1]=BP_INVALID_BP_HANDLE;
551 newBoxEndPts1[i].mMinMax[0]=BP_INVALID_BP_HANDLE;
552 newBoxEndPts1[i].mMinMax[1]=BP_INVALID_BP_HANDLE;
553 newBoxEndPts2[i].mMinMax[0]=BP_INVALID_BP_HANDLE;
554 newBoxEndPts2[i].mMinMax[1]=BP_INVALID_BP_HANDLE;
555 }
556 PX_FREE(mBoxEndPts[0]);
557 PX_FREE(mBoxEndPts[1]);

Callers

nothing calls this directly

Calls 13

PxMemCopyFunction · 0.85
PxMemZeroFunction · 0.85
getAABBsMethod · 0.80
getCreatedHandlesMethod · 0.80
getNumCreatedHandlesMethod · 0.80
getUpdatedHandlesMethod · 0.80
getNumUpdatedHandlesMethod · 0.80
getRemovedHandlesMethod · 0.80
getNumRemovedHandlesMethod · 0.80
getLUTMethod · 0.80
isValidFunction · 0.70
getContactDistanceMethod · 0.45

Tested by

no test coverage detected