gpt-4o-mini-2024-07-18· OpenAI
WildChat-4.8M (AI2)
fix the formatting private static void MaterialsToFile(Dictionary<string, OMATRuntime>…
- User
fix the formatting
codeprivate static void MaterialsToFile(Dictionary<string, OMATRuntime> materialList, string folder, string filename) { using (StreamWriter sw = new StreamWriter(folder + "/" + filename + ".mtl")){ foreach(KeyValuePair<string, OMATRuntime> kvp in materialList ) { sw.Write("\n"); sw.Write("newmtl {0}\n", kvp.Key); sw.Write("Ka 1.0 1.0 1.0\n"); sw.Write("Kd 1.0 1.0 1.0\n"); sw.Write("Ks 1.0 1.0 1.0\n"); sw.Write("d 1.0\n"); sw.Write("Ns 0.0\n"); sw.Write("illum 2\n");
codeif (kvp.Value.textureName != null) { string destinationFile = kvp.Value.textureName; int indexstrip = destinationFile.LastIndexOf('/'); if (indexstrip >= 0) destinationFile = destinationFile.Substring(indexstrip + 1).Trim(); string relativeFile = destinationFile; destinationFile = folder + "/" + destinationFile; File.Copy(kvp.Value.textureName, destinationFile); sw.Write("map_Kd {0}", relativeFile); } sw.Write("\n\n\n");} } }
- Assistant
Here’s the corrected version of your code with improved formatting for better readability:
csharp