| 1408 | } |
| 1409 | |
| 1410 | U32 MeshRoad::packUpdate(NetConnection * con, U32 mask, BitStream * stream) |
| 1411 | { |
| 1412 | U32 retMask = Parent::packUpdate(con, mask, stream); |
| 1413 | |
| 1414 | if ( stream->writeFlag( mask & MeshRoadMask ) ) |
| 1415 | { |
| 1416 | // Write Object Transform. |
| 1417 | stream->writeAffineTransform( mObjToWorld ); |
| 1418 | |
| 1419 | // Write Materials |
| 1420 | PACK_ASSET(con, TopMaterial); |
| 1421 | PACK_ASSET(con, BottomMaterial); |
| 1422 | PACK_ASSET(con, SideMaterial); |
| 1423 | |
| 1424 | stream->write( mTextureLength ); |
| 1425 | stream->write( mBreakAngle ); |
| 1426 | stream->write( mWidthSubdivisions ); |
| 1427 | } |
| 1428 | |
| 1429 | if ( stream->writeFlag( mask & ProfileMask ) ) |
| 1430 | { |
| 1431 | stream->writeInt( mSideProfile.mNodes.size(), 16 ); |
| 1432 | |
| 1433 | for( U32 i = 0; i < mSideProfile.mNodes.size(); i++ ) |
| 1434 | { |
| 1435 | mathWrite( *stream, mSideProfile.mNodes[i].getPosition() ); |
| 1436 | stream->writeFlag( mSideProfile.mNodes[i].isSmooth() ); |
| 1437 | |
| 1438 | if(i) |
| 1439 | stream->writeInt(mSideProfile.mSegMtrls[i-1], 3); |
| 1440 | else |
| 1441 | stream->writeInt(0, 3); |
| 1442 | } |
| 1443 | } |
| 1444 | |
| 1445 | if ( stream->writeFlag( mask & NodeMask ) ) |
| 1446 | { |
| 1447 | const U32 nodeByteSize = 32; // Based on sending all of a node's parameters |
| 1448 | |
| 1449 | // Test if we can fit all of our nodes within the current stream. |
| 1450 | // We make sure we leave 100 bytes still free in the stream for whatever |
| 1451 | // may follow us. |
| 1452 | S32 allowedBytes = stream->getWriteByteSize() - 100; |
| 1453 | if ( stream->writeFlag( (nodeByteSize * mNodes.size()) < allowedBytes ) ) |
| 1454 | { |
| 1455 | // All nodes should fit, so send them out now. |
| 1456 | stream->writeInt( mNodes.size(), 16 ); |
| 1457 | |
| 1458 | for ( U32 i = 0; i < mNodes.size(); i++ ) |
| 1459 | { |
| 1460 | mathWrite( *stream, mNodes[i].point ); |
| 1461 | stream->write( mNodes[i].width ); |
| 1462 | stream->write( mNodes[i].depth ); |
| 1463 | mathWrite( *stream, mNodes[i].normal ); |
| 1464 | } |
| 1465 | } |
| 1466 | else |
| 1467 | { |
nothing calls this directly
no test coverage detected