| 677 | //======================================================================================================================== |
| 678 | template<typename HitType> |
| 679 | bool 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 |
nothing calls this directly
no test coverage detected