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

Method buildConvex

Engine/source/T3D/groundPlane.cpp:265–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265void GroundPlane::buildConvex( const Box3F& box, Convex* convex )
266{
267 mConvexList->collectGarbage();
268
269 Box3F planeBox = getPlaneBox();
270 if ( !box.isOverlapped( planeBox ) )
271 return;
272
273 // See if we already have a convex in the working set.
274 BoxConvex *boxConvex = NULL;
275 CollisionWorkingList &wl = convex->getWorkingList();
276 CollisionWorkingList *itr = wl.wLink.mNext;
277 for ( ; itr != &wl; itr = itr->wLink.mNext )
278 {
279 if ( itr->mConvex->getType() == BoxConvexType &&
280 itr->mConvex->getObject() == this )
281 {
282 boxConvex = (BoxConvex*)itr->mConvex;
283 break;
284 }
285 }
286
287 if ( !boxConvex )
288 {
289 boxConvex = new BoxConvex;
290 mConvexList->registerObject( boxConvex );
291 boxConvex->init( this );
292
293 convex->addToWorkingList( boxConvex );
294 }
295
296 // Update our convex to best match the queried box
297 if ( boxConvex )
298 {
299 Point3F queryCenter = box.getCenter();
300
301 boxConvex->mCenter = Point3F( queryCenter.x, queryCenter.y, -GROUND_PLANE_BOX_HEIGHT_HALF );
302 boxConvex->mSize = Point3F( box.getExtents().x,
303 box.getExtents().y,
304 GROUND_PLANE_BOX_HEIGHT_HALF );
305 }
306}
307
308bool GroundPlane::buildPolyList( PolyListContext context, AbstractPolyList* polyList, const Box3F& box, const SphereF& )
309{

Callers

nothing calls this directly

Calls 10

collectGarbageMethod · 0.80
addToWorkingListMethod · 0.80
getExtentsMethod · 0.80
isOverlappedMethod · 0.60
Point3FClass · 0.50
getTypeMethod · 0.45
getObjectMethod · 0.45
registerObjectMethod · 0.45
initMethod · 0.45
getCenterMethod · 0.45

Tested by

no test coverage detected