void Octree::BoxLookup(const Box3D& b,vector<int>& nodeIndices) const { list<int> q; q.push_back(0); while(!q.empty()) { int n=q.front(); q.pop_front(); if(!b.intersects(nodes[n].bb)) continue; if(IsLeaf(nodes[n])) nodeIndices.push_back(n); else { for(int i=0;i<8;i++) q.push_back(nodes[n].childIndices[i]); } } }