public ImportTextureInfo(TSOTex tex) { Name = tex.Name; File = tex.GetFileName(); BytesPerPixel = tex.Depth; Width = tex.Width; Height = tex.Height; }
public void Write(TSOFile tso) { tw.WriteLine("Metasequoia Document"); tw.WriteLine("Format Text Ver 1.0"); tw.WriteLine(""); if (MqxEnabled) { tw.WriteLine("IncludeXml \"{0}\"", Path.ChangeExtension(Path.GetFileName(OutFile), ".mqx")); tw.WriteLine(""); } tw.WriteLine("Scene {"); tw.WriteLine("\tpos -7.0446 4.1793 1541.1764"); tw.WriteLine("\tlookat 11.8726 193.8590 0.4676"); tw.WriteLine("\thead 0.8564"); tw.WriteLine("\tpich 0.1708"); tw.WriteLine("\tortho 0"); tw.WriteLine("\tzoom2 31.8925"); tw.WriteLine("\tamb 0.250 0.250 0.250"); tw.WriteLine("}"); foreach (TSOTex tex in tso.textures) { CreateTextureFile(tex); } tw.WriteLine("Material {0} {{", tso.materials.Length); foreach (TSOMaterial mat in tso.materials) { TSOTex tex = null; if (tso.texturemap.TryGetValue(mat.ColorTex, out tex)) { tw.WriteLine( "\t\"{0}\" col(1.000 1.000 1.000 1.000) dif(0.800) amb(0.600) emi(0.000) spc(0.000) power(5.00) tex(\"{1}\")", mat.name, tex.GetFileName()); } else { tw.WriteLine( "\t\"{0}\" col(1.000 1.000 1.000 1.000) dif(0.800) amb(0.600) emi(0.000) spc(0.000) power(5.00))", mat.name); } } tw.WriteLine("}"); MqoBone[] bones = null; if (MqxEnabled) { bones = CreateBones(tso); } MqoObjectGen.uid_enabled = MqxEnabled; MqoObjectGen obj = new MqoObjectGen(); ushort object_id = 0; foreach (TSOMesh mesh in tso.meshes) { obj.id = ++object_id; obj.name = mesh.Name; obj.Update(mesh); obj.Write(tw); if (MqxEnabled) { obj.AddWeits(bones); } } if (MqxEnabled) { MqxWriter writer = new MqxWriter(); writer.MqoFile = OutFile; writer.Write(bones, object_id /* eq numobjects */); } tw.WriteLine("Eof"); }
string GetTexturePath(TSOTex tex) { return(Path.Combine(OutPath, tex.GetFileName())); }