| 2507 | } |
| 2508 | |
| 2509 | void 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 | |
| 2548 | void MeshRoad::_generateVerts() |
| 2549 | { |
nothing calls this directly
no test coverage detected