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

Function applyAllPreFiltersSQ

physx/source/physx/src/NpSceneQueries.cpp:152–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150//========================================================================================================================
151
152static PX_FORCE_INLINE bool applyAllPreFiltersSQ(
153 const local::ActorShape* as, PxQueryHitType::Enum& hitType, const PxQueryFlags& inFilterFlags,
154 const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall,
155 BatchQueryFilterData* bfd, PxHitFlags& queryFlags/*, PxU32 maxNbTouches*/)
156{
157 // AP: the !bfd clause is here because there's no other way to pass data to BQ pre/post filter shaders
158 // For normal query the data can be passed with inherited callback instance
159 // So if for BQ SPU filter shader the user tries to pass data via FD, the equation will always cut it out
160 // AP scaffold TODO: once SPU is officially phased out we can remove the !bfd clause, fix broken UTs (that are wrong)
161 // and also remove support for filter shaders
162 if(!bfd && !applyFilterEquation(*as->scbShape, filterData.data))
163 return false;
164
165 if((inFilterFlags & PxQueryFlag::ePREFILTER) && (filterCall || bfd))
166 {
167 PxHitFlags outQueryFlags = queryFlags;
168
169 if(filterCall)
170 hitType = filterCall->preFilter(filterData.data, as->shape, as->actor, outQueryFlags);
171 else if(bfd->preFilterShader)
172 hitType = bfd->preFilterShader(
173 filterData.data, as->scbShape->getScShape().getQueryFilterData(),
174 bfd->filterShaderData, bfd->filterShaderDataSize, outQueryFlags);
175
176 // AP: at this point the callback might return eTOUCH but the touch buffer can be empty, the hit will be discarded
177 //PX_CHECK_MSG(hitType == PxQueryHitType::eTOUCH ? maxNbTouches > 0 : true,
178 // "SceneQuery: preFilter returned eTOUCH but empty touch buffer was provided, hit discarded.");
179
180 queryFlags = (queryFlags & ~PxHitFlag::eMODIFIABLE_FLAGS) | (outQueryFlags & PxHitFlag::eMODIFIABLE_FLAGS);
181 }
182 // test passed, continue to return as;
183 return true;
184}
185
186//========================================================================================================================
187// performs a single geometry query for any HitType (PxSweepHit, PxOverlapHit, PxRaycastHit)

Callers 1

invokeMethod · 0.85

Calls 3

applyFilterEquationFunction · 0.85
getQueryFilterDataMethod · 0.80
preFilterMethod · 0.45

Tested by

no test coverage detected