Example #1
0
 private void LoadImage()
 {
     Thread = new Thread((ThreadStart)(() =>
     {
         pictureBoxCustom1.Image = Imaging.GetLoadingImage();
         pictureBoxCustom1.Image = textureData.GetBitmap(CurMipDisplayLevel, CurArrayDisplayLevel);;
     }));
     Thread.Start();
 }
        private void DisplayTexture(TextureData texData)
        {
            if (Thread != null && Thread.IsAlive)
            {
                Thread.Abort();
            }


            Thread = new Thread((ThreadStart)(() =>
            {
                pictureBoxCustom1.Image = Switch_Toolbox.Library.Imaging.GetLoadingImage();
                pictureBoxCustom1.Image = texData.GetBitmap();
                //  texSizeMipsLabel.Text = $"Width = {pictureBoxCustom1.Image.Width} Height = {pictureBoxCustom1.Image.Height}";
            }));
            Thread.Start();
        }
Example #3
0
        public void InitializeTextureListView(FMAT material)
        {
            textureRefListView.Items.Clear();
            textureRefListView.SmallImageList = textureImageList;
            textureRefListView.FullRowSelect  = true;

            foreach (MatTexture tex in material.TextureMaps)
            {
                ListViewItem item = new ListViewItem();
                item.Text = tex.Name;
                item.SubItems.Add(tex.SamplerName);

                if (material.shaderassign.samplers.ContainsValue(tex.SamplerName))
                {
                    var FragSampler = material.shaderassign.samplers.FirstOrDefault(x => x.Value == tex.SamplerName).Key;
                    item.SubItems.Add(FragSampler.ToString());
                }

                textureRefListView.Items.Add(item);
            }

            textureImageList.Images.Clear();

            int CurTex = 0;

            if (PluginRuntime.bntxContainers.Count == 0 &&
                PluginRuntime.ftexContainers.Count == 0)
            {
                foreach (ListViewItem item in textureRefListView.Items)
                {
                    AddBlankTexture(item, item.Text, CurTex++);
                }
            }
            bool FoundTexture = false;

            foreach (ListViewItem item in textureRefListView.Items)
            {
                foreach (BNTX bntx in PluginRuntime.bntxContainers)
                {
                    if (bntx.Textures.ContainsKey(item.Text))
                    {
                        FoundTexture = true;

                        TextureData tex  = bntx.Textures[item.Text];
                        Bitmap      temp = tex.GetBitmap();

                        textureImageList.Images.Add(tex.Text, temp);

                        item.ImageIndex = CurTex++;

                        var dummy = textureImageList.Handle;
                        temp.Dispose();
                    }
                }
                foreach (FTEXContainer ftexCont in PluginRuntime.ftexContainers)
                {
                    if (ftexCont.Textures.ContainsKey(item.Text))
                    {
                        FoundTexture = true;

                        FTEX   tex  = ftexCont.Textures[item.Text];
                        Bitmap temp = tex.GetBitmap();

                        textureImageList.Images.Add(tex.Text, temp);

                        item.ImageIndex = CurTex++;

                        var dummy = textureImageList.Handle;
                        temp.Dispose();
                    }
                }
                if (FoundTexture == false)
                {
                    AddBlankTexture(item, item.Text, CurTex++);
                }
            }
        }