Exemple #1
0
        static void Main(string[] args)
        {
            Directory.SetCurrentDirectory(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));

            GlobalConfiguration.Instance.OpenConfig(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Global.Config.xml");
            FrameDescription frame = null;

            string frameName = @"Resources\mat_view_teapot.rdF";
            if (args.Length > 0 && File.Exists(args[0]))
            {
                frameName = args[0];
            }
            using (var frameFile = new FileStream(frameName, FileMode.Open, FileAccess.Read))
            {
                using (var reader = new StreamReader(frameFile))
                    frame = (FrameDescription)SerializationService.Deserialize(reader.ReadToEnd(), typeof(FrameDescription));
            }
            frame.FrameName = Path.GetFileNameWithoutExtension(frameName);
            Console.WriteLine("Frame [[{0}]] loaded, start setuping BsdfRenderer", frame.FrameName);
            var editor = new BsdfEdit();
            IRenderConfig re = new MaterialViewRayEngineConfiguration(editor.ObjectMaterial, editor.PlaneMaterial);
            re.OpenFrame(frame);

            using (var example = new MainWindow(re))
            {
                example.Run(0.25);
            }

        }
        public RenderingController(SurfaceMaterial mat, int w, int h)
        {
            FrameDescription frame;

            config = new MaterialViewRayEngineConfiguration(mat, mat);
            SetupRenderer();
            using (var frameFile = new FileStream(frameName, FileMode.Open, FileAccess.Read))
            {
                using (var reader = new StreamReader(frameFile))
                    frame = (FrameDescription)SerializationService.Deserialize(reader.ReadToEnd(), typeof(FrameDescription));
            }
            frame["ImageWidth"] = w;
            frame["ImageHeight"] = h;
            frame.FrameName = Path.GetFileNameWithoutExtension(frameName);
            config.OpenFrame(frame);
        }