Implemented a 3d renderer in a separate window.
Lots of improvements and fixes to the 3d renderer.