MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / sweep

Method sweep

deps/physx/physx/source/physx/src/NpBatchQuery.cpp:514–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512}
513
514void NpBatchQuery::sweep(
515 const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, PxU16 maxTouchHits,
516 PxHitFlags hitFlags, const PxQueryFilterData& fd, void* userData, const PxQueryCache* cache, const PxReal inflation)
517{
518 PX_CHECK_AND_RETURN(pose.isValid(), "Batch sweep input check: pose is not valid.");
519 PX_CHECK_AND_RETURN(unitDir.isFinite(), "Batch sweep input check: unitDir is not valid.");
520 PX_CHECK_AND_RETURN(unitDir.isNormalized(), "Batch sweep input check: direction must be normalized");
521 PX_CHECK_AND_RETURN(distance >= 0.0f, "Batch sweep input check: distance cannot be negative");
522 PX_CHECK_AND_RETURN(distance != 0.0f || !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP),
523 "Batch sweep input check: zero-length sweep only valid without the PxHitFlag::eASSUME_NO_INITIAL_OVERLAP flag");
524
525#if PX_CHECKED
526 if(!PxGeometryQuery::isValid(geometry))
527 {
528 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Provided geometry is not valid");
529 return;
530 }
531#endif // PX_CHECKED
532
533 if (mNbSweeps >= mDesc.queryMemory.getMaxSweepsPerExecute())
534 {
535 PX_CHECK_AND_RETURN(mNbSweeps < mDesc.queryMemory.getMaxSweepsPerExecute(),
536 "PxBatchQuery: number of sweep() calls exceeds PxBatchQueryMemory::sweepResultBufferSize, query discarded");
537 return;
538 }
539
540
541 CHECK_RUNNING("PxBatchQuery::sweep: This batch is still executing, skipping query.")
542 mNbSweeps++;
543
544 writeBatchHeader(BatchStreamHeader(hitFlags, cache, fd, userData, maxTouchHits, QTypeROS::eSWEEP));
545
546 //set the MTD flag
547 mHasMtdSweep |= !!(hitFlags & PxHitFlag::eMTD);
548
549 if((hitFlags & PxHitFlag::ePRECISE_SWEEP) && (hitFlags & PxHitFlag::eMTD))
550 {
551 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, " Precise sweep doesn't support MTD. Perform MTD with default sweep");
552 hitFlags &= ~PxHitFlag::ePRECISE_SWEEP;
553 }
554
555 if((hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP) && (hitFlags & PxHitFlag::eMTD))
556 {
557 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, " eMTD cannot be used in conjunction with eASSUME_NO_INITIAL_OVERLAP. eASSUME_NO_INITIAL_OVERLAP will be ignored");
558 hitFlags &= ~PxHitFlag::eASSUME_NO_INITIAL_OVERLAP;
559 }
560
561 PxReal realInflation = inflation;
562 if((hitFlags & PxHitFlag::ePRECISE_SWEEP)&& inflation > 0.0f)
563 {
564 realInflation = 0.0f;
565 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, " Precise sweep doesn't support inflation, inflation will be overwritten to be zero");
566 }
567
568 writeQueryInput(mStream, MultiQueryInput(&geometry, &pose, unitDir, distance, realInflation));
569
570 Ps::atomicExchange(&mBatchQueryIsRunning, 0);
571}

Callers 7

readyToSyncCCTMethod · 0.45
linearSweepSingleMethod · 0.45
linearSweepMultipleMethod · 0.45
sweepAnyMethod · 0.45
sweepSingleMethod · 0.45
sweepMultipleMethod · 0.45

Calls 9

writeQueryInputFunction · 0.85
MultiQueryInputClass · 0.85
BatchStreamHeaderClass · 0.70
isValidFunction · 0.50
atomicExchangeFunction · 0.50
isValidMethod · 0.45
isFiniteMethod · 0.45
isNormalizedMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected