// Returns the number of collision tests with the octree.
unsigned int OctreeNode::CollisionTest(const SceneObject& sceneObject)
{
	if(!ObjectIsInside(sceneObject))
		return 0;

	bool leaf= true;
	unsigned int collisionTestsCounter = 0;

	// Find the leaf wich contained the sceneObject.
	OctreeNode* currentNode = this->FindLeaf(sceneObject);

	if(currentNode == NULL)
		return collisionTestsCounter;

	// For each contained object : increase the collisionTestsCounter and set the green color (collision test are execute on green spheres).
	for(unsigned int i = 0; i < currentNode->GetContainedObjectsSize(); ++i)
	{
		collisionTestsCounter++;
		currentNode->GetContainedObject(i)->SetColor(ColorRGB::PureGreen);
	}

	currentNode->SetColor(ColorRGB::PureRed);

	return collisionTestsCounter;
}