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

Method getFeatures

Engine/source/ts/tsMesh.cpp:434–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 7

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

Calls 6

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

Tested by

no test coverage detected