コード例 #1
0
ファイル: Header.cs プロジェクト: setccccc/Switch-Toolbox
        public override short AddMaterial(BxlytMaterial material)
        {
            if (material == null)
            {
                return(-1);
            }

            if (!MaterialList.Materials.Contains(material))
            {
                MaterialList.Materials.Add(material);
            }

            if (material.NodeWrapper == null)
            {
                material.NodeWrapper = new MatWrapper(material.Name)
                {
                    Tag              = material,
                    ImageKey         = "material",
                    SelectedImageKey = "material",
                }
            }
            ;

            if (!MaterialFolder.Nodes.Contains(material.NodeWrapper))
            {
                MaterialFolder.Nodes.Add(material.NodeWrapper);
            }

            return((short)MaterialList.Materials.IndexOf(material));
        }
コード例 #2
0
ファイル: Header.cs プロジェクト: setccccc/Switch-Toolbox
        public override short AddMaterial(BxlytMaterial material, ushort index)
        {
            if (material == null)
            {
                return(-1);
            }

            if (MaterialList.Materials.Count > index)
            {
                MaterialList.Materials.Insert(index, (Material)material);
            }
            else
            {
                MaterialList.Materials.Add((Material)material);
            }

            if (material.NodeWrapper == null)
            {
                material.NodeWrapper = new MatWrapper(material.Name)
                {
                    Tag              = material,
                    ImageKey         = "material",
                    SelectedImageKey = "material",
                }
            }
            ;

            MaterialFolder.Nodes.Insert(index, material.NodeWrapper);

            return((short)MaterialList.Materials.IndexOf((Material)material));
        }
コード例 #3
0
        public PIC1(FileReader reader, Header header) : base(reader, header)
        {
            ParentLayout = header;

            ColorTopLeft     = reader.ReadColor8RGBA();
            ColorTopRight    = reader.ReadColor8RGBA();
            ColorBottomLeft  = reader.ReadColor8RGBA();
            ColorBottomRight = reader.ReadColor8RGBA();
            MaterialIndex    = reader.ReadUInt16();
            byte numUVs = reader.ReadByte();

            reader.Seek(1); //padding

            TexCoords = new TexCoord[numUVs];
            for (int i = 0; i < numUVs; i++)
            {
                TexCoords[i] = new TexCoord()
                {
                    TopLeft     = reader.ReadVec2SY(),
                    TopRight    = reader.ReadVec2SY(),
                    BottomLeft  = reader.ReadVec2SY(),
                    BottomRight = reader.ReadVec2SY(),
                };
            }

            Material = header.MaterialList.Materials[MaterialIndex];
        }
コード例 #4
0
ファイル: Header.cs プロジェクト: setccccc/Switch-Toolbox
        public override void TryRemoveMaterial(BxlytMaterial material)
        {
            if (material == null)
            {
                return;
            }
            material.RemoveNodeWrapper();

            if (MaterialList.Materials.Contains(material))
            {
                MaterialList.Materials.Remove(material);
            }
        }
コード例 #5
0
        public PIC1(Header header, string name) : base()
        {
            LoadDefaults();
            Name = name;

            ParentLayout = header;

            ColorTopLeft     = STColor8.White;
            ColorTopRight    = STColor8.White;
            ColorBottomLeft  = STColor8.White;
            ColorBottomRight = STColor8.White;
            TexCoords        = new TexCoord[1];
            TexCoords[0]     = new TexCoord();

            Material = new Material(name, header);
        }
コード例 #6
0
 public void CopyMaterial()
 {
     Material = Material.Clone();
 }
コード例 #7
0
ファイル: PIC1.cs プロジェクト: week9/Switch-Toolbox
 public void CopyMaterial()
 {
     Material = (BxlytMaterial)Material.Clone();
 }