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

Method computeAccelerator

Engine/source/ts/tsShape.cpp:2203–2434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2201
2202
2203void TSShape::computeAccelerator(S32 dl)
2204{
2205 AssertFatal(dl < details.size(), "Error, bad detail level!");
2206
2207 // Have we already computed this?
2208 if (detailCollisionAccelerators[dl] != NULL)
2209 return;
2210
2211 // Create a bogus features list...
2212 ConvexFeature cf;
2213 MatrixF mat(true);
2214 Point3F n(0, 0, 1);
2215
2216 const TSDetail* detail = &details[dl];
2217 S32 ss = detail->subShapeNum;
2218 S32 od = detail->objectDetailNum;
2219
2220 S32 start = subShapeFirstObject[ss];
2221 S32 end = subShapeNumObjects[ss] + start;
2222 if (start < end)
2223 {
2224 // run through objects and collide
2225 // DMMNOTE: This assumes that the transform of the collision hulls is
2226 // identity...
2227 U32 surfaceKey = 0;
2228 for (S32 i = start; i < end; i++)
2229 {
2230 const TSObject* obj = &objects[i];
2231
2232 if (obj->numMeshes && od < obj->numMeshes) {
2233 TSMesh* mesh = meshes[obj->startMeshIndex + od];
2234 if (mesh)
2235 mesh->getFeatures(0, mat, n, &cf, surfaceKey);
2236 }
2237 }
2238 }
2239
2240 Vector<Point3F> fixedVerts;
2241 VECTOR_SET_ASSOCIATION(fixedVerts);
2242 S32 i;
2243 for (i = 0; i < cf.mVertexList.size(); i++) {
2244 S32 j;
2245 bool found = false;
2246 for (j = 0; j < cf.mFaceList.size(); j++) {
2247 if (cf.mFaceList[j].vertex[0] == i ||
2248 cf.mFaceList[j].vertex[1] == i ||
2249 cf.mFaceList[j].vertex[2] == i) {
2250 found = true;
2251 break;
2252 }
2253 }
2254 if (!found)
2255 continue;
2256
2257 found = false;
2258 for (j = 0; j < fixedVerts.size(); j++) {
2259 if (fixedVerts[j] == cf.mVertexList[i]) {
2260 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