示例#1
0
        private void texturesListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = 0;

            if (texturesListView.SelectedItems.Count > 0)
            {
                index = texturesListView.Items.IndexOf(texturesListView.SelectedItems[0]);
                tableLayoutPanel2.Enabled = true;
                textureIDTB.Enabled       = true;
            }
            else
            {
                tableLayoutPanel2.Enabled = false;
                textureIDTB.Enabled       = false;
            }
            if (index >= currentMaterialList[currentMatIndex].textures.Count)
            {
                MessageBox.Show("Texture doesn't exist");
                return;
            }
            NUD.MatTexture tex = currentMaterialList[currentMatIndex].textures[index];
            textureIDTB.Text = tex.hash.ToString("X");

            mapModeComboBox.SelectedItem   = mapmode[tex.mapMode];
            wrapXComboBox.SelectedItem     = wrapmode[tex.wrapModeS];
            wrapYComboBox.SelectedItem     = wrapmode[tex.wrapModeT];
            minFilterComboBox.SelectedItem = minfilter[tex.minFilter];
            magFilterComboBox.SelectedItem = magfilter[tex.magFilter];
            mipDetailComboBox.SelectedItem = mip[tex.mipDetail];
            RenderTexture();
            RenderTexture(true);
        }
示例#2
0
        private void UpdateSelectedTextureControlValues(int index)
        {
            NUD.MatTexture tex = currentMaterialList[currentMatIndex].textures[index];
            textureIdTB.Text = tex.hash.ToString("X");

            mapModeComboBox.SelectedItem   = mapModeByMatValue[tex.mapMode];
            wrapXComboBox.SelectedItem     = wrapModeByMatValue[tex.wrapModeS];
            wrapYComboBox.SelectedItem     = wrapModeByMatValue[tex.wrapModeT];
            minFilterComboBox.SelectedItem = minFilterByMatValue[tex.minFilter];
            magFilterComboBox.SelectedItem = magFilterByMatValue[tex.magFilter];
            mipDetailComboBox.SelectedItem = mipDetailByMatValue[tex.mipDetail];
        }
示例#3
0
        private static void ReadTextures(NUD.Material material, XmlNode textureNode)
        {
            if (!(textureNode.Name.Equals("texture")))
            {
                return;
            }

            NUD.MatTexture matTexture = new NUD.MatTexture();
            material.textures.Add(matTexture);

            foreach (XmlAttribute attribute in textureNode.Attributes)
            {
                switch (attribute.Name)
                {
                case "hash":
                    int.TryParse(attribute.Value, NumberStyles.HexNumber, null, out matTexture.hash);
                    break;

                case "wrapmodeS":
                    int.TryParse(attribute.Value, out matTexture.wrapModeS);
                    break;

                case "wrapmodeT":
                    int.TryParse(attribute.Value, out matTexture.wrapModeT);
                    break;

                case "minfilter":
                    int.TryParse(attribute.Value, out matTexture.minFilter);
                    break;

                case "magfilter":
                    int.TryParse(attribute.Value, out matTexture.magFilter);
                    break;

                case "mipdetail":
                    int.TryParse(attribute.Value, out matTexture.mipDetail);
                    break;
                }
            }
        }