MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / checkBins

Method checkBins

Engine/source/scene/sceneContainer.cpp:382–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380//-----------------------------------------------------------------------------
381
382void SceneContainer::checkBins(SceneObject* obj)
383{
384 AssertFatal(obj != NULL, "No object?");
385
386 PROFILE_START(CheckBins);
387 if (obj->mBinRefHead == NULL)
388 {
389 insertIntoBins(obj);
390 PROFILE_END();
391 return;
392 }
393
394 // Otherwise, the object is already in the bins. Let's see if it has strayed out of
395 // the bins that it's currently in...
396 const Box3F* pWBox = &obj->getWorldBox();
397
398 U32 minX, maxX, minY, maxY;
399 getBinRange(pWBox->minExtents.x, pWBox->maxExtents.x, minX, maxX);
400 getBinRange(pWBox->minExtents.y, pWBox->maxExtents.y, minY, maxY);
401
402 if (obj->mBinMinX != minX || obj->mBinMaxX != maxX ||
403 obj->mBinMinY != minY || obj->mBinMaxY != maxY)
404 {
405 // We have to rebin the object
406 removeFromBins(obj);
407 insertIntoBins(obj, minX, maxX, minY, maxY);
408 }
409 PROFILE_END();
410}
411
412//-----------------------------------------------------------------------------
413

Callers 1

notifyObjectDirtyMethod · 0.80

Calls 1

getWorldBoxMethod · 0.45

Tested by

no test coverage detected