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

Method _generateSegments

Engine/source/environment/meshRoad.cpp:2509–2546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2507}
2508
2509void MeshRoad::_generateSegments()
2510{
2511 SAFE_DELETE( mPhysicsRep );
2512
2513 mSegments.clear();
2514
2515 for ( U32 i = 0; i < mSlices.size() - 1; i++ )
2516 {
2517 MeshRoadSegment seg( &mSlices[i], &mSlices[i+1], getWorldTransform() );
2518
2519 mSegments.push_back( seg );
2520 }
2521
2522 //mSideProfile.generateEndCap(mSlices[0].width);
2523
2524 if ( isClientObject() )
2525 _generateVerts();
2526
2527 if ( PHYSICSMGR )
2528 {
2529 ConcretePolyList polylist;
2530 if ( buildPolyList( PLC_Collision, &polylist, getWorldBox(), getWorldSphere() ) )
2531 {
2532 polylist.triangulate();
2533
2534 PhysicsCollision *colShape = PHYSICSMGR->createCollision();
2535 colShape->addTriangleMesh( polylist.mVertexList.address(),
2536 polylist.mVertexList.size(),
2537 polylist.mIndexList.address(),
2538 polylist.mIndexList.size() / 3,
2539 MatrixF::Identity );
2540
2541 PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" );
2542 mPhysicsRep = PHYSICSMGR->createBody();
2543 mPhysicsRep->init( colShape, 0, 0, this, world );
2544 }
2545 }
2546}
2547
2548void MeshRoad::_generateVerts()
2549{

Callers

nothing calls this directly

Calls 11

getWorldTransformFunction · 0.85
clearMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
triangulateMethod · 0.45
createCollisionMethod · 0.45
addTriangleMeshMethod · 0.45
addressMethod · 0.45
getWorldMethod · 0.45
createBodyMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected