Completed main ray tracing loop and implemented code to write image to TGA file