Exemplo n.º 1
0
        static void Main()
        {
            var scene = Scene.LoadFromFile("scenes/scene1.json");
            var rt    = new Tracer.RayTracer(scene, 1);
            var start = Stopwatch.GetTimestamp();
            var img   = rt.Render();
            var end   = Stopwatch.GetTimestamp();

            var elapsed = (end - start) / (double)Stopwatch.Frequency;

            //img.SaveToFile("scene1.png");
            var i = img.ToBitmap();

            i.Save("scene1.png");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1(i, elapsed));
        }
Exemplo n.º 2
0
        public Renderer(PictureBox pictureBox, Scene scene)
        {
            _loger = Context.Instance.Loger;

            _scene = scene;
            _scene.PrepareScene();

            //_loger.Log(Level.Verbose, _scene.BvhTree.GetStatistics());

            _pictureBox = pictureBox;

            int width = _scene.Camera.Width;
            int height = _scene.Camera.Height;

            pictureBox.Width = width;
            pictureBox.Height = height;
            _bitmap = new Bitmap(width, height);
            pictureBox.Image = _bitmap;

            _rayTracer = new Tracer.RayTracer(_scene);
        }