Inheritance: System.Windows.Forms.Form
        public void SetNode(MainWindow mainWindow, Scene scene, Node node)
        {
            _node = node;
            _scene = scene;

            var matrix4X4 = _node.Transform;
            trafoMatrixViewControlLocal.SetMatrix(ref matrix4X4);

            var mat = Matrix4x4.Identity;
            var cur = node;
            while(cur != null)
            {
                var trafo = cur.Transform;
                trafo.Transpose();
                mat = trafo * mat;
                cur = cur.Parent;
            }
            mat.Transpose();
            trafoMatrixViewControlGlobal.SetMatrix(ref mat);

            Text = node.Name + " - Details";

            // populate statistics
            labelMeshesDirect.Text = node.MeshCount.ToString(CultureInfo.InvariantCulture);
            labelChildrenDirect.Text = node.ChildCount.ToString(CultureInfo.InvariantCulture);

            var meshTotal = 0;
            var childTotal = 0;
            CountMeshAndChildrenTotal(node, ref meshTotal, ref childTotal);

            labelMeshesTotal.Text = node.MeshCount.ToString(CultureInfo.InvariantCulture);
            labelChildrenTotal.Text = node.ChildCount.ToString(CultureInfo.InvariantCulture);
        }
        public void SetMesh(MainWindow host, Mesh mesh, string meshName) 
        {
            Debug.Assert(mesh != null);
            Debug.Assert(host != null);
            Debug.Assert(meshName != null);

            _mesh = mesh;
            _host = host;

            labelVertexCount.Text = mesh.VertexCount + " Vertices";
            labelFaceCount.Text = mesh.FaceCount + " Faces";
            Text = meshName + " - Details";

            checkedListBoxPerFace.CheckOnClick = false;
            checkedListBoxPerFace.SetItemCheckState(0,
                mesh.PrimitiveType.HasFlag(PrimitiveType.Triangle)
                ? CheckState.Checked
                : CheckState.Unchecked);

            checkedListBoxPerFace.SetItemCheckState(1,
                mesh.PrimitiveType.HasFlag(PrimitiveType.Line)
                ? CheckState.Checked
                : CheckState.Unchecked);

            checkedListBoxPerFace.SetItemCheckState(2,
                mesh.PrimitiveType.HasFlag(PrimitiveType.Point)
                ? CheckState.Checked
                : CheckState.Unchecked);

            checkedListBoxPerVertex.CheckOnClick = false;
            checkedListBoxPerVertex.SetItemCheckState(0, CheckState.Checked);
            checkedListBoxPerVertex.SetItemCheckState(1, mesh.HasNormals
                ? CheckState.Checked
                : CheckState.Unchecked);
            checkedListBoxPerVertex.SetItemCheckState(2, mesh.HasTangentBasis
                ? CheckState.Checked
                : CheckState.Unchecked);

            Debug.Assert(mesh.TextureCoordinateChannels.Length >= 4);
            for (var i = 0; i < 4; ++i)
            {
                checkedListBoxPerVertex.SetItemCheckState(3 + i, mesh.HasTextureCoords(i)
                    ? CheckState.Checked
                    : CheckState.Unchecked);
            }

            Debug.Assert(mesh.VertexColorChannels.Length >= 4);
            for (var i = 0; i < 4; ++i)
            {
                checkedListBoxPerVertex.SetItemCheckState(7 + i, mesh.HasVertexColors(i)
                    ? CheckState.Checked
                    : CheckState.Unchecked);
            }

            checkedListBoxPerVertex.SetItemCheckState(11, mesh.HasBones
                ? CheckState.Checked
                : CheckState.Unchecked);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            MainWindow mainWindow = null;
            RunOnceGuard.Guard("open3mod_global_app",

                    // what to do if this is the first instance of the application
                    () =>
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);

                        mainWindow = new MainWindow();
                        if (args.Length > 0)
                        {
                            mainWindow.AddTab(args[0]);
                        }
                        Application.Run(mainWindow);
                        mainWindow = null;

                        TextureQueue.Terminate();
                    },

                    // what do invoke if this is the first instance of the application,
                    // and another (temporary) instance messages it to open a new tab
                    (String absPath) =>
                    {
                        if (mainWindow != null)
                        {
                            mainWindow.BeginInvoke(new MethodInvoker(() =>
                            {
                                mainWindow.Activate();
                                mainWindow.AddTab(absPath);
                            }));                        
                        }
                    },

                    // what to send to the first instance of the application if the
                    // current instance is only temporary.
                    () =>
                    {
                        if(args.Length == 0)
                        {
                            return null;
                        }
                        // note: have to get absolute path because the working dirs
                        // of the instances may be different.
                        return Path.GetFullPath(args[0]);
                    }
                );

            
        }
Exemple #4
0
        public LogViewer(MainWindow mainWindow)
        {
            _mainWindow = mainWindow;
            InitializeComponent();

            _mainWindow.TabChanged += (tab, add) =>
            {
                if(IsDisposed)
                {
                    return;
                }
                PopulateList();
            };

            PopulateList();
        }
        /// <summary>
        /// Constructs a MaterialPreviewRenderer to obtain a preview image
        /// for one given material.
        /// </summary>
        /// <param name="window">Window instance that hosts the primary Gl context</param>
        /// <param name="scene">Scene instance that the material belongs to</param>
        /// <param name="material">Material to render a preview image for</param>
        /// <param name="width">Requested width of the preview image, in pixels</param>
        /// <param name="height">Requested height of the preview image, in pixels</param>
        public MaterialPreviewRenderer(MainWindow window, Scene scene, Material material, uint width, uint height)
        {
            Debug.Assert(window != null);
            Debug.Assert(material != null);
            Debug.Assert(scene != null);
            Debug.Assert(width >= 1);
            Debug.Assert(height >= 1);

            _scene = scene;
            _material = material;
            _width = width;
            _height = height;
    
            _state = CompletionState.Pending;

            window.Renderer.GlExtraDrawJob += (sender) =>
            {
                _state = !RenderPreview() ? CompletionState.Failed : CompletionState.Done;
                OnPreviewAvailable();
            };
        }
Exemple #6
0
        public ExportDialog(MainWindow main)
        {
            _main = main;
            InitializeComponent();

            using (var v = new AssimpContext())
            {
                _formats = v.GetSupportedExportFormats();
                foreach (var format in _formats)
                {
                    comboBoxExportFormats.Items.Add(format.Description + "  (" + format.FileExtension + ")");
                }
                comboBoxExportFormats.SelectedIndex = ExportSettings.Default.ExportFormatIndex;
                comboBoxExportFormats.SelectedIndexChanged += (object s, EventArgs e) =>
                {
                    ExportSettings.Default.ExportFormatIndex = comboBoxExportFormats.SelectedIndex;
                    UpdateFileName(true);
                };
            }

            textBoxFileName.KeyPress += (object s, KeyPressEventArgs e) =>
            {
                _changedText = true;
            };

            // Respond to updates in the main window - the export dialog is non-modal and
            // always takes the currently selected file at the time the export button
            // is pressed.
            _main.SelectedTabChanged += (Tab tab) =>
            {
                UpdateFileName();
                UpdateCaption();
            };

            UpdateFileName();
            UpdateCaption();
        }
Exemple #7
0
 public LeapListener(MainWindow mainwindow)
 {
     _mainWindow = mainwindow;
 }
Exemple #8
0
 /// <summary>
 /// Construct a renderer given a valid and fully loaded MainWindow
 /// </summary>
 /// <param name="window">Main window, Load event of the GlContext
 ///    needs to be fired already.</param>
 internal Renderer(MainWindow window)
 {
     _window = window;
     _textOverlay = new TextOverlay(this);
 }