| 1132 | } |
| 1133 | |
| 1134 | void NavMesh::buildLinks() |
| 1135 | { |
| 1136 | // Make sure we've already built or loaded. |
| 1137 | if(!nm) |
| 1138 | return; |
| 1139 | // Iterate over tiles. |
| 1140 | for(U32 i = 0; i < mTiles.size(); i++) |
| 1141 | { |
| 1142 | const Tile &tile = mTiles[i]; |
| 1143 | // Iterate over links |
| 1144 | for(U32 j = 0; j < mLinkIDs.size(); j++) |
| 1145 | { |
| 1146 | if (mLinksUnsynced[j]) |
| 1147 | { |
| 1148 | if(tile.box.isContained(getLinkStart(j)) || |
| 1149 | tile.box.isContained(getLinkEnd(j))) |
| 1150 | { |
| 1151 | // Mark tile for build. |
| 1152 | mDirtyTiles.push_back_unique(i); |
| 1153 | // Delete link if necessary |
| 1154 | if(mDeleteLinks[j]) |
| 1155 | { |
| 1156 | eraseLink(j); |
| 1157 | j--; |
| 1158 | } |
| 1159 | else |
| 1160 | mLinksUnsynced[j] = false; |
| 1161 | } |
| 1162 | } |
| 1163 | } |
| 1164 | } |
| 1165 | if(mDirtyTiles.size()) |
| 1166 | ctx->startTimer(RC_TIMER_TOTAL); |
| 1167 | } |
| 1168 | |
| 1169 | DefineEngineMethod(NavMesh, buildLinks, void, (),, |
| 1170 | "@brief Build tiles of this mesh where there are unsynchronised links.") |
no test coverage detected