예제 #1
0
        private static void Mandelcube()
        {
            var start = DateTime.Now;

            int width = 512;
            int height = 512;

            var rayTracer = new RayTracer(
                bounds: new Bounds3(
                    pos: new Vector3(-6.5f, -6.5f, -6.5f),
                    size: new Vector3(13f, 13f, 13f)),
                fractal: new MandelCube(
                    maxIterations: 255),
                camera: new Camera(
                    pos: new Vector3(0, 0, -10),
                    lookAt: new Vector3(0, 0, 0),
                    frustrumSize: new Vector2(18f, 18f)));

            using (var outp = new Bitmap(width, height))
            {
                var bits = outp.LockBits(new Rectangle(Point.Empty, outp.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);

                /*
                render(
                    -6.5f, -6.5f, -6.5f,
                    13f, 13f, 13f,
                    255,
                    0, 0, -30,
                    0, 0, 0,
                    18, 18,
                    bits.Scan0, width, height);
                 * */
                rayTracer.Render(bits.Scan0, width, height);

                outp.UnlockBits(bits);

                var folder = @"..\Render\";
                Directory.CreateDirectory(folder);
                outp.Save(Path.Combine(folder, DateTime.Now.ToString("yyyyMMdd hhmmss") + ".png"));
            }

            Console.WriteLine(DateTime.Now - start);
        }
예제 #2
0
        private static void Mandelcube()
        {
            var start = DateTime.Now;

            int width  = 512;
            int height = 512;

            var rayTracer = new RayTracer(
                bounds: new Bounds3(
                    pos: new Vector3(-6.5f, -6.5f, -6.5f),
                    size: new Vector3(13f, 13f, 13f)),
                fractal: new MandelCube(
                    maxIterations: 255),
                camera: new Camera(
                    pos: new Vector3(0, 0, -10),
                    lookAt: new Vector3(0, 0, 0),
                    frustrumSize: new Vector2(18f, 18f)));

            using (var outp = new Bitmap(width, height))
            {
                var bits = outp.LockBits(new Rectangle(Point.Empty, outp.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);

                /*
                 * render(
                 *  -6.5f, -6.5f, -6.5f,
                 *  13f, 13f, 13f,
                 *  255,
                 *  0, 0, -30,
                 *  0, 0, 0,
                 *  18, 18,
                 *  bits.Scan0, width, height);
                 * */
                rayTracer.Render(bits.Scan0, width, height);

                outp.UnlockBits(bits);

                var folder = @"..\Render\";
                Directory.CreateDirectory(folder);
                outp.Save(Path.Combine(folder, DateTime.Now.ToString("yyyyMMdd hhmmss") + ".png"));
            }

            Console.WriteLine(DateTime.Now - start);
        }