Beispiel #1
0
        public TSOForm(TSOConfig tso_config, string[] args)
        {
            InitializeComponent();
            this.ClientSize = tso_config.ClientSize;
            if (tso_config.PseudoFullScreen)
            {
                this.FormBorderStyle = FormBorderStyle.None;
            }
            if (tso_config.Keying)
            {
                this.TransparencyKey = tso_config.ScreenColor;
            }

            for (int i = 0; i < keysEnabled.Length; i++)
            {
                keysEnabled[i] = true;
            }
            this.KeyDown += new KeyEventHandler(form_OnKeyDown);
            this.KeyUp   += new KeyEventHandler(form_OnKeyUp);

            this.DragDrop += new DragEventHandler(form_OnDragDrop);
            this.DragOver += new DragEventHandler(form_OnDragOver);

            this.viewer        = new Viewer();
            viewer.Windowed    = tso_config.Windowed;
            viewer.DeviceSize  = tso_config.DeviceSize;
            viewer.ScreenColor = tso_config.ScreenColor;
            viewer.Ambient     = tso_config.Ambient;
            viewer.HohoAlpha   = tso_config.HohoAlpha;
            viewer.XRGBDepth   = tso_config.XRGBDepth;
            viewer.SetDepthMapFormat(tso_config.DepthMapFormat);
            viewer.SetNormalMapFormat(tso_config.NormalMapFormat);
            viewer.SetProjectionMode(tso_config.ProjectionMode);
            viewer.SetRenderMode(tso_config.RenderMode);
            viewer.MainGel   = tso_config.MainGel;
            viewer.ScreenDof = tso_config.ScreenDof;

            this.figureForm = new FigureForm();
            this.configForm = new ConfigForm();

            CameraConfig    camera_config    = new CameraConfig();
            DepthMapConfig  depthmap_config  = new DepthMapConfig();
            OcclusionConfig occlusion_config = new OcclusionConfig();
            DiffusionConfig diffusion_config = new DiffusionConfig();

            viewer.CameraConfig    = camera_config;
            viewer.DepthMapConfig  = depthmap_config;
            viewer.OcclusionConfig = occlusion_config;
            viewer.DiffusionConfig = diffusion_config;

            configForm.CameraConfig    = camera_config;
            configForm.DepthMapConfig  = depthmap_config;
            configForm.OcclusionConfig = occlusion_config;
            configForm.DiffusionConfig = diffusion_config;
            configForm.ConfigConnect();

            this.record = new Record(viewer, tso_config.RecordStep);

            if (viewer.InitializeApplication(this, true))
            {
                viewer.ConfigConnect();
                figureForm.SetViewer(viewer);
                viewer.FigureSelectEvent += delegate(object sender, EventArgs e)
                {
                    Figure fig;
                    if (viewer.TryGetFigure(out fig))
                    {
                        figureForm.SetFigure(fig);
                    }
                    else
                    {
                        figureForm.Clear();
                    }
                };
                viewer.Camera.SetTranslation(0.0f, +10.0f, +44.0f);
                foreach (string arg in args)
                {
                    viewer.LoadAnyFile(arg, true);
                }
                if (viewer.FigureList.Count == 0)
                {
                    viewer.LoadAnyFile(Path.Combine(save_path, "system.tdcgsav.png"), true);
                }

                this.timer1.Enabled = true;
            }
        }