Esempio n. 1
0
 public MaterialSampler_v63(IMaterialSampler OtherSampler) : base(OtherSampler)
 {
     if (OtherSampler.GetVersion() == VersionsEnumerator.V_63)
     {
         MaterialSampler_v63 CastedSampler = (OtherSampler as MaterialSampler_v63);
         Unk0 = CastedSampler.Unk0;
         Unk1 = CastedSampler.Unk1;
     }
     else
     {
         string message = string.Format("Version {0} cannot be converted from Version {1}", GetVersion(), OtherSampler.GetVersion());
         Console.WriteLine(message);
     }
 }
Esempio n. 2
0
        public override void ReadFromFile(BinaryReader reader, VersionsEnumerator version)
        {
            ulong  materialHash = reader.ReadUInt64();
            string materialName = StringHelpers.ReadString32(reader);

            MaterialName.String = materialName;
            MaterialName.Hash   = materialHash;
            Unk0       = reader.ReadUInt32();
            Unk1       = reader.ReadBytes(2);
            Flags      = (MaterialFlags)reader.ReadInt32();
            Unk2       = reader.ReadBytes(9);
            ShaderID   = reader.ReadUInt64();
            ShaderHash = reader.ReadUInt32();

            int parameterCount = reader.ReadInt32();

            Parameters = new List <MaterialParameter>();
            for (int i = 0; i != parameterCount; i++)
            {
                var param = new MaterialParameter(reader);
                Parameters.Add(param);
            }

            int textureCount = reader.ReadInt32();

            Textures = new List <MaterialTexture>();
            for (int i = 0; i != textureCount; i++)
            {
                var texture = new MaterialTexture();
                texture.ReadFromFile(reader);
                Textures.Add(texture);
            }

            int samplerCount = reader.ReadInt32();

            Samplers = new List <MaterialSampler_v63>();
            for (int i = 0; i != samplerCount; i++)
            {
                var sampler = new MaterialSampler_v63();
                sampler.ReadFromFile(reader, version);
                Samplers.Add(sampler);
            }
        }
Esempio n. 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);
            }
        }