| 219 | } |
| 220 | |
| 221 | void ExtrudedPolyList::end() |
| 222 | { |
| 223 | // Anything facing away from the mVelocity is rejected (and also |
| 224 | // cap to max collisions) |
| 225 | if (mDot(mPoly.plane, mNormalVelocity) > 0.f || |
| 226 | mCollisionList->getCount() >= CollisionList::MaxCollisions) |
| 227 | return; |
| 228 | |
| 229 | // Test the built up poly (stored in mPoly) against all our extruded |
| 230 | // faces. |
| 231 | U32 cFaceCount = 0; |
| 232 | ExtrudedFace* cFace[30]; |
| 233 | bool cEdgeColl[30]; |
| 234 | ExtrudedFace* face = mExtrudedList.begin(); |
| 235 | ExtrudedFace* end = mExtrudedList.end(); |
| 236 | |
| 237 | for (; face != end; face++) |
| 238 | { |
| 239 | // Skip inactive.. |
| 240 | if (!face->active) |
| 241 | continue; |
| 242 | |
| 243 | // Update the dot product. |
| 244 | face->faceDot = -mDot(face->plane,mPoly.plane); |
| 245 | |
| 246 | // Skip it if we're facing towards... |
| 247 | if(face->faceDot <= 0.f) |
| 248 | continue; |
| 249 | |
| 250 | // Test, and skip if colliding. |
| 251 | if (!testPoly(*face)) |
| 252 | continue; |
| 253 | |
| 254 | // Note collision. |
| 255 | cFace[cFaceCount] = face; |
| 256 | cEdgeColl[cFaceCount++] = false; |
| 257 | } |
| 258 | |
| 259 | if (!cFaceCount) |
| 260 | { |
| 261 | face = mExtrudedList.begin(); |
| 262 | end = mExtrudedList.end(); |
| 263 | for (; face != end; face++) |
| 264 | { |
| 265 | // Don't need to do dot product second time, so just check if it's |
| 266 | // active (we already did the dot product in the previous loop). |
| 267 | if (!face->active) |
| 268 | continue; |
| 269 | |
| 270 | // Skip it if we're facing away... |
| 271 | if(face->faceDot > 0.f) |
| 272 | continue; |
| 273 | |
| 274 | // Do collision as above. |
| 275 | if (!testPoly(*face)) |
| 276 | continue; |
| 277 | |
| 278 | // Note the collision. |
no test coverage detected