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);
        }
        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);
        }
Exemple #3
0
        public Material_v63(IMaterial OtherMaterial) : base(OtherMaterial)
        {
            // TODO: I wonder if we could make v57 and v58 use the same interface?
            if (OtherMaterial.GetMTLVersion() == VersionsEnumerator.V_63)
            {
                Material_v63 CastedMaterial = (OtherMaterial as Material_v63);
                Unk0 = CastedMaterial.Unk0;
                Unk1 = CastedMaterial.Unk1;
                Unk2 = CastedMaterial.Unk2;
            }
            else
            {
                string message = string.Format("Version {0} cannot be converted from Version {1}", GetMTLVersion(), OtherMaterial.GetMTLVersion());
                Console.WriteLine(message);
                return;
            }

            Samplers = new List <MaterialSampler_v63>();
            foreach (var Sampler in Samplers)
            {
                MaterialSampler_v63 NewSampler = new MaterialSampler_v63(Sampler);
                Samplers.Add(Sampler);
            }
        }