/// <summary> /// Handles loading of file, starts parser on separate thread /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LoadButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog file = new OpenFileDialog(); bool? result = file.ShowDialog(); if (result == true) { string path = file.FileName; if (Path.GetExtension(path).ToLower() == ".p3d") { ChangeStatus(new StatusUpdatedEventArguments("Loading p3d file", 10)); SelectedElement = null; P3DViewItems.Clear(); itemInfo.Children.Clear(); P3DFile = new P3D(this); P3DFile.StatusUpdated += new StatusUpdatedEventHandler(ChangeStatus); Task.Run(() => P3DFile.LoadP3D(path)); } else { if (Path.GetExtension(path).ToLower() == ".3ds") { ChangeStatus(new StatusUpdatedEventArguments("Loading 3ds file", 10)); P3DViewItems.Clear(); itemInfo.Children.Clear(); File3DS = LIB3DS.lib3ds_file_open(path); P3DFile = new P3D(this); Task.Run(() => P3DFile.Load3DS(File3DS)); return; } MessageBox.Show("Format not supported"); } } }
//读取3DS文件,返回成功标识 public static bool readFile(String szFilename) { Lib3dsFile file = null; file = LIB3DS.lib3ds_file_open(szFilename); return(file != null); }
// Function : open 3DS file. // Description : use locale::global to make sure we can read file from the path. // Input : 3DS file's path. // Output : nothing. public void OpenFile(string FileRoad) { OpenGL gl = new OpenGL(); MyModel = LIB3DS.lib3ds_file_open(FileRoad);//モデルデータ読み込み if (MyModel == null) { Console.WriteLine("Read 3DS file error!"); return; } }
public static Lib3dsFile EmptyFile() { return(LIB3DS.lib3ds_file_open(Path.GetDirectoryName(Application.ExecutablePath) + "\\exec\\cube.3ds")); }
public static Lib3dsFile EmptyFile() { return(LIB3DS.lib3ds_file_open(Path.Combine(App.ExecFolder, "cube.3ds"))); }
public static Lib3dsFile EmptyFile() { return(LIB3DS.lib3ds_file_open(loc + "\\exec\\cube.3ds")); }