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

Method triangulate

Engine/source/collision/clippedPolyList.cpp:389–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389void ClippedPolyList::triangulate()
390{
391 PROFILE_SCOPE( ClippedPolyList_Triangulate );
392
393 // Copy the source lists to our temp list and clear
394 // the originals which will recieve the results.
395 mTempPolyList.set( mPolyList.address(), mPolyList.size() );
396 mTempIndexList.set( mIndexList.address(), mIndexList.size() );
397 mPolyList.clear();
398 mIndexList.clear();
399
400 U32 j, numTriangles;
401
402 //
403 PolyListIterator polyIter = mTempPolyList.begin();
404 for ( ; polyIter != mTempPolyList.end(); polyIter++ )
405 {
406 const Poly &poly = *polyIter;
407
408 // How many triangles in this poly?
409 numTriangles = poly.vertexCount - 2;
410
411 // Build out the triangles.
412 for ( j = 0; j < numTriangles; j++ )
413 {
414 mPolyList.increment();
415
416 Poly &triangle = mPolyList.last();
417 triangle = poly;
418 triangle.vertexCount = 3;
419 triangle.vertexStart = mIndexList.size();
420
421 mIndexList.push_back( mTempIndexList[ poly.vertexStart ] );
422 mIndexList.push_back( mTempIndexList[ poly.vertexStart + 1 + j ] );
423 mIndexList.push_back( mTempIndexList[ poly.vertexStart + 2 + j ] );
424 }
425 }
426}
427
428void ClippedPolyList::generateNormals()
429{

Callers 3

_captureVertsMethod · 0.45
_generateSegmentsMethod · 0.45
clipDecalMethod · 0.45

Calls 9

incrementMethod · 0.80
setMethod · 0.45
addressMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
lastMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected