示例#1
0
        protected bool DoPanelHeader(MaterialPanel panel, ShaderFeature feature, bool readState = true)
        {
            Rect controlRect = EditorGUILayout.GetControlRect(false, 22f);

            GUI.Label(controlRect, GUIContent.none, TMP_UIStyleManager.Group_Label);
            if (GUI.Button(new Rect(controlRect.x, controlRect.y, 250f, controlRect.height), panel.Label, TMP_UIStyleManager.Group_Label_Left))
            {
                panel.ToggleExpanded();
            }
            if (readState)
            {
                feature.ReadState(material);
            }
            EditorGUI.BeginChangeCheck();
            float labelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 70f;
            bool active = EditorGUI.Toggle(new Rect(controlRect.width - 90f, controlRect.y + 3f, 90f, 22f), new GUIContent("Enable ->"), feature.Active);

            EditorGUIUtility.labelWidth = labelWidth;
            if (EditorGUI.EndChangeCheck())
            {
                editor.RegisterPropertyChangeUndo(feature.undoLabel);
                feature.SetActive(active, material);
            }
            return(panel.Expanded);
        }
示例#2
0
        static TMP_BitmapShaderGUI()

        {
            facePanel = new MaterialPanel("Face", true);

            debugPanel = new MaterialPanel("Debug", false);
        }
示例#3
0
        private void CreateSceneGraph()
        {
            _sceneGraph = new SceneGraph();

            _camera = new Camera(_sceneGraph,
                                 position: new Vec3(0f, 0f, 1f),
                                 target: new Vec3(0f, 0f, 0f),
                                 upDirection: new Vec3(0f, 1f, 0f),
                                 frustum: new ViewingFrustum(FrustumKind.Perspective, 1f, 1f, -1f, -10000f),
                                 aspectRatio: 1f);

            var rect = Quadrilateral <MaterialVertex> .Rectangle(100f, 100f);

            rect.ApplyTextureFront(1f, new Vec2(0f), new Vec2(1f));
            rect.UpdateTangents(BeginMode.Triangles);

            _diffuseMap = new Texture(TextureTarget.Texture2D);
            _normalMap  = new Texture(TextureTarget.Texture2D);
            _heightMap  = new Texture(TextureTarget.Texture2D);

            var texturePanel = MaterialPanel <TexturedVertex> .Movable(_sceneGraph, false,
                                                                       new Vec2 (0.4f, 0.8f), new Vec2i (1));

            var guiWindow = ControlPanel <TexturedVertex> .Movable(_sceneGraph,
                                                                   Editor (new Vec2i(1024), @"Materials\Ground.xml", texturePanel.Node),
                                                                   new Vec2i (650, 550), new Vec2 (-0.99f, 0.99f));

            _mesh = new Mesh <MaterialVertex> (_sceneGraph, rect);
            _sceneGraph.Root.Add(_camera, _mesh, guiWindow, texturePanel);
        }
示例#4
0
        private ReturnCode Scrape()
        {
            decFile.Facility       = FacilityTextBox.Text;
            decFile.MBA            = MBATextBox.Text;
            decFile.FromTime       = FromDatePicker.Value.Date.Add(FromTimePicker.Value.TimeOfDay);
            decFile.ToTime         = ToDatePicker.Value.Date.Add(ToTimePicker.Value.TimeOfDay);
            decFile.ItemName       = ItemNameTextBox.Text;
            decFile.ItemOriginDate = OriginDatePicker.Value.Date.Add(OriginTimePicker.Value.TimeOfDay);
            decFile.FullName       = FullNameTextBox.Text;
            decFile.Barcode        = BarCodeTextBox.Text;
            try
            {
                decFile.Mass = double.Parse(MassTextBox.Text);
            }
            catch
            {
                MessageBox.Show("Invalid mass!");
                return(ReturnCode.BAD_INPUT);
            }
            decFile.MassDate          = MassDatePicker.Value.Date.Add(MassTimePicker.Value.TimeOfDay);
            decFile.BatchName         = BatchNameTextBox.Text;
            decFile.BatchSource       = BatchSourceTextBox.Text;
            MaterialPanel.Composition = new NuclearComposition();
            ReturnCode returnCode = MaterialPanel.Scrape();

            if (returnCode != ReturnCode.SUCCESS)
            {
                return(returnCode);
            }
            decFile.Material         = MaterialPanel.Composition;
            decFile.CreationDate     = CreationDatePicker.Value.Date.Add(CreationTimePicker.Value.TimeOfDay);
            decFile.ModificationDate = DateTime.Now;

            return(ReturnCode.SUCCESS);
        }
示例#5
0
        public void LoadDECFile(string fileName)
        {
            if (decFile.ParseDeclarationFile(fileName) == ReturnCode.SUCCESS)
            {
                FacilityTextBox.Text = decFile.Facility;
                MBATextBox.Text      = decFile.MBA;
                FromTimePicker.Value = decFile.FromTime;
                FromDatePicker.Value = decFile.FromTime;
                ToTimePicker.Value   = decFile.ToTime;
                ToDatePicker.Value   = decFile.ToTime;

                ItemNameTextBox.Text   = decFile.ItemName;
                OriginTimePicker.Value = decFile.ItemOriginDate;
                OriginDatePicker.Value = decFile.ItemOriginDate;
                FullNameTextBox.Text   = decFile.FullName;
                BarCodeTextBox.Text    = decFile.Barcode;
                MassTextBox.Text       = decFile.Mass.ToString();
                MassTimePicker.Value   = decFile.MassDate;
                MassDatePicker.Value   = decFile.MassDate;

                BatchNameTextBox.Text     = decFile.BatchName;
                BatchSourceTextBox.Text   = decFile.BatchSource;
                MaterialPanel.Composition = decFile.Material;
                MaterialPanel.UpdateFields();

                CreationTimePicker.Value     = decFile.CreationDate;
                ModificationDatePicker.Value = decFile.ModificationDate;
            }
            else
            {
                MessageBox.Show("Error opening file!");
            }
        }
示例#6
0
 protected bool DoPanelHeader(MaterialPanel panel)
 {
     if (GUILayout.Button(panel.Label, TMP_UIStyleManager.Group_Label))
     {
         panel.ToggleExpanded();
     }
     return(panel.Expanded);
 }
示例#7
0
        public void Open(object caller, string who)
        {
            switch (who)
            {
            case "lecture":
                var calling = new LecturesPanel(Connector.connections[0].GetCourse(courses[panel1.Controls.IndexOf((CourseDataPanel)caller)].ID).ID, "course", this)
                {
                    Anchor = AnchorStyles.Top | AnchorStyles.Bottom
                };
                calling.Size = this.Size;
                this.Controls.Add(calling);
                calling.BringToFront();
                break;

            case "section":
                var calling1 = new SectionsPanel(Connector.connections[0].GetCourse(courses[panel1.Controls.IndexOf((CourseDataPanel)caller)].ID).ID, "course", this)
                {
                    Anchor = AnchorStyles.Top | AnchorStyles.Bottom
                };
                calling1.Size = this.Size;
                this.Controls.Add(calling1);
                calling1.BringToFront();
                break;

            case "book":
                var calling2 = new BooksPanel(Connector.connections[0].GetCourse(courses[panel1.Controls.IndexOf((CourseDataPanel)caller)].ID).ID, "course", this)
                {
                    Anchor = AnchorStyles.Top | AnchorStyles.Bottom
                };
                calling2.Size = this.Size;
                this.Controls.Add(calling2);
                calling2.BringToFront();
                break;

            case "instructor":
                var calling3 = new InstructorPanel(Connector.connections[0].GetCourse(courses[panel1.Controls.IndexOf((CourseDataPanel)caller)].ID).ID, "course", this)
                {
                    Anchor = AnchorStyles.Top | AnchorStyles.Bottom
                };
                calling3.Size = this.Size;
                this.Controls.Add(calling3);
                calling3.BringToFront();
                break;

            case "material":
                var calling4 = new MaterialPanel(Connector.connections[0].GetCourse(courses[panel1.Controls.IndexOf((CourseDataPanel)caller)].ID).ID, "course", this)
                {
                    Anchor = AnchorStyles.Top | AnchorStyles.Bottom
                };
                calling4.Size = this.Size;
                this.Controls.Add(calling4);
                calling4.BringToFront();
                break;
            }
        }
示例#8
0
        static TMP_SDFShaderGUI()
        {
            facePanel     = new MaterialPanel("Face", true);
            outlinePanel  = new MaterialPanel("Outline", true);
            underlayPanel = new MaterialPanel("Underlay", false);
            bevelPanel    = new MaterialPanel("Bevel", false);
            lightingPanel = new MaterialPanel("Lighting", false);
            bumpMapPanel  = new MaterialPanel("BumpMap", false);
            envMapPanel   = new MaterialPanel("EnvMap", false);
            glowPanel     = new MaterialPanel("Glow", false);
            debugPanel    = new MaterialPanel("Debug", false);

            outlineFeature = new ShaderFeature()
            {
                undoLabel = "Outline",
                keywords  = new string[] { "OUTLINE_ON" }
            };

            underlayFeature = new ShaderFeature()
            {
                undoLabel     = "Underlay",
                keywords      = new string[] { "UNDERLAY_ON", "UNDERLAY_INNER" },
                label         = new GUIContent("Underlay Type"),
                keywordLabels = new GUIContent[] {
                    new GUIContent("None"), new GUIContent("Normal"), new GUIContent("Inner")
                }
            };

            bevelFeature = new ShaderFeature()
            {
                undoLabel = "Bevel",
                keywords  = new string[] { "BEVEL_ON" }
            };

            glowFeature = new ShaderFeature()
            {
                undoLabel = "Glow",
                keywords  = new string[] { "GLOW_ON" }
            };

            maskFeature = new ShaderFeature()
            {
                undoLabel     = "Mask",
                keywords      = new string[] { "MASK_HARD", "MASK_SOFT" },
                label         = new GUIContent("Mask"),
                keywordLabels = new GUIContent[] {
                    new GUIContent("Mask Off"), new GUIContent("Mask Hard"), new GUIContent("Mask Soft")
                }
            };
        }
示例#9
0
        private MaterialPanel Add(int code, string name, float?conductivity, float?magneticPermeability, float?dielectricConstant, Action <Cell> cellClickHandler)
        {
            var codeCell                 = Cell.Factory.CreateUnique(_cellPrefab, code, _codes, cellClickHandler);
            var nameCell                 = Cell.Factory.Create(_cellPrefab, name, true, _names, cellClickHandler);
            var conductivityCell         = Cell.Factory.Create(_cellPrefab, conductivity, _conductivities, cellClickHandler);
            var magneticPermeabilityCell = Cell.Factory.Create(_cellPrefab, magneticPermeability, _magneticPermeabilities, cellClickHandler);
            var dielectricConstantCell   = Cell.Factory.Create(_cellPrefab, dielectricConstant, _dielectricConstants, cellClickHandler);

            var panel = new MaterialPanel(codeCell, nameCell, conductivityCell, magneticPermeabilityCell, dielectricConstantCell);

            _materialPanels.Add(panel);

            AddPanelToColumns(panel);

            Added.Invoke(panel);

            return(panel);
        }
示例#10
0
        private Control Editor(Vec2i outputSize, string fileName,
                               MaterialPanel <TexturedVertex> panel)
        {
            var worley = SignalEditor.Worley("Worley",
                                             WorleyNoiseKind.F1, ControlPointKind.Random,
                                             10, 0, DistanceKind.Euclidean, 0f, true);
            var transform = worley.Transform("Transform", -30f, 0.5f);
            var dv        = new Vec2(1f) / new Vec2(outputSize.X, outputSize.Y);
            var perlin    = SignalEditor.Perlin("Perlin", new Vec2(10f));
            var spectral  = perlin.SpectralControl("Spectral", 0, 2, null, 1f, 0.5f, 0.2f);
            var warp      = transform.Warp("Warp", spectral, 0.1f, dv, _heightMap);
            var signal    = warp.Colorize("Signal", ColorMap <Vec3> .GrayScale(), _diffuseMap);
            var normal    = warp.NormalMap("Normal", 1f, dv, _normalMap);

            return(SignalEditor.EditorUI(fileName, outputSize,
                                         React.By((Texture tex) => panel.Texture = tex),
                                         _updater, normal, signal));
        }
示例#11
0
 void Initialize()
 {
     newcoursepanel = new CoursePanel()
     {
         Size = mainpl.Size, Dock = DockStyle.Fill
     };
     mainpl.Controls.Add(newcoursepanel);
     newinstructorpanel = new InstructorPanel()
     {
         Size = mainpl.Size, Dock = DockStyle.Fill
     };
     mainpl.Controls.Add(newinstructorpanel);
     newmaterialpanel = new MaterialPanel()
     {
         Size = mainpl.Size, Dock = DockStyle.Fill
     };
     mainpl.Controls.Add(newmaterialpanel);
     newlecturepanel = new LecturesPanel()
     {
         Size = mainpl.Size, Dock = DockStyle.Fill
     };
     mainpl.Controls.Add(newlecturepanel);
     newsectionpanel = new SectionsPanel()
     {
         Size = mainpl.Size, Dock = DockStyle.Fill
     };
     mainpl.Controls.Add(newsectionpanel);
     newbookpanel = new BooksPanel()
     {
         Size = mainpl.Size, Dock = DockStyle.Fill
     };
     mainpl.Controls.Add(newbookpanel);
     newabout = new About()
     {
         Size = mainpl.Size, Dock = DockStyle.Fill
     };
     mainpl.Controls.Add(newabout);
 }
 private void InitializeComponent()
 {
     System.Drawing.Drawing2D.GraphicsPath graphicsPath2 = new System.Drawing.Drawing2D.GraphicsPath();
     this.SettingsDrawer      = new MaterialWinforms.Controls.MaterialSideDrawer();
     this.SettingsDrawerItems = new MaterialWinforms.Controls.MaterialContextMenuStrip();
     this.pnl_SettingsView    = new MaterialWinforms.Controls.MaterialPanel();
     this.SuspendLayout();
     //
     // SettingsDrawer
     //
     this.SettingsDrawer.AutoScroll               = true;
     this.SettingsDrawer.Depth                    = 0;
     this.SettingsDrawer.Dock                     = System.Windows.Forms.DockStyle.Fill;
     this.SettingsDrawer.Elevation                = 10;
     this.SettingsDrawer.HiddenOnStart            = true;
     this.SettingsDrawer.HideSideDrawer           = false;
     this.SettingsDrawer.Location                 = new System.Drawing.Point(0, 24);
     this.SettingsDrawer.MaximumSize              = new System.Drawing.Size(210, 10000);
     this.SettingsDrawer.MouseState               = MaterialWinforms.MouseState.HOVER;
     this.SettingsDrawer.Name                     = "SettingsDrawer";
     this.SettingsDrawer.SelectOnClick            = true;
     graphicsPath2.FillMode                       = System.Drawing.Drawing2D.FillMode.Alternate;
     this.SettingsDrawer.ShadowBorder             = graphicsPath2;
     this.SettingsDrawer.SideDrawer               = this.SettingsDrawerItems;
     this.SettingsDrawer.SideDrawerFixiert        = true;
     this.SettingsDrawer.SideDrawerUnterActionBar = false;
     this.SettingsDrawer.Size                     = new System.Drawing.Size(210, 717);
     this.SettingsDrawer.TabIndex                 = 0;
     this.SettingsDrawer.onSideDrawerItemClicked += new MaterialWinforms.Controls.MaterialSideDrawer.SideDrawerEventHandler(this.SettingsDrawer_onSideDrawerItemClicked);
     //
     // SettingsDrawerItems
     //
     this.SettingsDrawerItems.BackColor  = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(42)))), ((int)(((byte)(42)))));
     this.SettingsDrawerItems.Depth      = 0;
     this.SettingsDrawerItems.MouseState = MaterialWinforms.MouseState.HOVER;
     this.SettingsDrawerItems.Name       = "materialContextMenuStrip1";
     this.SettingsDrawerItems.Size       = new System.Drawing.Size(61, 4);
     //
     // pnl_SettingsView
     //
     this.pnl_SettingsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                           | System.Windows.Forms.AnchorStyles.Left)
                                                                          | System.Windows.Forms.AnchorStyles.Right)));
     this.pnl_SettingsView.AutoScroll = true;
     this.pnl_SettingsView.Depth      = 0;
     this.pnl_SettingsView.Location   = new System.Drawing.Point(218, 33);
     this.pnl_SettingsView.MouseState = MaterialWinforms.MouseState.HOVER;
     this.pnl_SettingsView.Name       = "pnl_SettingsView";
     this.pnl_SettingsView.Size       = new System.Drawing.Size(522, 705);
     this.pnl_SettingsView.TabIndex   = 2;
     //
     // MaterialSettings
     //
     this.ClientSize = new System.Drawing.Size(743, 741);
     this.Controls.Add(this.SettingsDrawer);
     this.Controls.Add(this.pnl_SettingsView);
     this.Name          = "MaterialSettings";
     this.ShowIcon      = false;
     this.ShowInTaskbar = false;
     this.SideDrawer    = this.SettingsDrawer;
     this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text          = "Settings";
     this.ResumeLayout(false);
 }