瀏覽代碼

- update Assimp.net viewer application to take the model file to be loaded from the command line.
- add a screenshot to proof that it works ;-)
- update Readme.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@848 67173fc5-114c-0410-ac8e-9d2fd5bffc1f

aramis_acg 15 年之前
父節點
當前提交
3b35d2216b
共有 3 個文件被更改,包括 19 次插入2 次删除
  1. 15 2
      port/Assimp.NET/Assimp.NET_DEMO/AssimpView.cs
  2. 二進制
      port/Assimp.NET/CSharpViewerScreenShot.PNG
  3. 4 0
      port/Assimp.NET/README.txt

+ 15 - 2
port/Assimp.NET/Assimp.NET_DEMO/AssimpView.cs

@@ -183,16 +183,29 @@ namespace Assimp.Viewer
                 aiPostProcessSteps.aiProcess_SortByPType | // make 'clean' meshes which consist of a single typ of primitives
                 (aiPostProcessSteps)0);
 
+            // default model
+            var path = "../../../../../../test/models/3DS/test1.3ds";
+
             importer = new Importer();
-            var path = "../../../../../../test/models/3DS/jeep1.3ds";
+            string[] args = Environment.GetCommandLineArgs();
+            if (args.Length > 1) {
+                path = args[1];
+            }
+
+            
             //var path = "man.3ds";
             scene = importer.ReadFile(path, flags);
-            if (scene != null) {
+            if (scene != null)
+            {
                 directory = Path.GetDirectoryName(path);
                 CacheMaterials(scene.mMaterials);
                 CacheMeshes(scene.mMeshes);
                 SetupCamera(scene.mCameras);
             }
+            else {
+                MessageBox.Show("Failed to open file: " + path + ". Either Assimp screwed up or the path is not valid.");
+                Application.Exit();
+            }
         }
 
         private void CacheMeshes(aiMeshVector meshes) {

二進制
port/Assimp.NET/CSharpViewerScreenShot.PNG


+ 4 - 0
port/Assimp.NET/README.txt

@@ -8,6 +8,10 @@ NOTE: This has only been tested on 32-bit Windows 7 in .NET 3.5SP1 compiled
       under Visual Studio 2008 with the 'Debug' and 'Release' targets.
 
 
+The Viewer is very minimalistic, don't expect all files to be displayed 
+properly. Feel free to extend it ;-)
+
+
 How To Build
 ------------