Browse Source

- Bugfix: XFileImporter now throws an error if the file is ill-formatted and thus perceived as empty
- documented data structure updated
- added WIN32 define to all project configurations to fix Win32Logger compilation error.

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

ulfjorensen 17 years ago
parent
commit
47d16d33b4
3 changed files with 45 additions and 23 deletions
  1. 6 1
      code/XFileImporter.cpp
  2. 35 18
      doc/datastructure.xml
  3. 4 4
      workspaces/vc8/assimp.vcproj

+ 6 - 1
code/XFileImporter.cpp

@@ -103,6 +103,10 @@ void XFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene, I
 
 	// and create the proper return structures out of it
 	CreateDataRepresentationFromImport( pScene, parser.GetImportedData());
+
+  // if nothing came from it, report it as error
+  if( !pScene->mRootNode)
+    throw new ImportErrorException( "XFile is ill-formatted - no content imported.");
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -136,7 +140,8 @@ void XFileImporter::CreateDataRepresentationFromImport( aiScene* pScene, const X
 	}
 
 	// convert the root node's transformation to OGL coords
-	ConvertToLHProcess::ConvertToOGL( pScene->mRootNode->mTransformation);
+  if( pScene->mRootNode)
+  	ConvertToLHProcess::ConvertToOGL( pScene->mRootNode->mTransformation);
 
 	// finally: create a dummy material if not material was imported
 	if( pScene->mNumMaterials == 0)

+ 35 - 18
doc/datastructure.xml

@@ -1,41 +1,52 @@
-<importedScene alias data alias Model?>
+<importedScene>
   <version 1.2 />   <smiley code=":-)" />
-  <frame alias object>
+  <node>
     <name/>
     <transformation matrix4x4 />
 
-    <mesh id="1" />
+    <mesh refid="0" />
     <mesh ... />
     
-    <childframe alias childobject as type frame alias object />
-    <childframe... />
-  </frame>
+    <childnode/>
+    <childnode... />
+  </node>
   <meshes>
-    <mesh id="1">
-      <meshheader with MatID, Vertexcount, Facecount, a.s.o. />
-      <vertice>
-          <vertex xyzw />
+    <mesh id="0">
+      <meshheader MatID, Vertexcount, Facecount, a.s.o. />
+      <vertices>
+          <vertex xyz />
           <vertex ... />
-      </vertice>
-      <texturecoords>
+      </vertices>
+      <texturecoords index="0">
           <texturecoord uv />
           <texturecoord ... />
-      </texturcoords>
-      <vertexcolors>
+      </texturecoords>
+      <texturecoords index="..." />
+      <vertexcolors index="0">
           <color rgba />
           <color ... />
       </vertexcolors>
+      <vertexcolors index="..." />
       <normals>
           <normal xyz />
           <normal ... />
       </normals>
+      <tangents>
+        <tangent xyz />
+        <tangent ... />
+      </tangents>
+      <bitangents>
+        <bitangent xyz />
+        <bitangent ... />
+      </tangents>
       <faces>
-          <face p1, p2, p3 />
+          <face numIndices="3" indices="p1, p2, p3" />
           <face ... />
       </faces>      
       <bones>
         <bone>
           <name />
+          <offset matrix4x4 />
           <weights>
             <weight v, w />
             <weight... />
@@ -48,7 +59,7 @@
   </meshes>
   <anims>
     <anim name="rudern" duration="4500" ticksPerSecond="50">
-      <animbone name="bla">
+      <animbone nameOfAnimatedNode="bla">
         <rotation>
           <rotkey time="0" rot="xyzw" />
           <rotkey time="100" rot="xyzw" />
@@ -65,7 +76,7 @@
           ...
         <scaling>
       </animbone>
-      <animbone name="blubb">
+      <animbone nameOfAnimatedNode="blubb">
         ...
       </animbone>
     </anim>
@@ -80,4 +91,10 @@
     </material>
     <material ... />
   </materials>
-</importedScene alias data alias model?>
+  <textures>
+    </texture width, height, formatHint>
+      <data />
+    </texture>
+    <texture ... />
+  </textures>
+</importedScene>

+ 4 - 4
workspaces/vc8/assimp.vcproj

@@ -39,7 +39,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="../../include"
-				PreprocessorDefinitions="DEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS"
+				PreprocessorDefinitions="DEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
 				BasicRuntimeChecks="3"
 				SmallerTypeCheck="true"
 				RuntimeLibrary="1"
@@ -103,7 +103,7 @@
 				EnableIntrinsicFunctions="true"
 				FavorSizeOrSpeed="1"
 				AdditionalIncludeDirectories="../../include"
-				PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS"
+				PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
 				StringPooling="true"
 				BufferSecurityCheck="false"
 				EnableEnhancedInstructionSet="2"
@@ -165,7 +165,7 @@
 				EnableIntrinsicFunctions="true"
 				FavorSizeOrSpeed="1"
 				AdditionalIncludeDirectories="../../include"
-				PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS"
+				PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
 				StringPooling="true"
 				BufferSecurityCheck="false"
 				EnableEnhancedInstructionSet="2"
@@ -234,7 +234,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="../../include"
-				PreprocessorDefinitions="DEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS"
+				PreprocessorDefinitions="DEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
 				BasicRuntimeChecks="3"
 				SmallerTypeCheck="true"
 				RuntimeLibrary="1"