solved raytracer ugly code