Browse Source

Fix loading binary LWO files

Turo Lamminen 2 years ago
parent
commit
e8f0eb930d
2 changed files with 5 additions and 16 deletions
  1. 1 1
      code/AssetLib/LWO/LWOLoader.cpp
  2. 4 15
      test/unit/utLWOImportExport.cpp

+ 1 - 1
code/AssetLib/LWO/LWOLoader.cpp

@@ -178,7 +178,7 @@ void LWOImporter::InternReadFile(const std::string &pFile,
     mLayers->push_back(Layer());
     mCurLayer = &mLayers->back();
     mCurLayer->mName = "<LWODefault>";
-    mCurLayer->mIndex = (uint16_t) -1;
+    mCurLayer->mIndex = 1;
 
     // old lightwave file format (prior to v6)
     mIsLWO2 = false;

+ 4 - 15
test/unit/utLWOImportExport.cpp

@@ -357,16 +357,11 @@ TEST_F(utLWOImportExport, importLWOuvtest) {
 }
 
 
-// These tests leak memory and complain on ASAN CI build
-#if 0
-
-
 TEST_F(utLWOImportExport, importLWOBConcavePolygon) {
     ::Assimp::Importer importer;
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWOB/ConcavePolygon.lwo", aiProcess_ValidateDataStructure);
 
-    // FIXME: this should succees but there's a bug in the importer
-    EXPECT_EQ(nullptr, scene);
+    EXPECT_NE(nullptr, scene);
 }
 
 
@@ -374,8 +369,7 @@ TEST_F(utLWOImportExport, importLWOBbluewithcylindrictex) {
     ::Assimp::Importer importer;
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWOB/MappingModes/bluewithcylindrictexz.lwo", aiProcess_ValidateDataStructure);
 
-    // FIXME: this should succees but there's a bug in the importer
-    EXPECT_EQ(nullptr, scene);
+    EXPECT_NE(nullptr, scene);
 }
 
 
@@ -383,8 +377,7 @@ TEST_F(utLWOImportExport, importLWOBsphere_with_mat_gloss_10pc) {
     ::Assimp::Importer importer;
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWOB/sphere_with_mat_gloss_10pc.lwo", aiProcess_ValidateDataStructure);
 
-    // FIXME: this should succees but there's a bug in the importer
-    EXPECT_EQ(nullptr, scene);
+    EXPECT_NE(nullptr, scene);
 }
 
 
@@ -392,9 +385,5 @@ TEST_F(utLWOImportExport, importLWOBsphere_with_mat_gloss_50pc) {
     ::Assimp::Importer importer;
     const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWOB/sphere_with_mat_gloss_50pc.lwo", aiProcess_ValidateDataStructure);
 
-    // FIXME: this should succees but there's a bug in the importer
-    EXPECT_EQ(nullptr, scene);
+    EXPECT_NE(nullptr, scene);
 }
-
-
-#endif  // ASAN failing tests