Beispiel #1
0
        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));
        }
Beispiel #2
0
        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));
        }
Beispiel #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];
        }
Beispiel #4
0
        public override void TryRemoveMaterial(BxlytMaterial material)
        {
            if (material == null)
            {
                return;
            }
            material.RemoveNodeWrapper();

            if (MaterialList.Materials.Contains(material))
            {
                MaterialList.Materials.Remove(material);
            }
        }
Beispiel #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);
        }
Beispiel #6
0
 public void CopyMaterial()
 {
     Material = Material.Clone();
 }
Beispiel #7
0
 public void CopyMaterial()
 {
     Material = (BxlytMaterial)Material.Clone();
 }