private void RenderTexture(BFRES.Mesh m = null, BRTI tex = null, FTEX ftex = null)
        {
            Texture     = tex;
            FTEXTexture = ftex;
            mesh        = m;
            mat         = mesh.material;

            foreach (BFRES.MatTexture te in mat.textures)
            {
                if (tex != null)
                {
                    if (te.Name == tex.Text)
                    {
                        Mattex = te;
                        comboBox1.SelectedIndex = te.wrapModeS;
                        comboBox2.SelectedIndex = te.wrapModeT;
                    }
                }
                if (ftex != null)
                {
                    if (te.Name == ftex.Text)
                    {
                        Mattex = te;
                        comboBox1.SelectedIndex = te.wrapModeS;
                        comboBox2.SelectedIndex = te.wrapModeT;
                    }
                }
            }
        }
예제 #2
0
        private void SetTexturePanel(Bitmap bmp, BFRES.MatTexture texure)
        {
            Panel      panel     = new Panel();
            PictureBox picbox    = new PictureBox();
            Button     PanelHide = new Button();
            Button     ChangeTex = new Button();

            PanelHide.Text = "Hide " + texure.Name;
            ChangeTex.Text = "Change Texture";

            picbox.Image = bmp;


            panel.Location     = new System.Drawing.Point(7, TexPanelHeight);
            PanelHide.Location = new System.Drawing.Point(7, TexPanelHeight - 27);
            panel.Size         = new Size(360, 142);
            picbox.Size        = new Size(137, 137);
            PanelHide.Size     = new Size(360, 22);

            picbox.SizeMode = PictureBoxSizeMode.StretchImage;

            PanelHide.Click += new System.EventHandler(panelHide_Click);
            picbox.Click    += new System.EventHandler(TextureBoxClickedOn);
            ChangeTex.Click += new System.EventHandler(ChangeTexClickedOn);

            Label TextueType  = new Label();
            Label SamplerText = new Label();

            ChangeTex.Location   = new System.Drawing.Point(144, 3);
            TextueType.Location  = new System.Drawing.Point(144, 66);
            SamplerText.Location = new System.Drawing.Point(144, 88);

            ChangeTex.Size = new Size(150, 26);


            TextueType.Text  = $"Type = {texure.Type.ToString()}";
            SamplerText.Text = $"Sampler = {texure.SamplerName}";

            if (texure.FragShaderSampler != "")
            {
                SamplerText.Text = $"Sampler = {texure.FragShaderSampler}";
            }

            TexPanelHeight = TexPanelHeight + 170;

            panel.Controls.Add(picbox);
            panel.Controls.Add(TextueType);
            panel.Controls.Add(SamplerText);
            panel.Controls.Add(ChangeTex);

            tabTextureMaps.Controls.Add(panel);
            tabTextureMaps.Controls.Add(PanelHide);
        }
예제 #3
0
        public static void SetSwitchMaterial(this BFRES.MaterialData mat, Material m)
        {
            //Now use that to setup the new values
            mat.IsVisable = (int)m.Flags;
            mat.Name      = m.Name;

            int CurTex = 0;

            foreach (TextureRef texture in m.TextureRefs)
            {
                BFRES.MatTexture tex = new BFRES.MatTexture();
                texture.Name = texture.Name;
                mat.textures.Add(tex);

                tex.BorderColorType = m.Samplers[CurTex].BorderColorType;
                tex.CompareFunc     = m.Samplers[CurTex].CompareFunc;
                tex.FilterMode      = m.Samplers[CurTex].FilterMode;
                tex.LODBias         = m.Samplers[CurTex].LODBias;
                tex.MaxAnisotropic  = m.Samplers[CurTex].MaxAnisotropic;
                tex.magFilter       = (int)m.Samplers[CurTex].MaxLOD;
                tex.minFilter       = (int)m.Samplers[CurTex].MinLOD;
                tex.wrapModeS       = (int)m.Samplers[CurTex].WrapModeU;
                tex.wrapModeT       = (int)m.Samplers[CurTex].WrapModeV;
                tex.wrapModeW       = (int)m.Samplers[CurTex].WrapModeW;
                tex.SamplerName     = m.SamplerDict.GetKey(CurTex);
                CurTex++;
            }
            foreach (RenderInfo renderinfo in m.RenderInfos)
            {
                BFRES.RenderInfoData rnd = new BFRES.RenderInfoData();
                rnd.Name = renderinfo.Name;

                if (renderinfo.Type == RenderInfoType.Int32)
                {
                    rnd.Value_Ints = renderinfo.GetValueInt32s();
                }
                if (renderinfo.Type == RenderInfoType.Single)
                {
                    rnd.Value_Floats = renderinfo.GetValueSingles();
                }
                if (renderinfo.Type == RenderInfoType.String)
                {
                    rnd.Value_Strings = renderinfo.GetValueStrings();
                }
            }
        }
예제 #4
0
        private void RenderTexture(BFRES.Mesh m, Texture texture, string texName)
        {
            this.texture = texture;
            mesh         = m;
            mat          = mesh.material;

            foreach (BFRES.MatTexture te in mat.textures)
            {
                if (this.texture != null)
                {
                    if (te.Name == texName)
                    {
                        mattex = te;
                        comboBox1.SelectedIndex = te.wrapModeS;
                        comboBox2.SelectedIndex = te.wrapModeT;
                    }
                }
            }
        }