public ReadColor3D ( ) : |
||
Résultat |
public BrgMaterial(BrgBinaryReader reader, BrgFile file) : this(file) { Id = reader.ReadInt32(); Flags = (BrgMatFlag)reader.ReadInt32(); unknown01b = reader.ReadInt32(); int nameLength = reader.ReadInt32(); this.DiffuseColor = reader.ReadColor3D(); this.AmbientColor = reader.ReadColor3D(); this.SpecularColor = reader.ReadColor3D(); this.EmissiveColor = reader.ReadColor3D(); this.DiffuseMap = reader.ReadString(nameLength); if (Flags.HasFlag(BrgMatFlag.SpecularExponent)) { this.SpecularExponent = reader.ReadSingle(); } if (Flags.HasFlag(BrgMatFlag.BumpMap)) { this.BumpMap = reader.ReadString(reader.ReadInt32()); } if (Flags.HasFlag(BrgMatFlag.Alpha)) { this.Opacity = reader.ReadSingle(); } if (Flags.HasFlag(BrgMatFlag.REFLECTIONTEXTURE)) { byte numSFX = reader.ReadByte(); sfx = new List <BrgMatSFX>(numSFX); for (int i = 0; i < numSFX; i++) { sfx.Add(reader.ReadMaterialSFX()); } } else { sfx = new List <BrgMatSFX>(); } }
public void Read(Stream stream) { using (BrgBinaryReader reader = new BrgBinaryReader(new LittleEndianBitConverter(), stream)) { uint magic = reader.ReadUInt32(); if (magic != 1280463949) { throw new Exception("This is not a MTRL file!"); } uint nameLength = reader.ReadUInt32(); for (int i = 0; i < 5; ++i) { this.unk[i] = reader.ReadUInt32(); } this.Diffuse = reader.ReadColor3D(); this.Ambient = reader.ReadColor3D(); this.Specular = reader.ReadColor3D(); this.Emissive = reader.ReadColor3D(); this.SpecularLevel = reader.ReadSingle(); this.Alpha = reader.ReadSingle(); this.Id = reader.ReadInt32(); this.SelfIlluminating = reader.ReadByte(); this.ClampU = reader.ReadByte(); this.ClampV = reader.ReadByte(); this.LightSpecular = reader.ReadByte(); this.AffectsAmbient = reader.ReadByte(); this.AffectsDiffuse = reader.ReadByte(); this.AffectsSpecular = reader.ReadByte(); this.Updateable = reader.ReadByte(); this.AlphaMode = reader.ReadInt32(); // Seems to be very often 10, wave has a 2 here, phoenix has 6 this.AmbientIntensity = reader.ReadInt32(); this.DiffuseIntensity = reader.ReadInt32(); this.SpecularIntensity = reader.ReadInt32(); this.EmissiveIntensity = reader.ReadInt32(); this.ColorTransform = reader.ReadInt32(); // Val of 4 seems to be PC this.TextureTransform = reader.ReadInt32(); this.TextureFactor = reader.ReadInt32(); // Has something to do with Cube Map this.MultiTextureMode = reader.ReadInt32(); // Has something to do with Cube Map this.TexGenMode0 = reader.ReadInt32(); this.TexGenMode1 = reader.ReadInt32(); // Has something to do with Cube Map this.TexCoordSet0 = reader.ReadInt32(); this.TexCoordSet1 = reader.ReadInt32(); this.TexCoordSet2 = reader.ReadInt32(); this.TexCoordSet3 = reader.ReadInt32(); this.TexCoordSet4 = reader.ReadInt32(); this.TexCoordSet5 = reader.ReadInt32(); this.TexCoordSet6 = reader.ReadInt32(); this.TexCoordSet7 = reader.ReadInt32(); for (int i = 0; i < 3; ++i) { this.unk2[i] = reader.ReadTexel(); } for (int i = 0; i < 3; ++i) { this.unk3[i] = reader.ReadTexel(); } for (int i = 0; i < 4; ++i) { this.unk4[i] = reader.ReadInt32(); } if (nameLength > 0) { this.Texture = reader.ReadString(); } } }
public void Read(Stream stream) { using (BrgBinaryReader reader = new BrgBinaryReader(new LittleEndianBitConverter(), stream)) { uint magic = reader.ReadUInt32(); if (magic != 1280463949) { throw new Exception("This is not a MTRL file!"); } uint nameLength = reader.ReadUInt32(); for (int i = 0; i < 5; ++i) { this.unk[i] = reader.ReadUInt32(); } this.Diffuse = reader.ReadColor3D(); this.Ambient = reader.ReadColor3D(); this.Specular = reader.ReadColor3D(); this.Emissive = reader.ReadColor3D(); this.SpecularLevel = reader.ReadSingle(); this.Alpha = reader.ReadSingle(); this.Id = reader.ReadInt32(); this.SelfIlluminating = reader.ReadByte(); this.ClampU = reader.ReadByte(); this.ClampV = reader.ReadByte(); this.LightSpecular = reader.ReadByte(); this.AffectsAmbient = reader.ReadByte(); this.AffectsDiffuse = reader.ReadByte(); this.AffectsSpecular = reader.ReadByte(); this.Updateable = reader.ReadByte(); this.AlphaMode = reader.ReadInt32(); // Seems to be very often 10, wave has a 2 here, phoenix has 6 this.AmbientIntensity = reader.ReadInt32(); this.DiffuseIntensity = reader.ReadInt32(); this.SpecularIntensity = reader.ReadInt32(); this.EmissiveIntensity = reader.ReadInt32(); this.ColorTransform = reader.ReadInt32(); // Val of 4 seems to be PC this.TextureTransform = reader.ReadInt32(); this.TextureFactor = reader.ReadInt32(); // Has something to do with Cube Map this.MultiTextureMode = reader.ReadInt32(); // Has something to do with Cube Map this.TexGenMode0 = reader.ReadInt32(); this.TexGenMode1 = reader.ReadInt32(); // Has something to do with Cube Map this.TexCoordSet0 = reader.ReadInt32(); this.TexCoordSet1 = reader.ReadInt32(); this.TexCoordSet2 = reader.ReadInt32(); this.TexCoordSet3 = reader.ReadInt32(); this.TexCoordSet4 = reader.ReadInt32(); this.TexCoordSet5 = reader.ReadInt32(); this.TexCoordSet6 = reader.ReadInt32(); this.TexCoordSet7 = reader.ReadInt32(); for (int i = 0; i < 3; ++i) { this.unk2[i] = reader.ReadTexel(); } for (int i = 0; i < 3; ++i) { this.unk3[i] = reader.ReadTexel(); } for (int i = 0; i < 4; ++i) { this.unk4[i] = reader.ReadInt32(); } if (nameLength > 0) { this.Texture = reader.ReadString(); } } }