MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getFeatures

Method getFeatures

Engine/source/T3D/shapeBase.cpp:3391–3437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3389
3390
3391void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFeature* cf)
3392{
3393 cf->material = 0;
3394 cf->object = mObject;
3395
3396 TSShape::ConvexHullAccelerator* pAccel =
3397 pShapeBase->mShapeInstance->getShape()->getAccelerator(pShapeBase->mDataBlock->collisionDetails[hullId]);
3398 AssertFatal(pAccel != NULL, "Error, no accel!");
3399
3400 F32 currMaxDP = mDot(pAccel->vertexList[0], n);
3401 U32 index = 0;
3402 U32 i;
3403 for (i = 1; i < pAccel->numVerts; i++) {
3404 F32 dp = mDot(pAccel->vertexList[i], n);
3405 if (dp > currMaxDP) {
3406 currMaxDP = dp;
3407 index = i;
3408 }
3409 }
3410
3411 const U8* emitString = pAccel->emitStrings[index];
3412 U32 currPos = 0;
3413 U32 numVerts = emitString[currPos++];
3414 for (i = 0; i < numVerts; i++) {
3415 cf->mVertexList.increment();
3416 U32 index = emitString[currPos++];
3417 mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last());
3418 }
3419
3420 U32 numEdges = emitString[currPos++];
3421 for (i = 0; i < numEdges; i++) {
3422 U32 ev0 = emitString[currPos++];
3423 U32 ev1 = emitString[currPos++];
3424 cf->mEdgeList.increment();
3425 cf->mEdgeList.last().vertex[0] = ev0;
3426 cf->mEdgeList.last().vertex[1] = ev1;
3427 }
3428
3429 U32 numFaces = emitString[currPos++];
3430 for (i = 0; i < numFaces; i++) {
3431 cf->mFaceList.increment();
3432 U32 plane = emitString[currPos++];
3433 mat.mulV(pAccel->normalList[plane], &cf->mFaceList.last().normal);
3434 for (U32 j = 0; j < 3; j++)
3435 cf->mFaceList.last().vertex[j] = emitString[currPos++];
3436 }
3437}
3438
3439
3440void ShapeBaseConvex::getPolyList(AbstractPolyList* list)

Callers

nothing calls this directly

Calls 7

getAcceleratorMethod · 0.80
incrementMethod · 0.80
mulPMethod · 0.80
lastMethod · 0.80
mulVMethod · 0.80
mDotFunction · 0.50
getShapeMethod · 0.45

Tested by

no test coverage detected