public static List <string> GetTexNames(MeshDefinitions mesh, Dictionary <string, int> xgmiIdByCombined, Dictionary <string, int> xgmiIdByUnique, List <string> cachedTexNames) { var texNames = new List <string>(); if (mesh.stam != null) { foreach (var xgmiKey in mesh.stam.texIds) { if (xgmiIdByCombined.ContainsKey(xgmiKey)) { texNames.Add(cachedTexNames[xgmiIdByCombined[xgmiKey]]); } else if (xgmiIdByUnique.ContainsKey(xgmiKey)) { texNames.Add(cachedTexNames[xgmiIdByUnique[xgmiKey]]); } } } if (texNames.Count == 0) { texNames.Add("dummyTex.dds"); } return(texNames); }
public static void ReadBM(this BufferedStreamReader streamReader, List <MeshDefinitions> defs, ipnbStruct tempLpnbList, List <stamData> stamList, long last__oaPos) { int counter = 0; MeshDefinitions mesh = null; var bmStart = streamReader.Position(); streamReader.Read <int>(); var bmEnd = streamReader.Read <int>() + bmStart; streamReader.Seek(0x8, SeekOrigin.Current); while (streamReader.Position() < bmEnd) { var tag = streamReader.Peek <int>(); switch (tag) { case ydbm: if (mesh != null) { Debug.WriteLine(defs.Count); defs.Add(mesh); } mesh = new MeshDefinitions(); mesh.oaPos = last__oaPos; mesh.lpnbStr = tempLpnbList; mesh.ydbmStr = streamReader.ReadYdbm(); if (stamList.Count > counter) { mesh.stam = stamList[counter]; } else if (stamList.Count > 0) { mesh.stam = stamList[stamList.Count - 1]; } else { mesh.stam = null; } counter++; break; case lxdi: mesh.lxdiStr = streamReader.ReadLxdi(); break; case salv: mesh.salvStr = streamReader.ReadSalv(); mesh.vtxe = GenerateGenericPSO2VTXE(mesh.salvStr.vertDef0, mesh.salvStr.vertDef1, mesh.salvStr.vertDef2, mesh.salvStr.vertDef3, mesh.salvStr.vertDef4, mesh.salvStr.vertLen); break; case ipnb: mesh.ipnbStr = streamReader.ReadIpnb(); break; default: streamReader.SkipBasicAXSStruct(); break; } } if (mesh != null) { Debug.WriteLine(defs.Count); defs.Add(mesh); } }