Exemple #1
0
        public TSOForm(TSOConfig tso_config, string[] args)
        {
            InitializeComponent();
            this.ClientSize = tso_config.ClientSize;

            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.DeviceSize  = tso_config.DeviceSize;
            viewer.ScreenColor = tso_config.ScreenColor;
            viewer.HohoAlpha   = tso_config.HohoAlpha;

            this.fig_form = new FigureForm();

            if (viewer.InitializeApplication(this, true))
            {
                viewer.FigureEvent += delegate(object sender, EventArgs e)
                {
                    Figure fig;
                    if (viewer.TryGetFigure(out fig))
                    {
                        fig_form.SetFigure(fig);
                    }
                    else
                    {
                        fig_form.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);
                }

                string script_file = Path.Combine(Application.StartupPath, "Script.cs");
                if (File.Exists(script_file))
                {
                    string assembly_file = Path.GetTempFileName();
                    var    script        = CSScript.Load(script_file, assembly_file, true, null).CreateInstance("TDCG.Script").AlignToInterface <IScript>();
                    script.Hello(viewer);
                }

                this.timer1.Enabled = true;
            }
        }
Exemple #2
0
        private void form_OnDragDrop(object sender, DragEventArgs e)
        {
            //�h���b�v���ꂽ�f�[�^���t�@�C�������ׂ�
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] FileName
                    = (string[])e.Data.GetData(DataFormats.FileDrop);

                string name = FileName[0];

                // �g���q��".tdcgpose.png"or".tmo"�ł��邩�m�F����
                if ((System.IO.Path.GetExtension(name) == ".png" &&
                     System.IO.Path.GetExtension(
                         System.IO.Path.GetFileNameWithoutExtension(name)) == ".tdcgpose") ||
                    System.IO.Path.GetExtension(name) == ".tmo")
                {
                    try
                    {
                        //�h���b�v���ꂽ�t�@�C����ǂݍ���
                        viewer.LoadAnyFile(name, false);
                    }
                    catch
                    {
                        MessageBox.Show("�t�@�C����ǂݍ��ނ��Ƃ��ł��܂���ł����B\n�t�@�C��������ł��邩�m�F���Ă��������B");
                    }
                }
                else
                {
                    MessageBox.Show("�g���q��.tdcgpose.png���A.tmo�ł���K�v������܂��B");
                    return;
                }
            }
        }
Exemple #3
0
 private void form_OnDragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         foreach (string src in (string[])e.Data.GetData(DataFormats.FileDrop))
         {
             viewer.LoadAnyFile(src, (e.KeyState & 8) == 8);
         }
     }
 }
Exemple #4
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;
            }
        }
Exemple #5
0
        public TSOForm(TSOConfig tso_config, string[] args)
        {
            InitializeComponent();
            this.ClientSize = tso_config.ClientSize;
            this.AllowDrop  = true;

            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(false);
            this.fig_form = new FigureForm();
            this.tbr      = new TransBoneRotation();

            if (viewer.InitializeApplication(this, true))
            {
                viewer.FigureEvent += delegate(object sender, EventArgs e)
                {
                    Figure fig;
                    if (viewer.TryGetFigure(out fig))
                    {
                        viewer.Camera.SetCenter(fig.Center);
                    }
                };
                viewer.FigureEvent += delegate(object sender, EventArgs e)
                {
                    Figure fig;
                    if (viewer.TryGetFigure(out fig))
                    {
                        fig_form.SetFigure(fig);
                    }
                    else
                    {
                        fig_form.Clear();
                    }
                };
                foreach (string arg in args)
                {
                    viewer.LoadAnyFile(arg, true);
                }

                // �����|�[�Y��TMO�𓾂Ă���
                Figure fig_forPose;
                viewer.TryGetFigure(out fig_forPose);
                tbr.SetInitPose(fig_forPose);

                /*string script_file = Path.Combine(Application.StartupPath, "Script.cs");
                 * if (File.Exists(script_file))
                 * {
                 *  var script = CSScript.Load(script_file).CreateInstance("TDCG.Script").AlignToInterface<IScript>();
                 *  script.Hello(viewer);
                 * }*/

                this.timer1.Enabled = true;

                viewer.Camera.Translation = new Vector3(0.0f, 0.0f, +50.0f);
            }
        }