예제 #1
0
        private static async Task Render(IRayTracer rayTracer, RayTraceRenderData renderData, string filePath)
        {
            var pixelArray = new PixelArray(renderData.Width, renderData.Height);
            var renderer   = new SceneRenderer();

            renderer.Progress += (sender, eventArgs) => Console.Write($"...{eventArgs.PercentComplete}%");
            await renderer.RayTraceSceneAsync(rayTracer.GetPixelColor, pixelArray, renderData.MaxParallelism).ConfigureAwait(false);

            pixelArray.SaveToPng(filePath);
            Console.WriteLine();
            Console.WriteLine($"Saved image to {filePath}");
        }