/// <summary> /// Read material from library. /// </summary> /// <param name="reader"></param> public void ReadFromFile(BinaryReader reader) { materialHash = reader.ReadUInt64(); materialName = Functions.ReadString32(reader); ufo1 = reader.ReadByte(); ufo2 = reader.ReadByte(); flags = (MaterialFlags)reader.ReadInt32(); ufo4 = reader.ReadByte(); ufo5 = reader.ReadInt32(); ufo6 = reader.ReadInt32(); shaderID = reader.ReadUInt64(); shaderHash = reader.ReadUInt32(); sp_count = reader.ReadInt32(); sp = new ShaderParameter[sp_count]; for (int i = 0; i != sp_count; i++) { sp[i] = new ShaderParameter(reader); } sps_count = reader.ReadInt32(); sps = new ShaderParameterSampler[sps_count]; for (int i = 0; i != sps_count; i++) { sps[i] = new ShaderParameterSampler(reader); } }
/// <summary> /// Construct material based on basic material. /// </summary> public Material() { materialName = "NEW_MATERIAL"; materialHash = 1; shaderHash = 3388704532; shaderID = 4894707398632176459; ufo1 = 128; ufo2 = 0; flags = (MaterialFlags)31461376; ufo4 = 0; ufo5 = 0; ufo6 = 0; sp_count = 0; sp = new ShaderParameter[0]; sps_count = 1; sps = new ShaderParameterSampler[1]; sps[0] = new ShaderParameterSampler(); }