void wiSPTree::getVisible(Node* node, Frustum& frustum, CulledList& objects, SortType sort, CullStrictness type){ if(!node) return; int contain_type = frustum.CheckBox(node->box.corners); if(!contain_type) return; else{ for(Cullable* object : node->objects) if( type==SP_TREE_LOOSE_CULL || (type==SP_TREE_STRICT_CULL && contain_type==BOX_FRUSTUM_INSIDE || (contain_type==BOX_FRUSTUM_INTERSECTS && frustum.CheckBox(object->bounds.corners)) ) ) { #ifdef SORT_SPTREE_CULL object->lastSquaredDistMulThousand=(long)(wiMath::Distance(object->bounds.getCenter(),frustum.getCamPos())*1000); if (sort == SP_TREE_SORT_PAINTER) object->lastSquaredDistMulThousand *= -1; #endif objects.insert(object); } if(node->count){ for (unsigned int i = 0; i<node->children.size(); ++i) getVisible(node->children[i],frustum,objects,sort,type); } } }