Пример #1
0
        /// <summary>
        /// Main render call
        /// </summary>
        /// <param name="scene"></param>
        /// <returns></returns>
        public Canvas Render(Scene scene)
        {
            Canvas image = new Canvas(hsize, vsize);
            Camera cam   = this;

            for (int y = 0; y < vsize; y++)
            {
                for (int x = 0; x < hsize; x++)
                {
                    Ray   ray   = cam.RayForPixel(x, y);
                    Color color = scene.ColorAt(ray);

                    Console.WriteLine("Color: " + color.ToString());
                    image.SetPixelColor(x, y, color);
                }
            }
            return(image);
        }