MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / RayCastCallback

Method RayCastCallback

engine/source/2d/core/SpriteBatchQuery.cc:247–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245//-----------------------------------------------------------------------------
246
247F32 SpriteBatchQuery::RayCastCallback( const b2RayCastInput& input, S32 proxyId )
248{
249 // Debug Profiling.
250 PROFILE_SCOPE(SpriteBatchQuery_RayCastCallback);
251
252 // Fetch sprite batch item.
253 SpriteBatchItem* pSpriteBatchItem = static_cast<SpriteBatchItem*>(GetUserData( proxyId ));
254
255 // Ignore if already tagged with the sprite batch query key.
256 if ( pSpriteBatchItem->getSpriteBatchQueryKey() == mMasterQueryKey )
257 return 1.0f;
258
259 // Check OOBB.
260 if ( mCheckOOBB )
261 {
262 // Fetch the shapes render OOBB.
263 b2PolygonShape oobb;
264 oobb.Set( pSpriteBatchItem->getLocalOOBB(), 4);
265 b2RayCastOutput rayOutput;
266 if ( !oobb.RayCast( &rayOutput, mCompareRay, mCompareTransform, 0 ) )
267 return true;
268 }
269
270 // Tag with world query key.
271 pSpriteBatchItem->setSpriteBatchQueryKey( mMasterQueryKey );
272
273 SpriteBatchQueryResult queryResult( pSpriteBatchItem );
274 mQueryResults.push_back( queryResult );
275
276 return 1.0f;
277}
278
279//-----------------------------------------------------------------------------
280

Callers

nothing calls this directly

Calls 6

getLocalOOBBMethod · 0.80
SetMethod · 0.45
RayCastMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected