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

Method getFeatures

Engine/source/ts/tsMesh.cpp:432–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430}
431
432bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexFeature* cf, U32& )
433{
434 S32 firstVert = vertsPerFrame * frame;
435 S32 i;
436 S32 base = cf->mVertexList.size();
437
438 for ( i = 0; i < vertsPerFrame; i++ )
439 {
440 cf->mVertexList.increment();
441 mat.mulP( mVertexData.getBase(firstVert + i).vert(), &cf->mVertexList.last() );
442 }
443
444 // add the polys...
445 for ( i = 0; i < mPrimitives.size(); i++ )
446 {
447 TSDrawPrimitive & draw = mPrimitives[i];
448 U32 start = draw.start;
449
450 AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" );
451
452 // gonna depend on what kind of primitive it is...
453 if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles)
454 {
455 for ( S32 j = 0; j < draw.numElements; j += 3 )
456 {
457 PlaneF plane( cf->mVertexList[base + mIndices[start + j + 0]],
458 cf->mVertexList[base + mIndices[start + j + 1]],
459 cf->mVertexList[base + mIndices[start + j + 2]]);
460
461 cf->mFaceList.increment();
462
463 ConvexFeature::Face& lastFace = cf->mFaceList.last();
464 lastFace.normal = plane;
465
466 lastFace.vertex[0] = base + mIndices[start + j + 0];
467 lastFace.vertex[1] = base + mIndices[start + j + 1];
468 lastFace.vertex[2] = base + mIndices[start + j + 2];
469
470 for ( U32 l = 0; l < 3; l++ )
471 {
472 U32 newEdge0, newEdge1;
473 U32 zero = base + mIndices[start + j + l];
474 U32 one = base + mIndices[start + j + ((l+1)%3)];
475 newEdge0 = getMin( zero, one );
476 newEdge1 = getMax( zero, one );
477 bool found = false;
478 for ( S32 k = 0; k < cf->mEdgeList.size(); k++ )
479 {
480 if ( cf->mEdgeList[k].vertex[0] == newEdge0 &&
481 cf->mEdgeList[k].vertex[1] == newEdge1)
482 {
483 found = true;
484 break;
485 }
486 }
487
488 if ( !found )
489 {

Callers 8

initMethod · 0.45
computeAcceleratorMethod · 0.45
innerRenderMethod · 0.45
processMaterialMethod · 0.45
isInstancedMethod · 0.45
matInstance.cppFile · 0.45
getShaderInfoMethod · 0.45
initMethod · 0.45

Calls 6

getMaxFunction · 0.85
incrementMethod · 0.80
mulPMethod · 0.80
vertMethod · 0.80
sizeMethod · 0.45
lastMethod · 0.45

Tested by

no test coverage detected