Exemplo n.º 1
0
        public static IMaterial ReadMaterialFromFile(BinaryReader reader, VersionsEnumerator version)
        {
            IMaterial Material = null;

            switch (version)
            {
            case VersionsEnumerator.V_57:
                Material = new Material_v57();
                Material.ReadFromFile(reader, version);
                break;

            case VersionsEnumerator.V_58:
                Material = new Material_v58();
                Material.ReadFromFile(reader, version);
                break;

            case VersionsEnumerator.V_63:
                Material = new Material_v63();
                Material.ReadFromFile(reader, version);
                break;

            default:
                break;
            }

            Debug.Assert(Material != null, string.Format("Failed to read Material Type: {0}", version));
            return(Material);
        }
Exemplo n.º 2
0
        public Material_v57(IMaterial OtherMaterial) : base(OtherMaterial)
        {
            // TODO: I wonder if we could make v57 and v58 use the same interface?
            if (OtherMaterial.GetMTLVersion() == VersionsEnumerator.V_57)
            {
                Material_v57 CastedMaterial = (OtherMaterial as Material_v57);
                Unk0 = CastedMaterial.Unk0;
                Unk1 = CastedMaterial.Unk1;
                Unk3 = CastedMaterial.Unk3;
                Unk4 = CastedMaterial.Unk4;
                Unk5 = CastedMaterial.Unk5;
            }
            else if (OtherMaterial.GetMTLVersion() == VersionsEnumerator.V_58)
            {
                Material_v58 CastedMaterial = (OtherMaterial as Material_v58);
                Unk0 = CastedMaterial.Unk0;
                Unk1 = CastedMaterial.Unk1;
                Unk3 = CastedMaterial.Unk3;
                Unk4 = CastedMaterial.Unk4;
                Unk5 = CastedMaterial.Unk5;
            }
            else
            {
                string message = string.Format("Version {0} cannot be converted from Version {1}", GetMTLVersion(), OtherMaterial.GetMTLVersion());
                Console.WriteLine(message);
                return;
            }

            Samplers = new List <MaterialSampler_v57>();
            foreach (var Sampler in Samplers)
            {
                MaterialSampler_v57 NewSampler = new MaterialSampler_v57(Sampler);
                Samplers.Add(Sampler);
            }
        }
Exemplo n.º 3
0
        public static IMaterial ConstructMaterial(VersionsEnumerator Version)
        {
            IMaterial Material = null;

            switch (Version)
            {
            case VersionsEnumerator.V_57:
                Material = new Material_v57();
                break;

            case VersionsEnumerator.V_58:
                Material = new Material_v58();
                break;

            case VersionsEnumerator.V_63:
                Material = new Material_v63();
                break;

            default:
                break;
            }

            Debug.Assert(Material != null, string.Format("Failed to read Construct Material Type: {0}", Version));
            return(Material);
        }