Пример #1
0
        public TexSrtPanel(TexSrt TexSrt, BfresShaderParam param)
        {
            InitializeComponent();

            isTexSrtEx  = false;
            activeParam = param;
            stTextBox1.Bind(activeParam, "Name");

            scalingModeCN.Bind(typeof(TexSrtMode), TexSrt, "Mode");
            scalingModeCN.SelectedItem = TexSrt.Mode;

            scaXUD.DataType   = typeof(float);
            scaYUD.DataType   = typeof(float);
            rotXUD.DataType   = typeof(float);
            transXUD.DataType = typeof(float);
            transYUD.DataType = typeof(float);

            scaXUD.Value = TexSrt.Scaling.X;
            scaYUD.Value = TexSrt.Scaling.Y;

            rotXUD.Value = TexSrt.Rotation;

            transXUD.Value = TexSrt.Translation.X;
            transYUD.Value = TexSrt.Translation.Y;
        }
Пример #2
0
        public static void ReadShaderParams(this FMAT m, Material mat)
        {
            m.matparam.Clear();

            if (mat.ShaderParamData == null)
            {
                return;
            }

            using (FileReader reader = new FileReader(new System.IO.MemoryStream(mat.ShaderParamData)))
            {
                reader.ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;
                foreach (ShaderParam param in mat.ShaderParams.Values)
                {
                    BfresShaderParam shaderParam = new BfresShaderParam();
                    shaderParam.Type          = shaderParam.GetTypeWiiU(param.Type);
                    shaderParam.Name          = param.Name;
                    shaderParam.HasPadding    = param.UsePadding;
                    shaderParam.PaddingLength = param.PaddingLength;

                    reader.Seek(param.DataOffset, System.IO.SeekOrigin.Begin);
                    shaderParam.ReadValue(reader, (int)param.DataSize);

                    m.matparam.Add(param.Name, shaderParam);
                }
                reader.Close();
            }
        }
Пример #3
0
        public void LoadDropPanel(ParamValueEditorBase control, BfresShaderParam param)
        {
            STDropDownPanel panel = new STDropDownPanel();

            panel.SuspendLayout();
            panel.PanelName      = param.Name;
            panel.PanelValueName = GetValueString(param);
            panel.Controls.Add(control);
            panel.Height     = control.Height;
            panel.IsExpanded = false;

            control.BackColor = FormThemes.BaseTheme.DropdownPanelBackColor;
            control.Anchor    = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left;
            control.Width     = panel.Width;
            control.LoadAction(OnValueChanged); //To update value test

            if (control is vector4SliderPanel)
            {
                panel.SetIconColor = ((vector4SliderPanel)control).GetColor();
            }
            if (control is vector4SliderPanel)
            {
                panel.SetIconAlphaColor = ((vector4SliderPanel)control).GetAlphaColor();
            }
            if (control is vector3SliderPanel)
            {
                panel.SetIconColor = ((vector3SliderPanel)control).GetColor();
            }

            panel.ResumeLayout();

            stFlowLayoutPanel1.Controls.Add(panel);
        }
Пример #4
0
        public void SetColorBox(BfresShaderParam param)
        {
            Vector4 color = new Vector4();

            switch (param.Type)
            {
            case ShaderParamType.Float3:
                color = new Vector4(param.ValueFloat[0], param.ValueFloat[1], param.ValueFloat[2], 1);
                break;

            case ShaderParamType.Float4:
                color = new Vector4(param.ValueFloat[0], param.ValueFloat[1], param.ValueFloat[2], param.ValueFloat[3]);
                break;
            }

            int someIntX = (int)Math.Ceiling(color.X * 255);
            int someIntY = (int)Math.Ceiling(color.Y * 255);
            int someIntZ = (int)Math.Ceiling(color.Z * 255);
            int someIntW = (int)Math.Ceiling(color.W * 255);

            if (someIntX <= 255 && someIntY <= 255 && someIntZ <= 255 && someIntW <= 255)
            {
                pictureBox1.BackColor = Color.FromArgb(
                    someIntW,
                    someIntX,
                    someIntY,
                    someIntZ
                    );
            }
        }
        public static void ReadShaderParams(this FMAT m, Material mat)
        {
            m.matparam.Clear();

            if (mat.ShaderParamData == null)
            {
                return;
            }

            using (FileReader reader = new FileReader(new System.IO.MemoryStream(mat.ShaderParamData)))
            {
                reader.ByteOrder = Syroot.BinaryData.ByteOrder.LittleEndian;
                foreach (ShaderParam param in mat.ShaderParams)
                {
                    BfresShaderParam shaderParam = new BfresShaderParam();
                    shaderParam.Type          = param.Type;
                    shaderParam.Name          = param.Name;
                    shaderParam.DependedIndex = param.DependedIndex;
                    shaderParam.DependIndex   = param.DependIndex;

                    reader.Seek(param.DataOffset, System.IO.SeekOrigin.Begin);
                    shaderParam.ReadValue(reader, (int)param.DataSize);

                    m.matparam.Add(param.Name, shaderParam);
                }
                reader.Close();
            }
        }
Пример #6
0
        public void SetValues(BfresShaderParam param)
        {
            switch (param.Type)
            {
            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Float:
                param.ValueFloat = new float[] { (float)ValueUD1.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Float2:
                param.ValueFloat = new float[] { (float)ValueUD1.Value, (float)ValueUD2.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Float3:
                param.ValueFloat = new float[] { (float)ValueUD1.Value, (float)ValueUD2.Value,
                                                 (float)ValueUD3.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Float4:
                param.ValueFloat = new float[] { (float)ValueUD1.Value, (float)ValueUD2.Value,
                                                 (float)ValueUD3.Value, (float)ValueUD4.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.UInt:
                param.ValueUint = new uint[] { (uint)ValueUD1.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.UInt2:
                param.ValueUint = new uint[] { (uint)ValueUD1.Value, (uint)ValueUD2.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.UInt3:
                param.ValueUint = new uint[] { (uint)ValueUD1.Value, (uint)ValueUD2.Value,
                                               (uint)ValueUD3.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.UInt4:
                param.ValueUint = new uint[] { (uint)ValueUD1.Value, (uint)ValueUD2.Value,
                                               (uint)ValueUD3.Value, (uint)ValueUD4.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Int:
                param.ValueInt = new int[] { (int)ValueUD1.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Int2:
                param.ValueInt = new int[] { (int)ValueUD1.Value, (int)ValueUD2.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Int3:
                param.ValueInt = new int[] { (int)ValueUD1.Value, (int)ValueUD2.Value,
                                             (int)ValueUD3.Value };
                break;

            case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Int4:
                param.ValueInt = new int[] { (int)ValueUD1.Value, (int)ValueUD2.Value,
                                             (int)ValueUD3.Value, (int)ValueUD4.Value };
                break;
            }
        }
Пример #7
0
        private void ShaderParamToListItem(BfresShaderParam prm, ListViewItem item)
        {
            item.SubItems.Clear();
            item.Text = prm.Name;

            string DisplayValue = "";

            switch (prm.Type)
            {
            case ShaderParamType.Int:
            case ShaderParamType.Int2:
            case ShaderParamType.Int3:
            case ShaderParamType.Int4:
                DisplayValue = SetValueToString(prm.ValueInt);
                break;

            case ShaderParamType.UInt:
            case ShaderParamType.UInt2:
            case ShaderParamType.UInt3:
            case ShaderParamType.UInt4:
                DisplayValue = SetValueToString(prm.ValueUint);
                break;

            case ShaderParamType.Float:
            case ShaderParamType.Float2:
            case ShaderParamType.Float2x2:
            case ShaderParamType.Float2x3:
            case ShaderParamType.Float2x4:
            case ShaderParamType.Float3x2:
            case ShaderParamType.Float3x3:
            case ShaderParamType.Float3x4:
            case ShaderParamType.Float4x2:
            case ShaderParamType.Float4x3:
            case ShaderParamType.Float4x4:
                DisplayValue = SetValueToString(prm.ValueFloat);
                break;

            case ShaderParamType.Float3:
                DisplayValue = SetValueToString(prm.ValueFloat);
                break;

            case ShaderParamType.Float4:
                DisplayValue = SetValueToString(prm.ValueFloat);
                break;

            case ShaderParamType.TexSrt:
                DisplayValue = SetValueToString(prm.ValueTexSrt);
                break;

            case ShaderParamType.TexSrtEx:
                DisplayValue = SetValueToString(prm.ValueTexSrtEx);
                break;
            }

            item.UseItemStyleForSubItems = false;
            item.SubItems.Add(DisplayValue);
            item.SubItems.Add("");
            item.SubItems[2].BackColor = GetColor(prm);
        }
Пример #8
0
        public vector1SliderPanel(float[] values, BfresShaderParam param)
        {
            activeParam = param;
            InitializeComponent();
            barSlider1.DataType = typeof(float);

            barSlider1.Value = values[0];
        }
Пример #9
0
 public void GetValues(BfresShaderParam param)
 {
     switch (param.Type)
     {
     case Syroot.NintenTools.NSW.Bfres.ShaderParamType.Float:
         param.ValueFloat = new float[] { (float)ValueUD1.Value };
         break;
     }
 }
        public vector1SliderPanel(float[] values, BfresShaderParam param)
        {
            InitializeComponent();

            activeParam = param;
            stTextBox1.Bind(activeParam, "Name");
            barSlider1.DataType = typeof(float);

            barSlider1.Value = values[0];
        }
Пример #11
0
        public vector2SliderPanel(uint[] values, BfresShaderParam param)
        {
            activeParam = param;

            InitializeComponent();
            barSlider1.DataType = typeof(uint);
            barSlider2.DataType = typeof(uint);

            barSlider1.Value = values[0];
            barSlider2.Value = values[1];
        }
Пример #12
0
        private static void WriteSrt3DParamNode(XmlDocument doc, BfresShaderParam param, XmlNode node)
        {
            XmlNode ParamNode = doc.CreateElement(param.Name);

            AddAttribute(doc, "Scaling", param.ValueSrt3D.Scaling.ToString(), ParamNode);
            AddAttribute(doc, "Rotation", param.ValueSrt3D.Rotation.ToString(), ParamNode);
            AddAttribute(doc, "Translation", param.ValueSrt3D.Translation.ToString(), ParamNode);
            AddAttribute(doc, "Format", ShaderParamType.Srt3D.ToString(), ParamNode);
            AddAttribute(doc, "DependedIndex", param.DependedIndex.ToString(), ParamNode);
            AddAttribute(doc, "DependIndex", param.DependIndex.ToString(), ParamNode);
            node.AppendChild(ParamNode);
        }
Пример #13
0
        public vector3SliderPanel(string UniformName, uint[] values, BfresShaderParam param)
        {
            activeParam = param;

            InitializeComponent();
            barSlider1.DataType = typeof(uint);
            barSlider2.DataType = typeof(int);
            barSlider3.DataType = typeof(int);

            barSlider1.Value = values[0];
            barSlider2.Value = values[1];
            barSlider3.Value = values[2];
        }
Пример #14
0
        public void LoadDialogDropPanel(ParamValueDialog control, BfresShaderParam param)
        {
            ParamValueEditorBase panel = new ParamValueEditorBase();

            switch (param.Type)
            {
            case ShaderParamType.Float: panel = new vector1SliderPanel(param.ValueFloat, param); break;

            case ShaderParamType.Float2: panel = new vector2SliderPanel(param.ValueFloat, param); break;

            case ShaderParamType.Float3: panel = new vector3SliderPanel(param.Name, param.ValueFloat, param); break;

            case ShaderParamType.Float4: panel = new vector4SliderPanel(param.Name, param.ValueFloat, param); break;

            case ShaderParamType.Int: panel = new vector1SliderPanel(param.ValueInt, param); break;

            case ShaderParamType.Int2: panel = new vector2SliderPanel(param.ValueInt, param); break;

            case ShaderParamType.Int3: panel = new vector3SliderPanel(param.Name, param.ValueInt, param); break;

            case ShaderParamType.Int4: panel = new vector4SliderPanel(param.Name, param.ValueInt, param); break;

            case ShaderParamType.UInt: panel = new vector1SliderPanel(param.ValueUint, param); break;

            case ShaderParamType.UInt2: panel = new vector2SliderPanel(param.ValueUint, param); break;

            case ShaderParamType.UInt3: panel = new vector3SliderPanel(param.Name, param.ValueUint, param); break;

            case ShaderParamType.UInt4: panel = new vector4SliderPanel(param.Name, param.ValueUint, param); break;

            case ShaderParamType.TexSrt: panel = new TexSrtPanel(param.ValueTexSrt, param); break;

            case ShaderParamType.TexSrtEx: panel = new TexSrtPanel(param.ValueTexSrtEx, param); break;

            case ShaderParamType.Srt2D: panel = new TexSrtPanel2D(param.ValueSrt2D, param); break;

            case ShaderParamType.Bool: panel = new booleanPanel(param.ValueBool, param); break;

            case ShaderParamType.Bool2: panel = new booleanPanel(param.ValueBool, param); break;

            case ShaderParamType.Bool3: panel = new booleanPanel(param.ValueBool, param); break;

            case ShaderParamType.Bool4: panel = new booleanPanel(param.ValueBool, param); break;
            }
            control.Width     = panel.Width;
            control.Height    = panel.Height + 70;
            control.CanResize = false;
            control.BackColor = FormThemes.BaseTheme.DropdownPanelBackColor;
            control.AddControl(panel);
        }
Пример #15
0
        public vector3SliderPanel(string UniformName, int[] values, BfresShaderParam param)
        {
            InitializeComponent();

            activeParam = param;
            stTextBox1.Bind(activeParam, "Name");

            barSlider1.DataType = typeof(int);
            barSlider2.DataType = typeof(int);
            barSlider3.DataType = typeof(int);

            barSlider1.Value = values[0];
            barSlider2.Value = values[1];
            barSlider3.Value = values[2];
        }
Пример #16
0
        public bool OnValueChanged(BfresShaderParam param, UserControl sender)
        {
            if (param == null || sender.Parent == null)
            {
                return(false);
            }

            STDropDownPanel panel = (STDropDownPanel)sender.Parent;

            panel.PanelValueName = GetValueString(param);


            panel.Refresh();

            return(true);
        }
Пример #17
0
        public vector4SliderPanel(string UniformName, float[] values, BfresShaderParam param)
        {
            activeParam = param;

            InitializeComponent();

            barSlider1.DataType = typeof(float);
            barSlider2.DataType = typeof(float);
            barSlider3.DataType = typeof(float);
            barSlider4.DataType = typeof(float);

            barSlider1.Value = values[0];
            barSlider2.Value = values[1];
            barSlider3.Value = values[2];
            barSlider4.Value = values[3];

            SetColor(UniformName, values);
        }
Пример #18
0
        public void SetValues(BfresShaderParam param)
        {
            switch (param.Type)
            {
            case ShaderParamType.TexSrt:
                param.ValueTexSrt.Scaling.X     = (float)scaleUDX.Value;
                param.ValueTexSrt.Scaling.Y     = (float)scaleUDY.Value;
                param.ValueTexSrt.Rotation      = (float)rotUDX.Value;
                param.ValueTexSrt.Translation.X = (float)transUDX.Value;
                param.ValueTexSrt.Translation.Y = (float)transUDY.Value;
                param.ValueTexSrt.Mode          = (TexSrtMode)modeComboBox.SelectedItem;
                break;

            case ShaderParamType.TexSrtEx:
                param.ValueTexSrtEx.Scaling.X     = (float)scaleUDX.Value;
                param.ValueTexSrtEx.Scaling.Y     = (float)scaleUDY.Value;
                param.ValueTexSrtEx.Rotation      = (float)rotUDX.Value;
                param.ValueTexSrtEx.Translation.X = (float)transUDX.Value;
                param.ValueTexSrtEx.Translation.Y = (float)transUDY.Value;
                param.ValueTexSrtEx.Mode          = (TexSrtMode)modeComboBox.SelectedItem;
                param.ValueTexSrtEx.MatrixPointer = (uint)matrixPtrNumUD.Value;
                break;

            case ShaderParamType.Srt2D:
                param.ValueSrt2D.Scaling.X     = (float)scaleUDX.Value;
                param.ValueSrt2D.Scaling.Y     = (float)scaleUDY.Value;
                param.ValueSrt2D.Rotation      = (float)rotUDX.Value;
                param.ValueSrt2D.Translation.X = (float)transUDX.Value;
                param.ValueSrt2D.Translation.Y = (float)transUDY.Value;
                break;

            case ShaderParamType.Srt3D:
                param.ValueSrt3D.Scaling.X     = (float)scaleUDX.Value;
                param.ValueSrt3D.Scaling.Y     = (float)scaleUDY.Value;
                param.ValueSrt3D.Scaling.Z     = (float)scaleUDZ.Value;
                param.ValueSrt3D.Rotation.X    = (float)rotUDX.Value;
                param.ValueSrt3D.Rotation.Y    = (float)rotUDY.Value;
                param.ValueSrt3D.Rotation.Z    = (float)rotUDZ.Value;
                param.ValueSrt3D.Translation.X = (float)transUDX.Value;
                param.ValueSrt3D.Translation.Y = (float)transUDY.Value;
                param.ValueSrt3D.Translation.Z = (float)transUDZ.Value;
                break;
            }
        }
Пример #19
0
        private string GetValueString(BfresShaderParam param)
        {
            string Values = "";

            switch (param.Type)
            {
            case ShaderParamType.Float:
                Values = $"[ {RoundParam(param.ValueFloat[0])} ]";
                break;

            case ShaderParamType.Float2:
                Values = $"[ {RoundParam(param.ValueFloat[0])} ," +
                         $" {RoundParam(param.ValueFloat[1])} ]";
                break;

            case ShaderParamType.Float3:
                Values = $"[ {RoundParam(param.ValueFloat[0])} ," +
                         $" {RoundParam(param.ValueFloat[1])} ," +
                         $"  {RoundParam(param.ValueFloat[2])} ,]";
                break;

            case ShaderParamType.Float4:
                Values = $"[ {RoundParam(param.ValueFloat[0])} ," +
                         $" {RoundParam(param.ValueFloat[1])} ," +
                         $"  {RoundParam(param.ValueFloat[2])} ," +
                         $"  {RoundParam(param.ValueFloat[3])} ]";
                break;

            case ShaderParamType.TexSrt:
                Values = $"[ {param.ValueTexSrt.Mode} ," +
                         $" {RoundParam(param.ValueTexSrt.Scaling.X)} ," +
                         $" {RoundParam(param.ValueTexSrt.Scaling.Y)} ," +
                         $" {RoundParam(param.ValueTexSrt.Rotation)}, " +
                         $" {RoundParam(param.ValueTexSrt.Translation.X)}," +
                         $" {RoundParam(param.ValueTexSrt.Translation.X)} ]";
                break;
            }

            Console.WriteLine(String.Format("{0,-30} {1,-30}", param.Name, Values));

            return(Values);
        }
Пример #20
0
        public TexSrtPanel2D(Srt2D TexSrt, BfresShaderParam param)
        {
            InitializeComponent();

            activeParam = param;
            stTextBox1.Bind(activeParam, "Name");

            scaXUD.DataType   = typeof(float);
            scaYUD.DataType   = typeof(float);
            rotXUD.DataType   = typeof(float);
            transXUD.DataType = typeof(float);
            transYUD.DataType = typeof(float);

            scaXUD.Value = TexSrt.Scaling.X;
            scaYUD.Value = TexSrt.Scaling.Y;

            rotXUD.Value = TexSrt.Rotation;

            transXUD.Value = TexSrt.Translation.X;
            transYUD.Value = TexSrt.Translation.Y;
        }
Пример #21
0
        public vector4SliderPanel(string UniformName, float[] values, BfresShaderParam param)
        {
            InitializeComponent();

            activeParam = param;
            stTextBox1.Bind(activeParam, "Name");

            barSlider1.DataType = typeof(float);
            barSlider2.DataType = typeof(float);
            barSlider3.DataType = typeof(float);
            barSlider4.DataType = typeof(float);

            barSlider1.Value = values[0];
            barSlider2.Value = values[1];
            barSlider3.Value = values[2];
            barSlider4.Value = values[3];

            SetColor(UniformName, values);

            AdjustPanelHeight();
        }
Пример #22
0
        public void SetValues(BfresShaderParam param)
        {
            switch (param.Type)
            {
            case ShaderParamType.Bool:
                param.ValueBool = new bool[] { bool1.Visible };
                break;

            case ShaderParamType.Bool2:
                param.ValueBool = new bool[] { bool1.Visible, bool2.Visible };
                break;

            case ShaderParamType.Bool3:
                param.ValueBool = new bool[] { bool1.Visible, bool2.Visible,
                                               bool3.Visible };
                break;

            case ShaderParamType.Bool4:
                param.ValueBool = new bool[] { bool1.Visible, bool2.Visible,
                                               bool3.Visible, bool4.Visible };
                break;
            }
        }
Пример #23
0
        public booleanPanel(bool[] values, BfresShaderParam param)
        {
            activeParam = param;

            InitializeComponent();

            if (values.Length >= 1)
            {
                stCheckBox1.Checked = values[0];
            }
            if (values.Length >= 2)
            {
                stCheckBox1.Checked = values[1];
            }
            if (values.Length >= 3)
            {
                stCheckBox1.Checked = values[2];
            }
            if (values.Length >= 4)
            {
                stCheckBox1.Checked = values[3];
            }
        }
Пример #24
0
        private Color GetColor(BfresShaderParam prm)
        {
            Vector4 col = new Vector4();

            switch (prm.Type)
            {
            case ShaderParamType.Float3:
                col = new Vector4(prm.ValueFloat[0], prm.ValueFloat[1], prm.ValueFloat[2], 1);
                break;

            case ShaderParamType.Float4:
                col = new Vector4(prm.ValueFloat[0], prm.ValueFloat[1], prm.ValueFloat[2], prm.ValueFloat[3]);
                break;
            }

            bool IsColor = prm.Name.Contains("Color") ||
                           prm.Name.Contains("color") ||
                           prm.Name.Contains("konst0") ||
                           prm.Name.Contains("konst1") ||
                           prm.Name.Contains("konst2") ||
                           prm.Name.Contains("konst3");

            Color SetColor = FormThemes.BaseTheme.ListViewBackColor;

            if (IsColor)
            {
                SetColor = Color.FromArgb(
                    255,
                    Utils.FloatToIntClamp(col.X),
                    Utils.FloatToIntClamp(col.Y),
                    Utils.FloatToIntClamp(col.Z)
                    );
            }

            return(SetColor);
        }
Пример #25
0
        public static void ReadShaderParams(XmlDocument doc, XmlNode parentNode, FMAT mat)
        {
            mat.matparam.Clear();
            foreach (XmlNode node in parentNode.ChildNodes)
            {
                string           Value = node.Attributes[0].Value;
                BfresShaderParam param = new BfresShaderParam();
                param.Name = node.Name;
                Console.WriteLine(node.Name);

                foreach (XmlAttribute att in node.Attributes)
                {
                    Console.WriteLine(att);

                    if (att.Name == "Format")
                    {
                        string Format = att.Value;

                        ShaderParamType type;
                        if (Enum.TryParse(Format, out type))
                        {
                            param.Type = type;
                            switch (type)
                            {
                            case ShaderParamType.Bool:
                            case ShaderParamType.Bool2:
                            case ShaderParamType.Bool3:
                            case ShaderParamType.Bool4:
                                param.ValueBool = Array.ConvertAll(Value.Split(','), bool.Parse);
                                break;

                            case ShaderParamType.Float:
                            case ShaderParamType.Float2:
                            case ShaderParamType.Float3:
                            case ShaderParamType.Float4:
                            case ShaderParamType.Float2x2:
                            case ShaderParamType.Float2x3:
                            case ShaderParamType.Float2x4:
                            case ShaderParamType.Float3x2:
                            case ShaderParamType.Float3x3:
                            case ShaderParamType.Float3x4:
                            case ShaderParamType.Float4x2:
                            case ShaderParamType.Float4x3:
                            case ShaderParamType.Float4x4:
                                param.ValueFloat = Array.ConvertAll(Value.Split(','), float.Parse);
                                break;

                            case ShaderParamType.Int:
                            case ShaderParamType.Int2:
                            case ShaderParamType.Int3:
                            case ShaderParamType.Int4:
                                param.ValueInt = Array.ConvertAll(Value.Split(','), int.Parse);
                                break;

                            case ShaderParamType.Reserved2:
                            case ShaderParamType.Reserved3:
                            case ShaderParamType.Reserved4:
                                param.ValueReserved = Array.ConvertAll(Value.Split(','), byte.Parse);
                                break;

                            case ShaderParamType.Srt2D:
                                param.ValueSrt2D = SetSrt2D(node);
                                break;

                            case ShaderParamType.Srt3D:
                                param.ValueSrt3D = SetSrt3D(node);
                                break;

                            case ShaderParamType.TexSrt:
                                param.ValueTexSrt = SetTexSRT(node);
                                break;

                            case ShaderParamType.TexSrtEx:
                                param.ValueTexSrtEx = SetTexSRTEx(node);
                                break;

                            case ShaderParamType.UInt:
                            case ShaderParamType.UInt2:
                            case ShaderParamType.UInt3:
                            case ShaderParamType.UInt4:
                                param.ValueUint = Array.ConvertAll(Value.Split(','), uint.Parse);
                                break;
                            }
                        }
                    }
                }

                mat.matparam.Add(param.Name, param);
            }
        }
Пример #26
0
        public void LoadParam(BfresShaderParam param)
        {
            panel1.Controls.Clear();

            activeParam = param;
            bool IsColor = activeParam.Name.Contains("Color") || activeParam.Name.Contains("color");

            if (IsColor)
            {
                colorLabel.Visible  = true;
                pictureBox1.Visible = true;
                SetColorBox(activeParam);
            }

            comboBox1.SelectedItem = activeParam.Type;
            textBox1.Text          = activeParam.Name;
            switch (activeParam.Type)
            {
            case ShaderParamType.Bool:
            case ShaderParamType.Bool2:
            case ShaderParamType.Bool3:
            case ShaderParamType.Bool4:
                boolPanel = new BoolValuesPanel();
                boolPanel.LoadValues(activeParam.ValueBool);
                panel1.Controls.Add(boolPanel);
                break;

            case ShaderParamType.Float:
            case ShaderParamType.Float2:
            case ShaderParamType.Float3:
            case ShaderParamType.Float4:
            case ShaderParamType.Float2x2:
            case ShaderParamType.Float2x3:
            case ShaderParamType.Float2x4:
            case ShaderParamType.Float3x2:
            case ShaderParamType.Float3x3:
            case ShaderParamType.Float3x4:
            case ShaderParamType.Float4x2:
            case ShaderParamType.Float4x3:
            case ShaderParamType.Float4x4:
                FloatIntsPanel = new FloatsIntsValuePanel();
                FloatIntsPanel.LoadValues(activeParam.ValueFloat);
                panel1.Controls.Add(FloatIntsPanel);
                break;

            case ShaderParamType.Int:
            case ShaderParamType.Int2:
            case ShaderParamType.Int3:
            case ShaderParamType.Int4:
                FloatIntsPanel = new FloatsIntsValuePanel();
                FloatIntsPanel.LoadValues(activeParam.ValueInt);
                panel1.Controls.Add(FloatIntsPanel);
                break;

            case ShaderParamType.Reserved2:
            case ShaderParamType.Reserved3:
            case ShaderParamType.Reserved4:
                break;

            case ShaderParamType.Srt2D:
                SRTPanel = new SRTValuesPanel();
                SRTPanel.LoadValues(activeParam.ValueSrt2D);
                panel1.Controls.Add(SRTPanel);
                break;

            case ShaderParamType.Srt3D:
                SRTPanel = new SRTValuesPanel();
                SRTPanel.LoadValues(activeParam.ValueSrt3D);
                panel1.Controls.Add(SRTPanel);
                break;

            case ShaderParamType.TexSrt:
                SRTPanel = new SRTValuesPanel();
                SRTPanel.LoadValues(activeParam.ValueTexSrt);
                panel1.Controls.Add(SRTPanel);
                break;

            case ShaderParamType.TexSrtEx:
                SRTPanel = new SRTValuesPanel();
                SRTPanel.LoadValues(activeParam.ValueTexSrtEx);
                panel1.Controls.Add(SRTPanel);
                break;

            case ShaderParamType.UInt:
            case ShaderParamType.UInt2:
            case ShaderParamType.UInt3:
            case ShaderParamType.UInt4:
                FloatIntsPanel = new FloatsIntsValuePanel();
                FloatIntsPanel.LoadValues(activeParam.ValueUint);
                panel1.Controls.Add(FloatIntsPanel);
                break;
            }
        }
Пример #27
0
        private void LoadDropDownPanel(BfresShaderParam param)
        {
            stFlowLayoutPanel1      = new STFlowLayoutPanel();
            stFlowLayoutPanel1.Dock = DockStyle.Fill;
            stFlowLayoutPanel1.SuspendLayout();

            if (param.Type == ShaderParamType.Bool ||
                param.Type == ShaderParamType.Bool2 ||
                param.Type == ShaderParamType.Bool3 ||
                param.Type == ShaderParamType.Bool4)
            {
                booleanPanel panel = new booleanPanel(param.ValueBool, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.TexSrtEx)
            {
                TexSrtPanel panel = new TexSrtPanel(param.ValueTexSrtEx, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.TexSrt)
            {
                TexSrtPanel panel = new TexSrtPanel(param.ValueTexSrt, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.Float)
            {
                vector1SliderPanel panel = new vector1SliderPanel(param.ValueFloat, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.Float2)
            {
                vector2SliderPanel panel = new vector2SliderPanel(param.ValueFloat, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.Float3)
            {
                vector3SliderPanel panel = new vector3SliderPanel(param.Name, param.ValueFloat, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.Float4)
            {
                vector4SliderPanel panel = new vector4SliderPanel(param.Name, param.ValueFloat, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.UInt)
            {
                vector1SliderPanel panel = new vector1SliderPanel(param.ValueUint, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.UInt2)
            {
                vector2SliderPanel panel = new vector2SliderPanel(param.ValueUint, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.UInt3)
            {
                vector3SliderPanel panel = new vector3SliderPanel(param.Name, param.ValueUint, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.UInt4)
            {
                vector4SliderPanel panel = new vector4SliderPanel(param.Name, param.ValueUint, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.Int)
            {
                vector1SliderPanel panel = new vector1SliderPanel(param.ValueInt, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.Int2)
            {
                vector2SliderPanel panel = new vector2SliderPanel(param.ValueInt, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.Int3)
            {
                vector3SliderPanel panel = new vector3SliderPanel(param.Name, param.ValueInt, param);
                LoadDropPanel(panel, param);
            }
            else if (param.Type == ShaderParamType.Int4)
            {
                vector4SliderPanel panel = new vector4SliderPanel(param.Name, param.ValueInt, param);
                LoadDropPanel(panel, param);
            }

            stFlowLayoutPanel1.ResumeLayout();
        }