예제 #1
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveDialog = new SaveFileDialog();

            saveDialog.AddExtension = true;
            saveDialog.Filter       = "Wavefront Object (*.obj)|*.obj;";

            if (saveDialog.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            m_operations.Save(saveDialog.FileName);
        }
예제 #2
0
        public static void Run(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProgramOptions options = new ProgramOptions();

            string            settingPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Oxel.Settings.xml");
            VoxelizationInput input       = VoxelizationInput.Load(settingPath);

            if (input == null)
            {
                input = new VoxelizationInput();
            }

            if (args.Contains("-c"))
            {
                // Make sure user can see console output
                AttachConsole(PARENT_PROCESS_ID);

                input.Clone(options);

                if (!CommandLineParser.Parse <ProgramOptions>(args, ref options))
                {
                    return;
                }

                options.Clone(input);
            }
            else
            {
                CommandLineParser.Parse <VoxelizationInput>(args, ref input);
            }

            if (options.UseCommandLine)
            {
                Logger.IsCommandLine = true;

                Operations operations = new Operations();
                operations.Initialize(input);
                operations.Open(options.InputMesh, input.WindingOrder);
                WaitHandle waitHandle = operations.GenerateOccluder((VoxelizationProgress vp) => {
                    string coverage =
                        String.Format("Volume Coverage     : {0,5:0.##}%", (100 * vp.VolumeCoverage)) + "    " +
                        String.Format("Silhouette Coverage : {0,5:0.##}%", (100 * vp.SilhouetteCoverage));

                    if (!String.IsNullOrEmpty(vp.Status))
                    {
                        Console.WriteLine(vp.Status + "\r\n");
                    }

                    Console.WriteLine(coverage);
                }, new Action(() => { }));
                waitHandle.WaitOne();
                operations.Save(options.OutputMesh);
            }
            else
            {
                using (MainWindow window = new MainWindow(input))
                {
                    window.ShowDialog();
                }
            }
        }