| 741 | } |
| 742 | |
| 743 | U32 ForestData::getDatablocks( Vector<ForestItemData*> *outVector ) const |
| 744 | { |
| 745 | Vector<const ForestCell*> stack; |
| 746 | U32 count = 0; |
| 747 | |
| 748 | BucketTable::ConstIterator iter = mBuckets.begin(); |
| 749 | for (; iter != mBuckets.end(); ++iter) |
| 750 | stack.push_back( iter->value ); |
| 751 | |
| 752 | // Now loop till we run out of cells. |
| 753 | while ( !stack.empty() ) |
| 754 | { |
| 755 | // Pop off the next cell. |
| 756 | const ForestCell *cell = stack.last(); |
| 757 | stack.pop_back(); |
| 758 | |
| 759 | // Recurse thru non-leaf cells. |
| 760 | if ( !cell->isLeaf() ) |
| 761 | { |
| 762 | cell->getChildren( &stack ); |
| 763 | continue; |
| 764 | } |
| 765 | |
| 766 | // Go thru the items. |
| 767 | const Vector<ForestItem> &items = cell->getItems(); |
| 768 | Vector<ForestItem>::const_iterator item = items.begin(); |
| 769 | for ( ; item != items.end(); item++ ) |
| 770 | { |
| 771 | ForestItemData *data = item->getData(); |
| 772 | |
| 773 | if (T3D::find( outVector->begin(), outVector->end(), data ) != outVector->end() ) |
| 774 | continue; |
| 775 | |
| 776 | count++; |
| 777 | outVector->push_back( data ); |
| 778 | } |
| 779 | } |
| 780 | |
| 781 | return count; |
| 782 | } |
| 783 | |
| 784 | void ForestData::clearPhysicsRep( Forest *forest ) |
| 785 | { |