| 272 | } |
| 273 | |
| 274 | PxU32 AABBTree::progressiveBuild(AABBTreeBuildParams& params, BuildStats& stats, PxU32 progress, PxU32 limit) |
| 275 | { |
| 276 | if(progress==0) |
| 277 | { |
| 278 | if(!buildInit(params, stats)) |
| 279 | return PX_INVALID_U32; |
| 280 | |
| 281 | mStack = PX_NEW(FIFOStack); |
| 282 | mStack->push(mNodeAllocator.mPool); |
| 283 | return progress++; |
| 284 | } |
| 285 | else if(progress==1) |
| 286 | { |
| 287 | PxU32 stackCount = mStack->getNbEntries(); |
| 288 | if(stackCount) |
| 289 | { |
| 290 | PxU32 Total = 0; |
| 291 | const PxU32 Limit = limit; |
| 292 | while(Total<Limit) |
| 293 | { |
| 294 | AABBTreeBuildNode* Entry; |
| 295 | if(mStack->pop(Entry)) |
| 296 | Total += incrementalBuildHierarchy(*mStack, Entry, params, stats, mNodeAllocator, mIndices); |
| 297 | else |
| 298 | break; |
| 299 | } |
| 300 | return progress; |
| 301 | } |
| 302 | |
| 303 | buildEnd(params, stats); |
| 304 | |
| 305 | PX_DELETE_AND_RESET(mStack); |
| 306 | |
| 307 | return 0; // Done! |
| 308 | } |
| 309 | return PX_INVALID_U32; |
| 310 | } |
| 311 | //~Progressive building |
| 312 | |
| 313 |
no test coverage detected