void wiSPTree::getVisible(Node* node, RAY& frustum, CulledList& objects, int type){
	if(!node) return;
	int contain_type = frustum.intersects(node->box);
	if(!contain_type) return;
	else {
		for(Cullable* object : node->objects)
			if(frustum.intersects(object->bounds)){
				//object->lastSquaredDistMulThousand=(long)(wiMath::DistanceEstimated(object->bounds.getCenter(),frustum.center)*1000);
				objects.insert(object);
			}
		if(node->count){
			for (unsigned int i = 0; i<node->children.size(); ++i)
				getVisible(node->children[i],frustum,objects,type);
		}
	}
}
Beispiel #2
0
void wiSPTree::getVisible(Node* node, RAY& frustum, CulledList& objects, SortType sort, CullStrictness type){
	if(!node) return;
	int contain_type = frustum.intersects(node->box);
	if(!contain_type) return;
	else {
		for(Cullable* object : node->objects)
			if(frustum.intersects(object->bounds)){

#ifdef SORT_SPTREE_CULL
				object->lastSquaredDistMulThousand=(long)(wiMath::Distance(object->bounds.getCenter(),frustum.origin)*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);
		}
	}
}