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

Method multiQuery

physx/source/physx/src/NpSceneQueries.cpp:679–830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677//========================================================================================================================
678template<typename HitType>
679bool NpSceneQueries::multiQuery(
680 const MultiQueryInput& input, PxHitCallback<HitType>& hits, PxHitFlags hitFlags, const PxQueryCache* cache,
681 const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, BatchQueryFilterData* bfd) const
682{
683 const bool anyHit = (filterData.flags & PxQueryFlag::eANY_HIT) == PxQueryFlag::eANY_HIT;
684
685 PxI32 retval = 0; PX_UNUSED(retval);
686
687 if(HitTypeSupport<HitType>::IsRaycast == 0)
688 {
689 PX_CHECK_AND_RETURN_VAL(input.pose != NULL, "NpSceneQueries::overlap/sweep pose is NULL.", 0);
690 PX_CHECK_AND_RETURN_VAL(input.pose->isValid(), "NpSceneQueries::overlap/sweep pose is not valid.", 0);
691 }
692 else
693 {
694 PX_CHECK_AND_RETURN_VAL(input.getOrigin().isFinite(), "NpSceneQueries::raycast pose is not valid.", 0);
695 }
696
697 if(HitTypeSupport<HitType>::IsOverlap == 0)
698 {
699 PX_CHECK_AND_RETURN_VAL(input.getDir().isFinite(), "NpSceneQueries multiQuery input check: unitDir is not valid.", 0);
700 PX_CHECK_AND_RETURN_VAL(input.getDir().isNormalized(), "NpSceneQueries multiQuery input check: direction must be normalized", 0);
701 }
702
703 if(HitTypeSupport<HitType>::IsRaycast)
704 {
705 PX_CHECK_AND_RETURN_VAL(input.maxDistance > 0.0f, "NpSceneQueries::multiQuery input check: distance cannot be negative or zero", 0);
706 }
707
708 if(HitTypeSupport<HitType>::IsOverlap && !anyHit)
709 {
710 PX_CHECK_AND_RETURN_VAL(hits.maxNbTouches > 0, "PxScene::overlap() and PxBatchQuery::overlap() calls without eANY_HIT flag require a touch hit buffer for return results.", 0);
711 }
712
713 if(HitTypeSupport<HitType>::IsSweep)
714 {
715 PX_CHECK_AND_RETURN_VAL(input.maxDistance >= 0.0f, "NpSceneQueries multiQuery input check: distance cannot be negative", 0);
716 PX_CHECK_AND_RETURN_VAL(input.maxDistance != 0.0f || !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP),
717 "NpSceneQueries multiQuery input check: zero-length sweep only valid without the PxHitFlag::eASSUME_NO_INITIAL_OVERLAP flag", 0);
718 }
719
720 PX_CHECK_MSG(!cache || (cache && cache->shape && cache->actor), "Raycast cache specified but shape or actor pointer is NULL!");
721 PxU32 cachedCompoundId = INVALID_PRUNERHANDLE;
722 const PrunerData cacheData = cache ? NpActor::getShapeManager(*cache->actor)->findSceneQueryData(*static_cast<NpShape*>(cache->shape), cachedCompoundId) : SQ_INVALID_PRUNER_DATA;
723
724 // this function is logically const for the SDK user, as flushUpdates() will not have an API-visible effect on this object
725 // internally however, flushUpdates() changes the states of the Pruners in mSQManager
726 // because here is the only place we need this, const_cast instead of making SQM mutable
727 const_cast<NpSceneQueries*>(this)->mSQManager.flushUpdates();
728
729#if PX_SUPPORT_PVD
730 CapturePvdOnReturn<HitType> pvdCapture(this, input, hitFlags, cache, filterData, filterCall, bfd, hits);
731#endif
732
733 IssueCallbacksOnReturn<HitType> cbr(hits); // destructor will execute callbacks on return from this function
734 hits.hasBlock = false;
735 hits.nbTouches = 0;
736

Callers

nothing calls this directly

Calls 15

PX_UNUSEDFunction · 0.85
PxMinFunction · 0.85
getDirMethod · 0.80
findSceneQueryDataMethod · 0.80
flushUpdatesMethod · 0.80
hasAnyHitsMethod · 0.80
isValidMethod · 0.45
isFiniteMethod · 0.45
isNormalizedMethod · 0.45
invokeMethod · 0.45
prunerMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected