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

Method buildConvex

Engine/source/T3D/convexShape.cpp:745–786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

743}
744
745void ConvexShape::buildConvex( const Box3F &box, Convex *convex )
746{
747 if ( mGeometry.faces.empty() )
748 return;
749
750 mConvexList->collectGarbage();
751
752 Box3F realBox = box;
753 mWorldToObj.mul( realBox );
754 realBox.minExtents.convolveInverse( mObjScale );
755 realBox.maxExtents.convolveInverse( mObjScale );
756
757 if ( realBox.isOverlapped( getObjBox() ) == false )
758 return;
759
760 // See if this convex exists in the working set already...
761 Convex *cc = 0;
762 CollisionWorkingList &wl = convex->getWorkingList();
763 for ( CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext )
764 {
765 if ( itr->mConvex->getType() == ConvexShapeCollisionConvexType )
766 {
767 ConvexShapeCollisionConvex *pConvex = static_cast<ConvexShapeCollisionConvex*>(itr->mConvex);
768
769 if ( pConvex->pShape == this )
770 {
771 cc = itr->mConvex;
772 return;
773 }
774 }
775 }
776
777 // Set up the convex...
778
779 ConvexShapeCollisionConvex *cp = new ConvexShapeCollisionConvex();
780
781 mConvexList->registerObject( cp );
782 convex->addToWorkingList( cp );
783
784 cp->mObject = this;
785 cp->pShape = this;
786}
787
788bool ConvexShape::buildPolyList( PolyListContext context, AbstractPolyList *plist, const Box3F &box, const SphereF &sphere )
789{

Callers

nothing calls this directly

Calls 8

collectGarbageMethod · 0.80
addToWorkingListMethod · 0.80
isOverlappedMethod · 0.60
emptyMethod · 0.45
mulMethod · 0.45
convolveInverseMethod · 0.45
getTypeMethod · 0.45
registerObjectMethod · 0.45

Tested by

no test coverage detected