| 1056 | } |
| 1057 | |
| 1058 | void MeshRoad::unpackUpdate(NetConnection * con, BitStream * stream) |
| 1059 | { |
| 1060 | // Unpack Parent. |
| 1061 | Parent::unpackUpdate(con, stream); |
| 1062 | |
| 1063 | // MeshRoadMask |
| 1064 | if(stream->readFlag()) |
| 1065 | { |
| 1066 | MatrixF ObjectMatrix; |
| 1067 | stream->readAffineTransform(&ObjectMatrix); |
| 1068 | Parent::setTransform(ObjectMatrix); |
| 1069 | |
| 1070 | // Read Materials... |
| 1071 | Material *pMat = NULL; |
| 1072 | |
| 1073 | for ( U32 i = 0; i < SurfaceCount; i++ ) |
| 1074 | { |
| 1075 | stream->read( &mMaterialName[i] ); |
| 1076 | |
| 1077 | if ( !Sim::findObject( mMaterialName[i], pMat ) ) |
| 1078 | Con::printf( "DecalRoad::unpackUpdate, failed to find Material of name %s", mMaterialName[i].c_str() ); |
| 1079 | else |
| 1080 | mMaterial[i] = pMat; |
| 1081 | } |
| 1082 | |
| 1083 | if ( isProperlyAdded() ) |
| 1084 | _initMaterial(); |
| 1085 | |
| 1086 | stream->read( &mTextureLength ); |
| 1087 | |
| 1088 | stream->read( &mBreakAngle ); |
| 1089 | |
| 1090 | stream->read( &mWidthSubdivisions ); |
| 1091 | } |
| 1092 | |
| 1093 | // NodeMask |
| 1094 | if ( stream->readFlag() ) |
| 1095 | { |
| 1096 | if (stream->readFlag()) |
| 1097 | { |
| 1098 | // Nodes have been passed in this update |
| 1099 | U32 count = stream->readInt( 16 ); |
| 1100 | |
| 1101 | mNodes.clear(); |
| 1102 | |
| 1103 | Point3F pos, normal; |
| 1104 | F32 width, depth; |
| 1105 | for ( U32 i = 0; i < count; i++ ) |
| 1106 | { |
| 1107 | mathRead( *stream, &pos ); |
| 1108 | stream->read( &width ); |
| 1109 | stream->read( &depth ); |
| 1110 | mathRead( *stream, &normal ); |
| 1111 | _addNode( pos, width, depth, normal ); |
| 1112 | } |
| 1113 | } |
| 1114 | else |
| 1115 | { |
nothing calls this directly
no test coverage detected