First pass at an octree for  physic intersection tests.
Fix tests.
Clean up graphics state.