From 8d405d60d94aecfe383dabf9c4cb2b1ba3ca6813 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 3 Feb 2023 11:44:27 +0200 Subject: [PATCH 1/2] Fix Terragen loader Fixes e8d2b840178b2b22336eb02b2535f32f3d5cc37b --- code/AssetLib/Terragen/TerragenLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/Terragen/TerragenLoader.cpp b/code/AssetLib/Terragen/TerragenLoader.cpp index dcf01461a..738ad8e27 100644 --- a/code/AssetLib/Terragen/TerragenLoader.cpp +++ b/code/AssetLib/Terragen/TerragenLoader.cpp @@ -230,8 +230,8 @@ void TerragenImporter::InternReadFile(const std::string &pFile, } // Get to the next chunk (4 byte aligned) - unsigned dtt = reader.GetCurrentPos(); - if (dtt & 0x3) { + unsigned dtt = reader.GetCurrentPos() & 0x3; + if (dtt) { reader.IncPtr(4 - dtt); } } From 94533424911a46c38dcf1e3fe8f8867e35cffdc5 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 3 Feb 2023 11:45:11 +0200 Subject: [PATCH 2/2] Re-enable Terragen loader unit test --- test/unit/ImportExport/Terragen/utTerragenImportExport.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/unit/ImportExport/Terragen/utTerragenImportExport.cpp b/test/unit/ImportExport/Terragen/utTerragenImportExport.cpp index 6432dbf5f..8ec20e0c0 100644 --- a/test/unit/ImportExport/Terragen/utTerragenImportExport.cpp +++ b/test/unit/ImportExport/Terragen/utTerragenImportExport.cpp @@ -48,13 +48,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class utTerragenImportExport : public AbstractImportExportBase { public: virtual bool importerTest() { - /*Assimp::Importer importer; + Assimp::Importer importer; const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/TER/RealisticTerrain.ter", aiProcess_ValidateDataStructure); - return nullptr != scene;*/ - return true; + return nullptr != scene; } }; -TEST_F(utTerragenImportExport, importX3DFromFileTest) { +TEST_F(utTerragenImportExport, importFromFileTest) { EXPECT_TRUE(importerTest()); }