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

Method computeAccelerator

Engine/source/ts/tsShape.cpp:2257–2488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2255
2256
2257void TSShape::computeAccelerator(S32 dl)
2258{
2259 AssertFatal(dl < details.size(), "Error, bad detail level!");
2260
2261 // Have we already computed this?
2262 if (detailCollisionAccelerators[dl] != NULL)
2263 return;
2264
2265 // Create a bogus features list...
2266 ConvexFeature cf;
2267 MatrixF mat(true);
2268 Point3F n(0, 0, 1);
2269
2270 const TSDetail* detail = &details[dl];
2271 S32 ss = detail->subShapeNum;
2272 S32 od = detail->objectDetailNum;
2273
2274 S32 start = subShapeFirstObject[ss];
2275 S32 end = subShapeNumObjects[ss] + start;
2276 if (start < end)
2277 {
2278 // run through objects and collide
2279 // DMMNOTE: This assumes that the transform of the collision hulls is
2280 // identity...
2281 U32 surfaceKey = 0;
2282 for (S32 i = start; i < end; i++)
2283 {
2284 const TSObject* obj = &objects[i];
2285
2286 if (obj->numMeshes && od < obj->numMeshes) {
2287 TSMesh* mesh = meshes[obj->startMeshIndex + od];
2288 if (mesh)
2289 mesh->getFeatures(0, mat, n, &cf, surfaceKey);
2290 }
2291 }
2292 }
2293
2294 Vector<Point3F> fixedVerts;
2295 VECTOR_SET_ASSOCIATION(fixedVerts);
2296 S32 i;
2297 for (i = 0; i < cf.mVertexList.size(); i++) {
2298 S32 j;
2299 bool found = false;
2300 for (j = 0; j < cf.mFaceList.size(); j++) {
2301 if (cf.mFaceList[j].vertex[0] == i ||
2302 cf.mFaceList[j].vertex[1] == i ||
2303 cf.mFaceList[j].vertex[2] == i) {
2304 found = true;
2305 break;
2306 }
2307 }
2308 if (!found)
2309 continue;
2310
2311 found = false;
2312 for (j = 0; j < fixedVerts.size(); j++) {
2313 if (fixedVerts[j] == cf.mVertexList[i]) {
2314 found = true;

Callers

nothing calls this directly

Calls 10

getMaxFunction · 0.85
dMemcpyFunction · 0.50
dMemsetFunction · 0.50
mDotFunction · 0.50
Point2IClass · 0.50
sizeMethod · 0.45
getFeaturesMethod · 0.45
push_backMethod · 0.45
setSizeMethod · 0.45
addressMethod · 0.45

Tested by

no test coverage detected