| 435 | } |
| 436 | |
| 437 | U32 ForestData::getItems( Vector<ForestItem> *outItems ) const |
| 438 | { |
| 439 | AssertFatal( outItems, "ForestData::getItems() - The output vector was NULL!" ); |
| 440 | |
| 441 | PROFILE_SCOPE( ForestData_getItems ); |
| 442 | |
| 443 | Vector<const ForestCell*> stack; |
| 444 | U32 count = 0; |
| 445 | |
| 446 | BucketTable::ConstIterator iter = mBuckets.begin(); |
| 447 | for (; iter != mBuckets.end(); ++iter) |
| 448 | stack.push_back( iter->value ); |
| 449 | |
| 450 | // Now loop till we run out of cells. |
| 451 | while ( !stack.empty() ) |
| 452 | { |
| 453 | // Pop off the next cell. |
| 454 | const ForestCell *cell = stack.last(); |
| 455 | stack.pop_back(); |
| 456 | |
| 457 | // Recurse thru non-leaf cells. |
| 458 | if ( !cell->isLeaf() ) |
| 459 | { |
| 460 | cell->getChildren( &stack ); |
| 461 | continue; |
| 462 | } |
| 463 | |
| 464 | // Get the items. |
| 465 | count += cell->getItems().size(); |
| 466 | outItems->merge( cell->getItems() ); |
| 467 | } |
| 468 | |
| 469 | return count; |
| 470 | } |
| 471 | |
| 472 | U32 ForestData::getItems( const Frustum &culler, Vector<ForestItem> *outItems ) const |
| 473 | { |