Split code into several source files, and fix shader compilation so it only occurs once