private void LoadModels(Dictionary <Scene, VirtualFilesystemDirectory> archiveMap) { // We're going to search the archives for a specific list of meshes that the game supports and load those. List <string> supportedModelPaths = new List <string>(new string[] { "model", "model1", "model2", "model3" }); foreach (var kvp in archiveMap) { List <VirtualFilesystemFile> filesByExtension = kvp.Value.FindByExtension(".bmd", ".bdl"); foreach (var vfsFile in filesByExtension) { if (!supportedModelPaths.Contains(vfsFile.Name)) { continue; } using (EndianBinaryReader reader = new EndianBinaryReader(new System.IO.MemoryStream(vfsFile.File.GetData()), Endian.Big)) { WLog.Info(LogCategory.EntityLoading, null, "Loading {1} (3D Model) for {0}{1}...", vfsFile.Name, vfsFile.Extension); J3DLoader j3dLoader = new J3DLoader(); Mesh resultMesh = j3dLoader.LoadFromStream(reader); kvp.Key.MeshList.Add(resultMesh); WLog.Info(LogCategory.EntityLoading, null, "Finished loading {1} (3D Model) for {0}{1}.", vfsFile.Name, vfsFile.Extension); } } } }
private void LoadModels(Dictionary<Scene, VirtualFilesystemDirectory> archiveMap) { // We're going to search the archives for a specific list of meshes that the game supports and load those. List<string> supportedModelPaths = new List<string>(new string[] { "model", "model1", "model2", "model3"}); foreach (var kvp in archiveMap) { List<VirtualFilesystemFile> filesByExtension = kvp.Value.FindByExtension(".bmd", ".bdl"); foreach (var vfsFile in filesByExtension) { if (!supportedModelPaths.Contains(vfsFile.Name)) continue; using (EndianBinaryReader reader = new EndianBinaryReader(new System.IO.MemoryStream(vfsFile.File.GetData()), Endian.Big)) { WLog.Info(LogCategory.EntityLoading, null, "Loading {1} (3D Model) for {0}{1}...", vfsFile.Name, vfsFile.Extension); J3DLoader j3dLoader = new J3DLoader(); Mesh resultMesh = j3dLoader.LoadFromStream(reader); kvp.Key.MeshList.Add(resultMesh); WLog.Info(LogCategory.EntityLoading, null, "Finished loading {1} (3D Model) for {0}{1}.", vfsFile.Name, vfsFile.Extension); } } } }