mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 00:05:40 +00:00
update assimp lib
This commit is contained in:
parent
03a348deb7
commit
d3f8fee74e
1725 changed files with 196314 additions and 62009 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -60,3 +60,12 @@ TEST_F( AssimpAPITest, aiGetLastErrorTest ) {
|
|||
const char *error = aiGetErrorString();
|
||||
EXPECT_NE(nullptr, error);
|
||||
}
|
||||
|
||||
TEST_F(AssimpAPITest, aiImportFileFromMemoryTest) {
|
||||
const aiScene *scene_null_buffer = aiImportFileFromMemory(nullptr, 0u, 0u, nullptr);
|
||||
EXPECT_EQ(nullptr, scene_null_buffer);
|
||||
|
||||
char buffer[1024] = {'\0'};
|
||||
const aiScene *scene_null_size = aiImportFileFromMemory(buffer, 0u, 0u, nullptr);
|
||||
EXPECT_EQ(nullptr, scene_null_size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ using namespace Assimp;
|
|||
|
||||
class AssimpAPITest_aiMatrix3x3 : public AssimpMathTest {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
result_c = result_cpp = aiMatrix3x3();
|
||||
}
|
||||
|
||||
|
|
@ -114,10 +114,19 @@ TEST_F(AssimpAPITest_aiMatrix3x3, aiMatrix3InverseTest) {
|
|||
EXPECT_EQ(result_cpp, result_c);
|
||||
}
|
||||
|
||||
inline void AI_EXPECT_REAL_EQ(ai_real val1, ai_real val2) {
|
||||
#ifdef ASSIMP_DOUBLE_PRECISION
|
||||
EXPECT_DOUBLE_EQ((val1), (val2));
|
||||
#else
|
||||
EXPECT_FLOAT_EQ((val1), (val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(AssimpAPITest_aiMatrix3x3, aiMatrix3DeterminantTest) {
|
||||
result_c = result_cpp = random_mat3();
|
||||
EXPECT_EQ(result_cpp.Determinant(),
|
||||
aiMatrix3Determinant(&result_c));
|
||||
const ai_real det_1 = result_cpp.Determinant();
|
||||
const ai_real det_2 = aiMatrix3Determinant(&result_c);
|
||||
AI_EXPECT_REAL_EQ(det_1, det_2);
|
||||
}
|
||||
|
||||
TEST_F(AssimpAPITest_aiMatrix3x3, aiMatrix3RotationZTest) {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -42,12 +40,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
#include "UnitTestPCH.h"
|
||||
#include "MathTest.h"
|
||||
#include <assimp/MathFunctions.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
class AssimpAPITest_aiMatrix4x4 : public AssimpMathTest {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
void SetUp() override {
|
||||
result_c = result_cpp = aiMatrix4x4();
|
||||
}
|
||||
|
||||
|
|
@ -64,6 +63,12 @@ protected:
|
|||
aiMatrix4x4 result_c, result_cpp;
|
||||
};
|
||||
|
||||
TEST_F(AssimpAPITest_aiMatrix4x4, isIdendityTest) {
|
||||
aiMatrix4x4 m = aiMatrix4x4(1 + Math::getEpsilon<ai_real>(), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||||
const bool result = m.IsIdentity(Math::getEpsilon<ai_real>());
|
||||
EXPECT_TRUE(result);
|
||||
}
|
||||
|
||||
TEST_F(AssimpAPITest_aiMatrix4x4, aiIdentityMatrix4Test) {
|
||||
// Force a non-identity matrix.
|
||||
result_c = aiMatrix4x4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
@ -120,7 +120,11 @@ TEST_F(AssimpAPITest_aiQuaternion, aiQuaternionMultiplyTest) {
|
|||
result_c = result_cpp = random_quat();
|
||||
result_cpp = result_cpp * temp;
|
||||
aiQuaternionMultiply(&result_c, &temp);
|
||||
EXPECT_EQ(result_cpp, result_c);
|
||||
|
||||
EXPECT_FLOAT_EQ(result_cpp.x, result_c.x);
|
||||
EXPECT_FLOAT_EQ(result_cpp.y, result_c.y);
|
||||
EXPECT_FLOAT_EQ(result_cpp.z, result_c.z);
|
||||
EXPECT_FLOAT_EQ(result_cpp.w, result_c.w);
|
||||
}
|
||||
|
||||
TEST_F(AssimpAPITest_aiQuaternion, aiQuaternionInterpolateTest) {
|
||||
|
|
@ -131,5 +135,9 @@ TEST_F(AssimpAPITest_aiQuaternion, aiQuaternionInterpolateTest) {
|
|||
const auto q2 = aiQuaternion(aiVector3D(1,2,1).Normalize(), Math::aiPi<float>() / 2.0f);
|
||||
aiQuaternion::Interpolate(result_cpp, q1, q2, INTERPOLATION);
|
||||
aiQuaternionInterpolate(&result_c, &q1, &q2, INTERPOLATION);
|
||||
EXPECT_EQ(result_cpp, result_c);
|
||||
|
||||
EXPECT_FLOAT_EQ(result_cpp.x, result_c.x);
|
||||
EXPECT_FLOAT_EQ(result_cpp.y, result_c.y);
|
||||
EXPECT_FLOAT_EQ(result_cpp.z, result_c.z);
|
||||
EXPECT_FLOAT_EQ(result_cpp.w, result_c.w);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ TEST_F(utScene, getShortFilenameTest) {
|
|||
|
||||
TEST_F(utScene, deepCopyTest) {
|
||||
scene->mRootNode = new aiNode();
|
||||
|
||||
|
||||
scene->mNumMeshes = 1;
|
||||
scene->mMeshes = new aiMesh *[scene->mNumMeshes] ();
|
||||
scene->mMeshes[0] = new aiMesh ();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
#include <assimp/ai_assert.h>
|
||||
#include <code/Common/AssertHandler.h>
|
||||
#include <assimp/AssertHandler.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "UnitTestPCH.h"
|
||||
|
||||
#include "Common/BaseProcess.h"
|
||||
#include "Common/AssertHandler.h"
|
||||
#include <assimp/AssertHandler.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
52
Engine/lib/assimp/test/unit/Common/utLogger.cpp
Normal file
52
Engine/lib/assimp/test/unit/Common/utLogger.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "UnitTestPCH.h"
|
||||
#include <assimp/Importer.hpp>
|
||||
|
||||
using namespace Assimp;
|
||||
class utLogger : public ::testing::Test {};
|
||||
|
||||
TEST_F(utLogger, aiGetPredefinedLogStream_leak_test) {
|
||||
aiLogStream stream1 = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, nullptr);
|
||||
aiLogStream stream2 = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, nullptr);
|
||||
ASSERT_EQ(stream1.callback, stream2.callback);
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ public
|
|||
|
||||
protected:
|
||||
void SetUp() override {
|
||||
::srand(static_cast<unsigned>(time(0)));
|
||||
::srand(static_cast<unsigned>(time(nullptr)));
|
||||
vecs = new aiVector3D[100];
|
||||
for (size_t i = 0; i < 100; ++i) {
|
||||
vecs[i].x = static_cast<float>(rand()) / (static_cast<float>(RAND_MAX / 100));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
All rights reserved.
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
68
Engine/lib/assimp/test/unit/Geometry/utGeometryUtils.cpp
Normal file
68
Engine/lib/assimp/test/unit/Geometry/utGeometryUtils.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "UnitTestPCH.h"
|
||||
#include "Geometry/GeometryUtils.h"
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
class utGeometryUtils : public ::testing::Test {
|
||||
protected:
|
||||
|
||||
void SetUp() override {
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
}
|
||||
};
|
||||
static constexpr size_t NumVectors = 100;
|
||||
TEST_F(utGeometryUtils, normalizeVectorArrayTest) {
|
||||
aiVector3D *inNormals = new aiVector3D[NumVectors];
|
||||
for (uint32_t i=0; i<NumVectors; ++i){
|
||||
inNormals[i].x = static_cast<ai_real>(i);
|
||||
inNormals[i].y = static_cast<ai_real>(i);
|
||||
inNormals[i].z = static_cast<ai_real>(i);
|
||||
}
|
||||
aiVector3D *outNormals = new aiVector3D[NumVectors];
|
||||
GeometryUtils::normalizeVectorArray(inNormals, outNormals, NumVectors);
|
||||
delete[] outNormals;
|
||||
delete[] inNormals;
|
||||
}
|
||||
|
|
@ -48,19 +48,23 @@ using namespace Assimp;
|
|||
|
||||
class utIrrImportExport : public AbstractImportExportBase {
|
||||
public:
|
||||
virtual bool importerTest() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/IRR/box.irr", aiProcess_ValidateDataStructure);
|
||||
return nullptr != scene;
|
||||
}
|
||||
virtual bool importerTest() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/IRR/box.irr", aiProcess_ValidateDataStructure);
|
||||
// Only one box thus only one mesh
|
||||
return nullptr != scene && scene->mNumMeshes == 1;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(utIrrImportExport, importSimpleIrrTest) {
|
||||
EXPECT_TRUE(importerTest());
|
||||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
||||
TEST_F(utIrrImportExport, importSGIrrTest) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/IRR/dawfInCellar_SameHierarchy.irr", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE( nullptr,scene);
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/IRR/dawfInCellar_SameHierarchy.irr", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_EQ(scene->mNumMeshes, 2);
|
||||
EXPECT_EQ(scene->mNumMaterials, 2);
|
||||
EXPECT_GT(scene->mMeshes[0]->mNumVertices, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ private:
|
|||
Assimp::Importer importer;
|
||||
importer.SetPropertyBool(setting_key, setting_value);
|
||||
const aiScene *scene = importer.ReadFile(file_path, aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
func(scene);
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ private:
|
|||
const char *key_name) {
|
||||
aiNode *global_info = get_global_info(scene);
|
||||
EXPECT_NE(nullptr, global_info);
|
||||
T temp;
|
||||
T temp = 0;
|
||||
EXPECT_TRUE(global_info->mMetaData->Get(key_name, temp));
|
||||
EXPECT_EQ(expected_value, temp);
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ private:
|
|||
aiNode *global_info = get_global_info(scene);
|
||||
EXPECT_NE(nullptr, global_info);
|
||||
for (auto it = p_kv.begin(); it != p_kv.end(); ++it) {
|
||||
T temp;
|
||||
T temp = 0;
|
||||
EXPECT_TRUE(global_info->mMetaData->Get(it->second, temp));
|
||||
EXPECT_EQ(it->first, temp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -61,10 +61,10 @@ public:
|
|||
void flatShadeTexture() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "chrome_sphere.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMaterials);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMaterials);
|
||||
|
||||
aiShadingMode shading_mode;
|
||||
aiShadingMode shading_mode = aiShadingMode_Flat;
|
||||
scene->mMaterials[0]->Get(AI_MATKEY_SHADING_MODEL, shading_mode);
|
||||
EXPECT_EQ(aiShadingMode_Flat, shading_mode);
|
||||
}
|
||||
|
|
@ -74,8 +74,8 @@ public:
|
|||
void chromeTexture() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "chrome_sphere.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMaterials);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMaterials);
|
||||
|
||||
int chrome;
|
||||
scene->mMaterials[0]->Get(AI_MDL_HL1_MATKEY_CHROME(aiTextureType_DIFFUSE, 0), chrome);
|
||||
|
|
@ -87,10 +87,10 @@ public:
|
|||
void additiveBlendTexture() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "blend_additive.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMaterials);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMaterials);
|
||||
|
||||
aiBlendMode blend_mode;
|
||||
aiBlendMode blend_mode = aiBlendMode_Default;
|
||||
scene->mMaterials[0]->Get(AI_MATKEY_BLEND_FUNC, blend_mode);
|
||||
EXPECT_EQ(aiBlendMode_Additive, blend_mode);
|
||||
}
|
||||
|
|
@ -101,17 +101,17 @@ public:
|
|||
void textureWithColorMask() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "alpha_test.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMaterials);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMaterials);
|
||||
|
||||
int texture_flags;
|
||||
int texture_flags = 0;
|
||||
scene->mMaterials[0]->Get(AI_MATKEY_TEXFLAGS_DIFFUSE(0), texture_flags);
|
||||
EXPECT_EQ(aiTextureFlags_UseAlpha, texture_flags);
|
||||
|
||||
// The model has only one texture, a 256 color bitmap with
|
||||
// a palette. Pure blue is the last color in the palette,
|
||||
// and should be the transparency color.
|
||||
aiColor3D transparency_color;
|
||||
aiColor3D transparency_color = {};
|
||||
scene->mMaterials[0]->Get(AI_MATKEY_COLOR_TRANSPARENT, transparency_color);
|
||||
EXPECT_EQ(aiColor3D(0, 0, 255), transparency_color);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -55,6 +55,17 @@ using namespace Assimp;
|
|||
|
||||
class utMDLImporter_HL1_Nodes : public ::testing::Test {
|
||||
|
||||
/**
|
||||
* @note Represents a flattened node hierarchy where each item is a pair
|
||||
* containing the node level and it's name.
|
||||
*/
|
||||
using Hierarchy = std::vector<std::pair<unsigned int, std::string>>;
|
||||
|
||||
/**
|
||||
* @note A vector of strings. Used for symplifying syntax.
|
||||
*/
|
||||
using StringVector = std::vector<std::string>;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @note The following tests require a basic understanding
|
||||
|
|
@ -63,6 +74,51 @@ public:
|
|||
* (Valve Developer Community).
|
||||
*/
|
||||
|
||||
// Given a model, verify that the bones nodes hierarchy is correctly formed.
|
||||
void checkBoneHierarchy() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "multiple_roots.mdl", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mRootNode);
|
||||
|
||||
// First, check that "<MDL_root>" and "<MDL_bones>" are linked.
|
||||
const aiNode* node_MDL_root = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_ROOT);
|
||||
ASSERT_NE(nullptr, node_MDL_root);
|
||||
|
||||
const aiNode *node_MDL_bones = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BONES);
|
||||
ASSERT_NE(nullptr, node_MDL_bones);
|
||||
ASSERT_NE(nullptr, node_MDL_bones->mParent);
|
||||
ASSERT_EQ(node_MDL_root, node_MDL_bones->mParent);
|
||||
|
||||
// Second, verify "<MDL_bones>" hierarchy.
|
||||
const Hierarchy expected_hierarchy = {
|
||||
{ 0, AI_MDL_HL1_NODE_BONES },
|
||||
{ 1, "root1_bone1" },
|
||||
{ 2, "root1_bone2" },
|
||||
{ 3, "root1_bone4" },
|
||||
{ 3, "root1_bone5" },
|
||||
{ 2, "root1_bone3" },
|
||||
{ 3, "root1_bone6" },
|
||||
{ 1, "root2_bone1" },
|
||||
{ 2, "root2_bone2" },
|
||||
{ 2, "root2_bone3" },
|
||||
{ 3, "root2_bone5" },
|
||||
{ 2, "root2_bone4" },
|
||||
{ 3, "root2_bone6" },
|
||||
{ 1, "root3_bone1" },
|
||||
{ 2, "root3_bone2" },
|
||||
{ 2, "root3_bone3" },
|
||||
{ 2, "root3_bone4" },
|
||||
{ 3, "root3_bone5" },
|
||||
{ 4, "root3_bone6" },
|
||||
{ 4, "root3_bone7" },
|
||||
};
|
||||
|
||||
Hierarchy actual_hierarchy;
|
||||
flatten_hierarchy(node_MDL_bones, actual_hierarchy);
|
||||
ASSERT_EQ(expected_hierarchy, actual_hierarchy);
|
||||
}
|
||||
|
||||
/* Given a model with bones that have empty names,
|
||||
verify that all the bones of the imported model
|
||||
have unique and no empty names.
|
||||
|
|
@ -80,9 +136,9 @@ public:
|
|||
void emptyBonesNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "unnamed_bones.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_bones_names = {
|
||||
const StringVector expected_bones_names = {
|
||||
"Bone",
|
||||
"Bone_0",
|
||||
"Bone_1",
|
||||
|
|
@ -94,7 +150,9 @@ public:
|
|||
"Bone_7"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_BONES, expected_bones_names);
|
||||
StringVector actual_bones_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BONES), actual_bones_names);
|
||||
ASSERT_EQ(expected_bones_names, actual_bones_names);
|
||||
}
|
||||
|
||||
/* Given a model with bodyparts that have empty names,
|
||||
|
|
@ -114,9 +172,9 @@ public:
|
|||
void emptyBodypartsNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "unnamed_bodyparts.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_bodyparts_names = {
|
||||
const StringVector expected_bodyparts_names = {
|
||||
"Bodypart",
|
||||
"Bodypart_1",
|
||||
"Bodypart_5",
|
||||
|
|
@ -128,7 +186,10 @@ public:
|
|||
"Bodypart_7"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_BODYPARTS, expected_bodyparts_names);
|
||||
StringVector actual_bodyparts_names;
|
||||
// Get the bodyparts names "without" the submodels.
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BODYPARTS), actual_bodyparts_names, 0);
|
||||
ASSERT_EQ(expected_bodyparts_names, actual_bodyparts_names);
|
||||
}
|
||||
|
||||
/* Given a model with bodyparts that have duplicate names,
|
||||
|
|
@ -148,9 +209,9 @@ public:
|
|||
void duplicateBodypartsNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "duplicate_bodyparts.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_bodyparts_names = {
|
||||
const StringVector expected_bodyparts_names = {
|
||||
"Bodypart",
|
||||
"Bodypart_1",
|
||||
"Bodypart_2",
|
||||
|
|
@ -162,7 +223,10 @@ public:
|
|||
"Bodypart_4"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_BODYPARTS, expected_bodyparts_names);
|
||||
StringVector actual_bodyparts_names;
|
||||
// Get the bodyparts names "without" the submodels.
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BODYPARTS), actual_bodyparts_names, 0);
|
||||
ASSERT_EQ(expected_bodyparts_names, actual_bodyparts_names);
|
||||
}
|
||||
|
||||
/* Given a model with several bodyparts that contains multiple
|
||||
|
|
@ -190,9 +254,9 @@ public:
|
|||
void duplicateSubModelsNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "duplicate_submodels.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::vector<std::string>> expected_bodypart_sub_models_names = {
|
||||
const std::vector<StringVector> expected_bodypart_sub_models_names = {
|
||||
{
|
||||
"triangle",
|
||||
"triangle_0",
|
||||
|
|
@ -208,11 +272,15 @@ public:
|
|||
};
|
||||
|
||||
const aiNode *bodyparts_node = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BODYPARTS);
|
||||
EXPECT_NE(nullptr, bodyparts_node);
|
||||
ASSERT_NE(nullptr, bodyparts_node);
|
||||
EXPECT_EQ(3u, bodyparts_node->mNumChildren);
|
||||
for (unsigned int i = 0; i < bodyparts_node->mNumChildren; ++i) {
|
||||
expect_named_children(bodyparts_node->mChildren[i],
|
||||
expected_bodypart_sub_models_names[i]);
|
||||
|
||||
StringVector actual_submodels_names;
|
||||
for (unsigned int i = 0; i < bodyparts_node->mNumChildren; ++i)
|
||||
{
|
||||
actual_submodels_names.clear();
|
||||
get_node_children_names(bodyparts_node->mChildren[i], actual_submodels_names);
|
||||
ASSERT_EQ(expected_bodypart_sub_models_names[i], actual_submodels_names);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -233,9 +301,9 @@ public:
|
|||
void duplicateSequenceNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "duplicate_sequences.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_sequence_names = {
|
||||
const StringVector expected_sequence_names = {
|
||||
"idle_1",
|
||||
"idle",
|
||||
"idle_2",
|
||||
|
|
@ -247,7 +315,9 @@ public:
|
|||
"idle_7"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_SEQUENCE_INFOS, expected_sequence_names);
|
||||
StringVector actual_sequence_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_SEQUENCE_INFOS), actual_sequence_names);
|
||||
ASSERT_EQ(expected_sequence_names, actual_sequence_names);
|
||||
}
|
||||
|
||||
/* Given a model with sequences that have empty names, verify
|
||||
|
|
@ -267,9 +337,9 @@ public:
|
|||
void emptySequenceNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "unnamed_sequences.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_sequence_names = {
|
||||
const StringVector expected_sequence_names = {
|
||||
"Sequence",
|
||||
"Sequence_1",
|
||||
"Sequence_0",
|
||||
|
|
@ -281,7 +351,9 @@ public:
|
|||
"Sequence_6"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_SEQUENCE_INFOS, expected_sequence_names);
|
||||
StringVector actual_sequence_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_SEQUENCE_INFOS), actual_sequence_names);
|
||||
ASSERT_EQ(expected_sequence_names, actual_sequence_names);
|
||||
}
|
||||
|
||||
/* Given a model with sequence groups that have duplicate names,
|
||||
|
|
@ -302,9 +374,9 @@ public:
|
|||
void duplicateSequenceGroupNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "duplicate_sequence_groups/duplicate_sequence_groups.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_sequence_names = {
|
||||
const StringVector expected_sequence_names = {
|
||||
"default",
|
||||
"SequenceGroup",
|
||||
"SequenceGroup_1",
|
||||
|
|
@ -317,7 +389,9 @@ public:
|
|||
"SequenceGroup_2"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_SEQUENCE_GROUPS, expected_sequence_names);
|
||||
StringVector actual_sequence_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_SEQUENCE_GROUPS), actual_sequence_names);
|
||||
ASSERT_EQ(expected_sequence_names, actual_sequence_names);
|
||||
}
|
||||
|
||||
/* Given a model with sequence groups that have empty names,
|
||||
|
|
@ -338,9 +412,9 @@ public:
|
|||
void emptySequenceGroupNames() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MDL_HL1_MODELS_DIR "unnamed_sequence_groups/unnamed_sequence_groups.mdl", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
const std::vector<std::string> expected_sequence_names = {
|
||||
const StringVector expected_sequence_names = {
|
||||
"default",
|
||||
"SequenceGroup",
|
||||
"SequenceGroup_2",
|
||||
|
|
@ -353,7 +427,9 @@ public:
|
|||
"SequenceGroup_4"
|
||||
};
|
||||
|
||||
expect_named_children(scene, AI_MDL_HL1_NODE_SEQUENCE_GROUPS, expected_sequence_names);
|
||||
StringVector actual_sequence_names;
|
||||
get_node_children_names(scene->mRootNode->FindNode(AI_MDL_HL1_NODE_SEQUENCE_GROUPS), actual_sequence_names);
|
||||
ASSERT_EQ(expected_sequence_names, actual_sequence_names);
|
||||
}
|
||||
|
||||
/* Verify that mOffsetMatrix applies the correct
|
||||
|
|
@ -364,7 +440,7 @@ public:
|
|||
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(MDL_HL1_FILE_MAN, aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
aiNode *scene_bones_node = scene->mRootNode->FindNode(AI_MDL_HL1_NODE_BONES);
|
||||
|
||||
|
|
@ -398,26 +474,58 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void expect_named_children(const aiNode *parent_node, const std::vector<std::string> &expected_names) {
|
||||
EXPECT_NE(nullptr, parent_node);
|
||||
EXPECT_EQ(expected_names.size(), parent_node->mNumChildren);
|
||||
|
||||
for (unsigned int i = 0; i < parent_node->mNumChildren; ++i)
|
||||
EXPECT_EQ(expected_names[i], parent_node->mChildren[i]->mName.C_Str());
|
||||
}
|
||||
|
||||
void expect_named_children(const aiScene *scene, const char *node_name, const std::vector<std::string> &expected_names) {
|
||||
expect_named_children(scene->mRootNode->FindNode(node_name), expected_names);
|
||||
}
|
||||
|
||||
void expect_equal_matrices(const aiMatrix4x4 &expected, const aiMatrix4x4 &actual, float abs_error) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
for (int j = 0; j < 4; ++j)
|
||||
EXPECT_NEAR(expected[i][j], actual[i][j], abs_error);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get a flattened representation of a node's hierarchy.
|
||||
* \param[in] node The node.
|
||||
* \param[out] hierarchy The flattened node's hierarchy.
|
||||
*/
|
||||
void flatten_hierarchy(const aiNode *node, Hierarchy &hierarchy)
|
||||
{
|
||||
flatten_hierarchy_impl(node, hierarchy, 0);
|
||||
}
|
||||
|
||||
void flatten_hierarchy_impl(const aiNode *node, Hierarchy &hierarchy, unsigned int level)
|
||||
{
|
||||
hierarchy.push_back({ level, node->mName.C_Str() });
|
||||
for (size_t i = 0; i < node->mNumChildren; ++i)
|
||||
{
|
||||
flatten_hierarchy_impl(node->mChildren[i], hierarchy, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get all node's children names beneath max_level.
|
||||
* \param[in] node The parent node from which to get all children names.
|
||||
* \param[out] names The list of children names.
|
||||
* \param[in] max_level If set to -1, all children names will be collected.
|
||||
*/
|
||||
void get_node_children_names(const aiNode *node, StringVector &names, const int max_level = -1)
|
||||
{
|
||||
get_node_children_names_impl(node, names, 0, max_level);
|
||||
}
|
||||
|
||||
void get_node_children_names_impl(const aiNode *node, StringVector &names, int level, const int max_level = -1)
|
||||
{
|
||||
for (size_t i = 0; i < node->mNumChildren; ++i)
|
||||
{
|
||||
names.push_back(node->mChildren[i]->mName.C_Str());
|
||||
if (max_level == -1 || level < max_level)
|
||||
{
|
||||
get_node_children_names_impl(node->mChildren[i], names, level + 1, max_level);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(utMDLImporter_HL1_Nodes, checkBoneHierarchy) {
|
||||
checkBoneHierarchy();
|
||||
}
|
||||
|
||||
TEST_F(utMDLImporter_HL1_Nodes, emptyBonesNames) {
|
||||
emptyBonesNames();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "AbstractImportExportBase.h"
|
||||
#include "UnitTestPCH.h"
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/Exporter.hpp>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
class utPbrtImportExport : public AbstractImportExportBase {
|
||||
public:
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
bool exporterTest() override {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(scene, nullptr );
|
||||
|
||||
::Assimp::Exporter exporter;
|
||||
return AI_SUCCESS == exporter.Export(scene, "pbrt", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_out.pbrt");
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
TEST_F(utPbrtImportExport, exportTest_Success) {
|
||||
EXPECT_TRUE(exporterTest());
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -57,18 +57,29 @@ public:
|
|||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure);
|
||||
|
||||
Exporter exporter;
|
||||
aiReturn res = exporter.Export(scene, "assjson", "./spider_test.json");
|
||||
const char *testFileName = "./spider_test.json";
|
||||
aiReturn res = exporter.Export(scene, "assjson", testFileName);
|
||||
if (aiReturn_SUCCESS != res) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Assimp::ExportProperties exportProperties;
|
||||
exportProperties.SetPropertyBool("JSON_SKIP_WHITESPACES", true);
|
||||
aiReturn resNoWhitespace = exporter.Export(scene, "assjson", "./spider_test_nowhitespace.json", 0u, &exportProperties);
|
||||
const char *testNoWhitespaceFileName = "./spider_test_nowhitespace.json";
|
||||
aiReturn resNoWhitespace = exporter.Export(scene, "assjson", testNoWhitespaceFileName, 0u, &exportProperties);
|
||||
if (aiReturn_SUCCESS != resNoWhitespace) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cleanup, remove generated json
|
||||
if (0 != std::remove(testFileName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 != std::remove(testNoWhitespaceFileName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -63,9 +63,7 @@ TEST(utCOBImporter, importDwarf) {
|
|||
TEST(utCOBImporter, importMoleculeASCII) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/COB/molecule_ascii.cob", aiProcess_ValidateDataStructure);
|
||||
// FIXME: this is wrong, it should succeed
|
||||
// change to ASSERT_NE after it's been fixed
|
||||
ASSERT_EQ(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
TEST(utCOBImporter, importMolecule) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ class utNFFImportExport : public AbstractImportExportBase {
|
|||
public:
|
||||
virtual bool importerTest() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/NFF/NFF/ManyEarthsNotJustOne.nff", 0);
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/NFF/ManyEarthsNotJustOne.nff", 0);
|
||||
return nullptr != scene;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ int main(int argc, char *argv[]) {
|
|||
// ............................................................................
|
||||
|
||||
// create a logger from both CPP
|
||||
Assimp::DefaultLogger::create("AssimpLog_Cpp.txt", Assimp::Logger::VERBOSE,
|
||||
Assimp::DefaultLogger::create("AssimpLog_Cpp.log", Assimp::Logger::VERBOSE,
|
||||
aiDefaultLogStream_STDOUT | aiDefaultLogStream_DEBUGGER | aiDefaultLogStream_FILE);
|
||||
|
||||
// .. and C. They should smoothly work together
|
||||
aiEnableVerboseLogging(AI_TRUE);
|
||||
aiLogStream logstream = aiGetPredefinedLogStream(aiDefaultLogStream_FILE, "AssimpLog_C.txt");
|
||||
aiLogStream logstream = aiGetPredefinedLogStream(aiDefaultLogStream_FILE, "AssimpLog_C.log");
|
||||
aiAttachLogStream(&logstream);
|
||||
|
||||
int result = RUN_ALL_TESTS();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
|
@ -73,7 +73,7 @@ public:
|
|||
virtual IOStream* Open( const char* pFile, const char* pMode = "rb" ) {
|
||||
EXPECT_NE( nullptr, pFile );
|
||||
EXPECT_NE( nullptr, pMode );
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual void Close( IOStream* pFile ) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public:
|
|||
aiColor3D color( 1, 0, 0 );
|
||||
EXPECT_EQ( AI_SUCCESS, scene->mMaterials[ 0 ]->AddProperty( &color, 1, AI_MATKEY_COLOR_DIFFUSE ) );
|
||||
|
||||
::srand( static_cast< unsigned int >( ::time( NULL ) ) );
|
||||
::srand(static_cast<unsigned int>(::time(nullptr)));
|
||||
opacity = float( rand() ) / float( RAND_MAX );
|
||||
EXPECT_EQ( AI_SUCCESS, scene->mMaterials[ 0 ]->AddProperty( &opacity, 1, AI_MATKEY_OPACITY ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
|
|
|||
|
|
@ -44,9 +44,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cstdlib>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
|
||||
#define TMP_PATH "./"
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define TMP_PATH "/tmp/"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <io.h>
|
||||
#define TMP_PATH "./"
|
||||
inline FILE* MakeTmpFile(char* tmplate)
|
||||
{
|
||||
auto pathtemplate = _mktemp(tmplate);
|
||||
|
|
@ -60,7 +65,6 @@ inline FILE* MakeTmpFile(char* tmplate)
|
|||
return fs;
|
||||
}
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define TMP_PATH "/tmp/"
|
||||
inline FILE* MakeTmpFile(char* tmplate)
|
||||
{
|
||||
auto fd = mkstemp(tmplate);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -65,3 +65,24 @@ TEST(ut3DImportExport, importBoxUC) {
|
|||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3D/box.uc", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST(ut3DImportExport, importMarRifle) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3D/mar_rifle.uc", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST(ut3DImportExport, importMarRifleA) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3D/mar_rifle_a.3d", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST(ut3DImportExport, importMarRifleD) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3D/mar_rifle_d.3d", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -70,3 +70,115 @@ TEST_F(ut3DSImportExport, import3DSformatdetection) {
|
|||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCameraRollAnim) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/CameraRollAnim.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCameraRollAnimWithChildObject) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/CameraRollAnimWithChildObject.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCubesWithAlpha) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/cubes_with_alpha.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCubeWithDiffuseTexture) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/cube_with_diffuse_texture.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCubeWithSpecularTexture) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/cube_with_specular_texture.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importRotatingCube) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/RotatingCube.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importTargetCameraAnim) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/TargetCameraAnim.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importTest1) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/3DS/test1.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importCartWheel) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/cart_wheel.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importGranate) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/Granate.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importJeep1) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/jeep1.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importMarRifle) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/mar_rifle.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importMp5Sil) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/mp5_sil.3ds", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ut3DSImportExport, importPyramob) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/3DS/pyramob.3DS", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -43,6 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
|
@ -68,6 +70,27 @@ TEST(utACImportExport, importSampleSubdiv) {
|
|||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/sample_subdiv.ac", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
// check approximate shape by averaging together all vertices
|
||||
ASSERT_EQ(scene->mNumMeshes, 1u);
|
||||
aiVector3D vertexAvg(0.0, 0.0, 0.0);
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; i++) {
|
||||
const aiMesh *mesh = scene->mMeshes[i];
|
||||
ASSERT_NE(mesh, nullptr);
|
||||
|
||||
ai_real invVertexCount = 1.0 / mesh->mNumVertices;
|
||||
for (unsigned int j = 0; j < mesh->mNumVertices; j++) {
|
||||
vertexAvg += mesh->mVertices[j] * invVertexCount;
|
||||
}
|
||||
}
|
||||
|
||||
// must not be inf or nan
|
||||
ASSERT_TRUE(std::isfinite(vertexAvg.x));
|
||||
ASSERT_TRUE(std::isfinite(vertexAvg.y));
|
||||
ASSERT_TRUE(std::isfinite(vertexAvg.z));
|
||||
EXPECT_NEAR(vertexAvg.x, 0.079997420310974121, 0.0001);
|
||||
EXPECT_NEAR(vertexAvg.y, 0.099498569965362549, 0.0001);
|
||||
EXPECT_NEAR(vertexAvg.z, -0.10344827175140381, 0.0001);
|
||||
}
|
||||
|
||||
TEST(utACImportExport, importSphereWithLight) {
|
||||
|
|
@ -76,6 +99,12 @@ TEST(utACImportExport, importSphereWithLight) {
|
|||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
TEST(utACImportExport, importSphereWithLightACC) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/SphereWithLight.acc", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
TEST(utACImportExport, importSphereWithLightUTF16) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/SphereWithLight_UTF16LE.ac", aiProcess_ValidateDataStructure);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -60,6 +60,81 @@ TEST_F(utAMFImportExport, importAMFFromFileTest) {
|
|||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
||||
|
||||
// TODO: test models-nonbsd/AMF/3_bananas.amf.7z
|
||||
// requires uncompressing it in memory and we don't currently have 7z decompressor
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest2) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test2.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest3) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test3.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest4) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test4.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest5) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test5.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest5a) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test5a.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest6) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test6.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest7) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test7.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// FIXME: these tests are disabled because they leak memory in AMFImporter_Postprocess.cpp
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest8) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test8.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importTest9) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test9.amf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
#endif // 0
|
||||
|
||||
|
||||
TEST_F(utAMFImportExport, importAMFWithMatFromFileTest) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test_with_mat.amf", aiProcess_ValidateDataStructure);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
|
@ -63,3 +64,112 @@ public:
|
|||
TEST_F(utASEImportExport, importACFromFileTest) {
|
||||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importAnim1) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/anim.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importAnim2) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/anim2.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importCameraRollAnim) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/CameraRollAnim.ase", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importMotionCaptureROM) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/MotionCaptureROM.ase", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importRotatingCube) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/RotatingCube.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importTargetCameraAnim) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TargetCameraAnim.ase", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importTestFormatDetection) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestFormatDetection", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importThreeCubesGreen) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
::Assimp::Importer importerLE;
|
||||
const aiScene *sceneLE = importerLE.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen_UTF16LE.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, sceneLE);
|
||||
|
||||
::Assimp::Importer importerBE;
|
||||
const aiScene *sceneBE = importerBE.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen_UTF16BE.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, sceneBE);
|
||||
|
||||
// TODO: these scenes should probably be identical
|
||||
// verify that is the case and then add tests to check it
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importUVTransform_Normal) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestUVTransform/UVTransform_Normal.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importUVTransform_ScaleUV1_2_OffsetUV0_0_9_Rotate_72_mirrorU) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestUVTransform/UVTransform_ScaleUV1-2_OffsetUV0-0.9_Rotate-72_mirrorU.ase", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importUVTransform_ScaleUV2x) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestUVTransform/UVTransform_ScaleUV2x.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utASEImportExport, importUVTransform_ScaleUV2x_Rotate45) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/ASE/TestUVTransform/UVTransform_ScaleUV2x_Rotate45.ASE", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -56,6 +56,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
TEST_F(utB3DImportExport, importACFromFileTest) {
|
||||
TEST_F(utB3DImportExport, importB3DFromFileTest) {
|
||||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -55,6 +55,20 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
TEST_F(utBVHImportExport, importBlenFromFileTest) {
|
||||
TEST_F(utBVHImportExport, import01_01) {
|
||||
EXPECT_TRUE(importerTest());
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utBVHImportExport, import01_03) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BVH/01_03.bvh", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utBVHImportExport, importBoxingToes) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BVH/Boxing_Toes.bvh", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -48,6 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
class BlendImportAreaLight : public ::testing::Test {
|
||||
public:
|
||||
BlendImportAreaLight() :
|
||||
im(nullptr) {}
|
||||
~BlendImportAreaLight() override = default;
|
||||
void SetUp() override {
|
||||
im = new Assimp::Importer();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ protected:
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
TEST_F(BlendImportMaterials, testImportMaterial) {
|
||||
const aiScene *pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/BlenderMaterial_269.blend", aiProcess_ValidateDataStructure);
|
||||
ASSERT_TRUE(pTest != NULL);
|
||||
ASSERT_TRUE(pTest != nullptr);
|
||||
ASSERT_TRUE(pTest->HasMaterials());
|
||||
|
||||
ASSERT_EQ(1U, pTest->mNumMaterials);
|
||||
|
|
@ -121,7 +121,7 @@ TEST_F(BlendImportMaterials, testImportMaterial) {
|
|||
|
||||
TEST_F(BlendImportMaterials, testImportMaterialwith2texturesAnd2TexCoordMappings) {
|
||||
const aiScene *pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/plane_2_textures_2_texcoords_279.blend", aiProcess_ValidateDataStructure);
|
||||
ASSERT_TRUE(pTest != NULL);
|
||||
ASSERT_TRUE(pTest != nullptr);
|
||||
|
||||
// material has 2 diffuse textures
|
||||
ASSERT_TRUE(pTest->HasMaterials());
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <assimp/postprocess.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/scene.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
|
@ -156,6 +157,27 @@ TEST(utBlenderImporter, importSuzanneSubdiv_252) {
|
|||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/SuzanneSubdiv_252.blend", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
// check approximate shape by averaging together all vertices
|
||||
ASSERT_EQ(scene->mNumMeshes, 1u);
|
||||
aiVector3D vertexAvg(0.0, 0.0, 0.0);
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; i++) {
|
||||
const aiMesh *mesh = scene->mMeshes[i];
|
||||
ASSERT_NE(mesh, nullptr);
|
||||
|
||||
ai_real invVertexCount = 1.0 / mesh->mNumVertices;
|
||||
for (unsigned int j = 0; j < mesh->mNumVertices; j++) {
|
||||
vertexAvg += mesh->mVertices[j] * invVertexCount;
|
||||
}
|
||||
}
|
||||
|
||||
// must not be inf or nan
|
||||
ASSERT_TRUE(std::isfinite(vertexAvg.x));
|
||||
ASSERT_TRUE(std::isfinite(vertexAvg.y));
|
||||
ASSERT_TRUE(std::isfinite(vertexAvg.z));
|
||||
EXPECT_NEAR(vertexAvg.x, 6.4022515289252624e-08, 0.0001);
|
||||
EXPECT_NEAR(vertexAvg.y, 0.060569953173398972, 0.0001);
|
||||
EXPECT_NEAR(vertexAvg.z, 0.31429031491279602, 0.0001);
|
||||
}
|
||||
|
||||
TEST(utBlenderImporter, importTexturedCube_ImageGlob_248) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -48,11 +48,14 @@ using namespace ::Assimp;
|
|||
|
||||
class BlenderWorkTest : public ::testing::Test {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
BlenderWorkTest() : im(nullptr) {}
|
||||
~BlenderWorkTest() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
im = new Assimp::Importer();
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
void TearDown() override {
|
||||
delete im;
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +65,7 @@ protected:
|
|||
|
||||
TEST_F(BlenderWorkTest, work_279) {
|
||||
const aiScene *pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/test_279.blend", aiProcess_ValidateDataStructure);
|
||||
ASSERT_TRUE(pTest != NULL);
|
||||
ASSERT_TRUE(pTest != nullptr);
|
||||
|
||||
// material has 2 diffuse textures
|
||||
ASSERT_TRUE(pTest->HasMaterials());
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -114,6 +114,9 @@ TEST_F(utColladaExport, testExportCamera) {
|
|||
EXPECT_FLOAT_EQ(pos[i].y, read->mPosition.y);
|
||||
EXPECT_FLOAT_EQ(pos[i].z, read->mPosition.z);
|
||||
}
|
||||
|
||||
// Cleanup, delete the exported file
|
||||
EXPECT_EQ(0, std::remove(file));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
@ -169,7 +172,7 @@ TEST_F(utColladaExport, testExportLight) {
|
|||
|
||||
const aiScene *imported = im->ReadFile(file, aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_TRUE(imported != NULL);
|
||||
ASSERT_TRUE(imported != nullptr);
|
||||
|
||||
// Check common metadata survived roundtrip
|
||||
aiString readImporter;
|
||||
|
|
@ -220,6 +223,9 @@ TEST_F(utColladaExport, testExportLight) {
|
|||
EXPECT_NEAR(orig->mAngleInnerCone, read->mAngleInnerCone, 0.001);
|
||||
EXPECT_NEAR(orig->mAngleOuterCone, read->mAngleOuterCone, 0.001);
|
||||
}
|
||||
|
||||
// Cleanup, delete the exported file
|
||||
EXPECT_EQ(0, std::remove(file));
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -357,6 +357,14 @@ TEST_F(utColladaImportExport, exporterUniqueIdsTest) {
|
|||
ImportAsNames(outFileNamed, scene);
|
||||
}
|
||||
|
||||
// This file is invalid, we just want to ensure that the importer is not crashing
|
||||
// This was reported as GH#4286. The "count" parameter in "Cube-mesh-positions-array" is too small.
|
||||
TEST_F(utColladaImportExport, parseInvalid4286) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/invalid/box_nested_animation_4286.dae", 0);
|
||||
EXPECT_EQ(nullptr, scene);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
class utColladaZaeImportExport : public AbstractImportExportBase {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -85,15 +85,15 @@ TEST_F(utD3MFImporterExporter, import3MFFromFileTest) {
|
|||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
TEST_F(utD3MFImporterExporter, export3MFtoMemTest) {
|
||||
EXPECT_TRUE(exporterTest());
|
||||
//EXPECT_TRUE(exporterTest());
|
||||
}
|
||||
|
||||
TEST_F(utD3MFImporterExporter, roundtrip3MFtoMemTest) {
|
||||
EXPECT_TRUE(exporterTest());
|
||||
/*EXPECT_TRUE(exporterTest());
|
||||
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile("test.3mf", 0);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene));*/
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -71,3 +71,17 @@ TEST_F(utDXFImporterExporter, issue2229) {
|
|||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/DXF/issue_2229.dxf", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utDXFImporterExporter, importWuson) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/DXF/wuson.dxf", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utDXFImporterExporter, importRifle) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/DXF/rifle.dxf", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,38 +1,71 @@
|
|||
#include "UnitTestPCH.h"
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "UnitTestPCH.h"
|
||||
#include <assimp/cexport.h>
|
||||
#include <assimp/Exporter.hpp>
|
||||
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
class ExporterTest : public ::testing::Test {
|
||||
public:
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
void SetUp() override {
|
||||
ex = new Assimp::Exporter();
|
||||
im = new Assimp::Importer();
|
||||
|
||||
pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test.x", aiProcess_ValidateDataStructure);
|
||||
}
|
||||
|
||||
virtual void TearDown()
|
||||
{
|
||||
void TearDown() override {
|
||||
delete ex;
|
||||
delete im;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
const aiScene* pTest;
|
||||
Assimp::Exporter* ex;
|
||||
Assimp::Importer* im;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
TEST_F(ExporterTest, testExportToFile)
|
||||
{
|
||||
TEST_F(ExporterTest, testExportToFile) {
|
||||
const char* file = "unittest_output.dae";
|
||||
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
|
||||
|
||||
|
|
@ -41,8 +74,7 @@ TEST_F(ExporterTest, testExportToFile)
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
TEST_F(ExporterTest, testExportToBlob)
|
||||
{
|
||||
TEST_F(ExporterTest, testExportToBlob) {
|
||||
const aiExportDataBlob* blob = ex->ExportToBlob(pTest,"collada");
|
||||
ASSERT_TRUE(blob);
|
||||
EXPECT_TRUE(blob->data);
|
||||
|
|
@ -56,8 +88,7 @@ TEST_F(ExporterTest, testExportToBlob)
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
TEST_F(ExporterTest, testCppExportInterface)
|
||||
{
|
||||
TEST_F(ExporterTest, testCppExportInterface) {
|
||||
EXPECT_TRUE(ex->GetExportFormatCount() > 0);
|
||||
for(size_t i = 0; i < ex->GetExportFormatCount(); ++i) {
|
||||
const aiExportFormatDesc* const desc = ex->GetExportFormatDescription(i);
|
||||
|
|
@ -71,14 +102,13 @@ TEST_F(ExporterTest, testCppExportInterface)
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
TEST_F(ExporterTest, testCExportInterface)
|
||||
{
|
||||
TEST_F(ExporterTest, testCExportInterface) {
|
||||
EXPECT_TRUE(aiGetExportFormatCount() > 0);
|
||||
for(size_t i = 0; i < aiGetExportFormatCount(); ++i) {
|
||||
const aiExportFormatDesc* const desc = aiGetExportFormatDescription(i);
|
||||
EXPECT_TRUE(desc);
|
||||
// rest has already been validated by testCppExportInterface
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -311,6 +311,37 @@ TEST_F(utFBXImporterExporter, sceneMetadata) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(utFBXImporterExporter, importCustomAxes) {
|
||||
// see https://github.com/assimp/assimp/issues/5494
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box.FBX", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
|
||||
// The ASCII box has customised the Up and Forward axes, verify that the RootNode transform has applied it
|
||||
ASSERT_FALSE(scene->mRootNode->mTransformation.IsIdentity()) << "Did not apply the custom axis transform";
|
||||
|
||||
aiVector3D upVec{ 0, 0, 1 }; // Up is +Z
|
||||
aiVector3D forwardVec{ 0, -1, 0 }; // Forward is -Y
|
||||
aiVector3D rightVec{ 1, 0, 0 }; // Right is +X
|
||||
aiMatrix4x4 mat(rightVec.x, rightVec.y, rightVec.z, 0.0f,
|
||||
upVec.x, upVec.y, upVec.z, 0.0f,
|
||||
forwardVec.x, forwardVec.y, forwardVec.z, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
EXPECT_EQ(mat, scene->mRootNode->mTransformation);
|
||||
}
|
||||
|
||||
TEST_F(utFBXImporterExporter, importIgnoreCustomAxes) {
|
||||
// see https://github.com/assimp/assimp/issues/5494
|
||||
Assimp::Importer importer;
|
||||
importer.SetPropertyBool(AI_CONFIG_IMPORT_FBX_IGNORE_UP_DIRECTION, true);
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box.FBX", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
|
||||
// Verify that the RootNode transform has NOT applied the custom axes
|
||||
EXPECT_TRUE(scene->mRootNode->mTransformation.IsIdentity());
|
||||
}
|
||||
|
||||
TEST_F(utFBXImporterExporter, importCubesWithOutOfRangeFloat) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/cubes_with_outofrange_float.fbx", aiProcess_ValidateDataStructure);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -206,3 +206,38 @@ TEST_F(FindDegeneratesProcessTest, meshRemoval) {
|
|||
EXPECT_EQ(scene->mRootNode->mNumMeshes, 1u);
|
||||
EXPECT_EQ(scene->mRootNode->mMeshes[0], 0u);
|
||||
}
|
||||
|
||||
TEST_F(FindDegeneratesProcessTest, invalidVertexIndex) {
|
||||
mProcess->EnableAreaCheck(true);
|
||||
mProcess->EnableInstantRemoval(true);
|
||||
mProcess->ExecuteOnMesh(mMesh);
|
||||
|
||||
std::unique_ptr<aiScene> scene(new aiScene);
|
||||
scene->mNumMeshes = 1;
|
||||
scene->mMeshes = new aiMesh *[1];
|
||||
|
||||
std::unique_ptr<aiMesh> mesh(new aiMesh);
|
||||
mesh->mNumVertices = 1;
|
||||
mesh->mVertices = new aiVector3D[1];
|
||||
mesh->mVertices[0] = aiVector3D{ 0.0f, 0.0f, 0.0f };
|
||||
mesh->mNumFaces = 1;
|
||||
mesh->mFaces = new aiFace[1];
|
||||
mesh->mFaces[0].mNumIndices = 3;
|
||||
mesh->mFaces[0].mIndices = new unsigned int[3];
|
||||
mesh->mFaces[0].mIndices[0] = 0;
|
||||
mesh->mFaces[0].mIndices[1] = 1;
|
||||
mesh->mFaces[0].mIndices[2] = 99999;
|
||||
|
||||
scene->mMeshes[0] = mesh.release();
|
||||
|
||||
scene->mRootNode = new aiNode;
|
||||
scene->mRootNode->mNumMeshes = 1;
|
||||
scene->mRootNode->mMeshes = new unsigned int[1];
|
||||
scene->mRootNode->mMeshes[0] = 0;
|
||||
|
||||
mProcess->Execute(scene.get());
|
||||
|
||||
EXPECT_EQ(scene->mNumMeshes, 1u);
|
||||
EXPECT_EQ(scene->mRootNode->mNumMeshes, 1u);
|
||||
EXPECT_EQ(scene->mRootNode->mMeshes[0], 0u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -115,17 +115,17 @@ TEST_F(utFindInvalidDataProcess, testStepNegativeResult) {
|
|||
|
||||
mProcess->ProcessMesh(mMesh);
|
||||
|
||||
EXPECT_TRUE(NULL != mMesh->mVertices);
|
||||
EXPECT_EQ(NULL, mMesh->mNormals);
|
||||
EXPECT_EQ(NULL, mMesh->mTangents);
|
||||
EXPECT_EQ(NULL, mMesh->mBitangents);
|
||||
EXPECT_TRUE(nullptr != mMesh->mVertices);
|
||||
EXPECT_EQ(nullptr, mMesh->mNormals);
|
||||
EXPECT_EQ(nullptr, mMesh->mTangents);
|
||||
EXPECT_EQ(nullptr, mMesh->mBitangents);
|
||||
|
||||
for (unsigned int i = 0; i < 2; ++i) {
|
||||
EXPECT_TRUE(NULL != mMesh->mTextureCoords[i]);
|
||||
EXPECT_TRUE(nullptr != mMesh->mTextureCoords[i]);
|
||||
}
|
||||
|
||||
for (unsigned int i = 2; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
||||
EXPECT_EQ(NULL, mMesh->mTextureCoords[i]);
|
||||
EXPECT_EQ(nullptr, mMesh->mTextureCoords[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -82,5 +82,5 @@ void GenNormalsTest::TearDown() {
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
TEST_F(GenNormalsTest, testSimpleTriangle) {
|
||||
piProcess->GenMeshVertexNormals(pcMesh, 0);
|
||||
EXPECT_TRUE(pcMesh->mNormals != NULL);
|
||||
EXPECT_TRUE(pcMesh->mNormals != nullptr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ TEST_F(ImporterTest, testMemoryRead) {
|
|||
const aiScene *sc = pImp->ReadFileFromMemory(InputData_abRawBlock, InputData_BLOCK_SIZE,
|
||||
aiProcessPreset_TargetRealtime_Quality, "3ds");
|
||||
|
||||
ASSERT_TRUE(sc != NULL);
|
||||
ASSERT_TRUE(sc != nullptr);
|
||||
EXPECT_EQ(aiString("<3DSRoot>"), sc->mRootNode->mName);
|
||||
EXPECT_EQ(1U, sc->mNumMeshes);
|
||||
EXPECT_EQ(24U, sc->mMeshes[0]->mNumVertices);
|
||||
|
|
@ -220,10 +220,10 @@ TEST_F(ImporterTest, testPluginInterface) {
|
|||
EXPECT_FALSE(pImp->IsExtensionSupported("."));
|
||||
|
||||
TestPlugin *p = (TestPlugin *)pImp->GetImporter(".windows");
|
||||
ASSERT_TRUE(NULL != p);
|
||||
ASSERT_TRUE(nullptr != p);
|
||||
|
||||
try {
|
||||
p->InternReadFile("", 0, NULL);
|
||||
p->InternReadFile("", nullptr, nullptr);
|
||||
} catch (const DeadlyImportError &dead) {
|
||||
EXPECT_TRUE(!strcmp(dead.what(), AIUT_DEF_ERROR_TEXT));
|
||||
|
||||
|
|
@ -361,3 +361,37 @@ TEST_F(ImporterTest, unexpectedException) {
|
|||
EXPECT_TRUE(false);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
struct ExtensionTestCase {
|
||||
std::string testName;
|
||||
std::string filename;
|
||||
std::string getExtensionResult;
|
||||
std::string hasExtension;
|
||||
bool hasExtensionResult;
|
||||
};
|
||||
|
||||
using ExtensionTest = ::testing::TestWithParam<ExtensionTestCase>;
|
||||
|
||||
TEST_P(ExtensionTest, testGetAndHasExtension) {
|
||||
const ExtensionTestCase& testCase = GetParam();
|
||||
EXPECT_EQ(testCase.getExtensionResult, BaseImporter::GetExtension(testCase.filename));
|
||||
EXPECT_EQ(testCase.hasExtensionResult, BaseImporter::HasExtension(testCase.filename, {testCase.hasExtension}));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ExtensionTests, ExtensionTest,
|
||||
::testing::ValuesIn<ExtensionTestCase>({
|
||||
{"NoExtension", "name", "", "glb", false},
|
||||
{"NoExtensionAndEmptyVersion", "name#", "", "glb", false},
|
||||
{"WithExtensionAndEmptyVersion", "name.glb#", "glb#", "glb", false},
|
||||
{"WithExtensionAndVersion", "name.glb#1234", "glb", "glb", true},
|
||||
{"WithExtensionAndHashInStem", "name#1234.glb", "glb", "glb", true},
|
||||
{"WithExtensionAndInvalidVersion", "name.glb#_", "glb#_", "glb", false},
|
||||
{"WithExtensionAndDotAndHashInStem", "name.glb#.abc", "abc", "glb", false},
|
||||
{"WithTwoExtensions", "name.abc.def", "def", "abc.def", true},
|
||||
}),
|
||||
[](const ::testing::TestParamInfo<ExtensionTest::ParamType>& info) {
|
||||
return info.param.testName;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -51,21 +49,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
using namespace Assimp;
|
||||
|
||||
class utIssues : public ::testing::Test {
|
||||
// empty
|
||||
};
|
||||
class utIssues : public ::testing::Test {};
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
TEST_F( utIssues, OpacityBugWhenExporting_727 ) {
|
||||
float opacity;
|
||||
aiScene *scene( TestModelFacttory::createDefaultTestModel( opacity ) );
|
||||
aiScene *scene = TestModelFacttory::createDefaultTestModel(opacity);
|
||||
Assimp::Importer importer;
|
||||
Assimp::Exporter exporter;
|
||||
|
||||
std::string path = "dae";
|
||||
const aiExportFormatDesc *desc = exporter.GetExportFormatDescription( 0 );
|
||||
EXPECT_NE( desc, nullptr );
|
||||
ASSERT_NE( desc, nullptr );
|
||||
|
||||
std::string path = "dae";
|
||||
path.append(".");
|
||||
path.append( desc->fileExtension );
|
||||
EXPECT_EQ( AI_SUCCESS, exporter.Export( scene, desc->id, path ) );
|
||||
|
|
@ -73,11 +70,13 @@ TEST_F( utIssues, OpacityBugWhenExporting_727 ) {
|
|||
ASSERT_NE( nullptr, newScene );
|
||||
float newOpacity;
|
||||
if ( newScene->mNumMaterials > 0 ) {
|
||||
std::cout << "Desc = " << desc->description << "\n";
|
||||
EXPECT_EQ( AI_SUCCESS, newScene->mMaterials[ 0 ]->Get( AI_MATKEY_OPACITY, newOpacity ) );
|
||||
EXPECT_FLOAT_EQ( opacity, newOpacity );
|
||||
}
|
||||
delete scene;
|
||||
|
||||
// Cleanup. Delete exported dae.dae file
|
||||
EXPECT_EQ(0, std::remove(path.c_str()));
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -75,3 +75,315 @@ TEST_F(utLWOImportExport, importLWOformatdetection) {
|
|||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOempty) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/invalid/empty.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_EQ(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWObox_2uv_1unused) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/box_2uv_1unused.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWObox_2vc_1unused) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/box_2vc_1unused.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOconcave_polygon) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/concave_polygon.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOconcave_self_intersecting) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/concave_self_intersecting.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOhierarchy) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/hierarchy.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOhierarchy_smoothed) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/hierarchy_smoothed.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_cylindrical_x) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_cylindrical_x.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_cylindrical_x_scale_222_wrap_21) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_cylindrical_x_scale_222_wrap_21.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_cylindrical_y) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_cylindrical_y.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_cylindrical_y_scale_111) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_cylindrical_y_scale_111.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_cylindrical_y_scale_111_wrap_21) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_cylindrical_y_scale_111_wrap_21.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_cylindrical_z) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_cylindrical_z.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_planar_x) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_planar_x.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_planar_y) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_planar_y.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_planar_z) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_planar_z.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_planar_z_scale_111) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_planar_z_scale_111.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_spherical_x) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_spherical_x.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_spherical_x_scale_222_wrap_22) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_spherical_x_scale_222_wrap_22.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_spherical_y) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_spherical_y.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_spherical_) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_spherical_z.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_spherical_z_wrap_22) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_spherical_z_wrap_22.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOearth_uv_cylindrical_y) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/MappingModes/earth_uv_cylindrical_y.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOModoExport_vertNormals) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/ModoExport_vertNormals.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOnonplanar_polygon) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/nonplanar_polygon.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOCellShader) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/shader_test/CellShader.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOfastFresne) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/shader_test/fastFresnel.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOrealFresnel) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/shader_test/realFresnel.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOSuperCellShader) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/shader_test/SuperCellShader.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOsphere_with_gradient) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/sphere_with_gradient.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOsphere_with_mat_gloss_10pc) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/sphere_with_mat_gloss_10pc.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOSubdivision) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/Subdivision.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOtransparency) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/transparency.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOUglyVertexColors) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/UglyVertexColors.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOuvtest) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWO2/uvtest.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOBConcavePolygon) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWOB/ConcavePolygon.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(utLWOImportExport, importLWOBbluewithcylindrictex) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/LWO/LWOB/MappingModes/bluewithcylindrictexz.lwo", aiProcess_ValidateDataStructure);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -260,6 +260,10 @@ TEST_F(MaterialSystemTest, testMaterialTextureTypeEnum) {
|
|||
case aiTextureType_METALNESS:
|
||||
case aiTextureType_DIFFUSE_ROUGHNESS:
|
||||
case aiTextureType_AMBIENT_OCCLUSION:
|
||||
case aiTextureType_MAYA_BASE:
|
||||
case aiTextureType_MAYA_SPECULAR:
|
||||
case aiTextureType_MAYA_SPECULAR_COLOR:
|
||||
case aiTextureType_MAYA_SPECULAR_ROUGHNESS:
|
||||
case aiTextureType_SHEEN:
|
||||
case aiTextureType_CLEARCOAT:
|
||||
case aiTextureType_TRANSMISSION:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class utMatrix4x4 : public ::testing::Test {
|
|||
TEST_F(utMatrix4x4, badIndexOperatorTest) {
|
||||
aiMatrix4x4 m;
|
||||
ai_real *a0 = m[4];
|
||||
EXPECT_EQ(NULL, a0);
|
||||
EXPECT_EQ(nullptr, a0);
|
||||
}
|
||||
|
||||
TEST_F(utMatrix4x4, indexOperatorTest) {
|
||||
|
|
@ -90,3 +90,17 @@ TEST_F(utMatrix4x4, indexOperatorTest) {
|
|||
ai_real *a15 = a12 + 3;
|
||||
EXPECT_FLOAT_EQ(1.0, *a15);
|
||||
}
|
||||
|
||||
TEST_F(utMatrix4x4, identityMatrixTest) {
|
||||
aiMatrix4x4 m1 = aiMatrix4x4(1.f,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0, 1);
|
||||
EXPECT_TRUE(m1.IsIdentity());
|
||||
aiMatrix4x4 m2 = aiMatrix4x4(1.02f,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0, 1);
|
||||
EXPECT_FALSE(m2.IsIdentity());
|
||||
aiMatrix4x4 m3 = aiMatrix4x4(1.009f,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0, 1);
|
||||
EXPECT_TRUE(m3.IsIdentity());
|
||||
|
||||
EXPECT_TRUE(m1.IsIdentity(1e-3f));
|
||||
EXPECT_FALSE(m2.IsIdentity(1e-3f));
|
||||
EXPECT_TRUE(m2.IsIdentity(1e-1f));
|
||||
EXPECT_FALSE(m3.IsIdentity(1e-3f));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -84,7 +82,7 @@ TEST_F( utMetadata, allocTest ) {
|
|||
}
|
||||
|
||||
TEST_F( utMetadata, get_set_pod_Test ) {
|
||||
m_data = aiMetadata::Alloc( 5 );
|
||||
m_data = aiMetadata::Alloc( 7 );
|
||||
|
||||
// int, 32 bit
|
||||
unsigned int index( 0 );
|
||||
|
|
@ -137,6 +135,28 @@ TEST_F( utMetadata, get_set_pod_Test ) {
|
|||
EXPECT_TRUE( success );
|
||||
EXPECT_DOUBLE_EQ( 3.0, result_double );
|
||||
|
||||
// int64_t
|
||||
index++;
|
||||
const std::string key_int64 = "test_int64";
|
||||
int64_t val_int64 = 64;
|
||||
success = m_data->Set(index, key_int64, val_int64);
|
||||
EXPECT_TRUE(success);
|
||||
int64_t result_int64(0);
|
||||
success = m_data->Get(key_int64, result_int64);
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(result_int64, val_int64);
|
||||
|
||||
// uint32
|
||||
index++;
|
||||
const std::string key_uint32 = "test_uint32";
|
||||
int64_t val_uint32 = 32;
|
||||
success = m_data->Set(index, key_uint32, val_uint32);
|
||||
EXPECT_TRUE(success);
|
||||
int64_t result_uint32(0);
|
||||
success = m_data->Get(key_uint32, result_uint32);
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(result_uint32, val_uint32);
|
||||
|
||||
// error
|
||||
int result;
|
||||
success = m_data->Get( "bla", result );
|
||||
|
|
@ -181,6 +201,7 @@ TEST_F( utMetadata, get_set_aiVector3D_Test ) {
|
|||
EXPECT_TRUE( success );
|
||||
}
|
||||
|
||||
|
||||
TEST_F( utMetadata, copy_test ) {
|
||||
m_data = aiMetadata::Alloc( AI_META_MAX );
|
||||
bool bv = true;
|
||||
|
|
@ -199,9 +220,12 @@ TEST_F( utMetadata, copy_test ) {
|
|||
m_data->Set( 6, "aiVector3D", vecVal );
|
||||
aiMetadata metaVal;
|
||||
m_data->Set( 7, "aiMetadata", metaVal );
|
||||
|
||||
aiMetadata copy( *m_data );
|
||||
EXPECT_EQ( 8u, copy.mNumProperties );
|
||||
int64_t i64 = 64;
|
||||
m_data->Set(8, "int64_t", i64);
|
||||
uint32_t ui32 = 32;
|
||||
m_data->Set(9, "uint32_t", ui32);
|
||||
aiMetadata copy(*m_data);
|
||||
EXPECT_EQ( 10u, copy.mNumProperties );
|
||||
|
||||
// bool test
|
||||
{
|
||||
|
|
@ -212,15 +236,31 @@ TEST_F( utMetadata, copy_test ) {
|
|||
|
||||
// int32_t test
|
||||
{
|
||||
int32_t v = 0;
|
||||
int32_t v = 127;
|
||||
bool ok = copy.Get( "int32", v );
|
||||
EXPECT_TRUE( ok );
|
||||
EXPECT_EQ( i32v, v );
|
||||
}
|
||||
|
||||
// uint32_t test
|
||||
{
|
||||
uint32_t v = 0;
|
||||
bool ok = copy.Get("uint32_t", v);
|
||||
EXPECT_TRUE(ok);
|
||||
EXPECT_EQ( ui32, v );
|
||||
}
|
||||
|
||||
// int64_t test
|
||||
{
|
||||
int64_t v = -1;
|
||||
bool ok = copy.Get("int64_t", v);
|
||||
EXPECT_TRUE(ok);
|
||||
EXPECT_EQ( i64, v );
|
||||
}
|
||||
|
||||
// uint64_t test
|
||||
{
|
||||
uint64_t v;
|
||||
uint64_t v = 255;
|
||||
bool ok = copy.Get( "uint64", v );
|
||||
EXPECT_TRUE( ok );
|
||||
EXPECT_EQ( ui64v, v );
|
||||
|
|
@ -228,26 +268,26 @@ TEST_F( utMetadata, copy_test ) {
|
|||
|
||||
// float test
|
||||
{
|
||||
float v;
|
||||
float v = -9.9999f;
|
||||
EXPECT_TRUE( copy.Get( "float", v ) );
|
||||
EXPECT_EQ( fv, v );
|
||||
}
|
||||
|
||||
// double test
|
||||
{
|
||||
double v;
|
||||
double v = -99.99;
|
||||
EXPECT_TRUE( copy.Get( "double", v ) );
|
||||
EXPECT_EQ( dv, v );
|
||||
}
|
||||
|
||||
// bool test
|
||||
// string test
|
||||
{
|
||||
aiString v;
|
||||
EXPECT_TRUE( copy.Get( "aiString", v ) );
|
||||
EXPECT_EQ( strVal, v );
|
||||
}
|
||||
|
||||
// bool test
|
||||
// vector test
|
||||
{
|
||||
aiVector3D v;
|
||||
EXPECT_TRUE( copy.Get( "aiVector3D", v ) );
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -286,6 +286,54 @@ TEST_F(utObjImportExport, issue1923_vertex_color_Test) {
|
|||
delete scene;
|
||||
}
|
||||
|
||||
TEST_F(utObjImportExport, only_a_part_of_vertex_colors_Test) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *const scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/only_a_part_of_vertexcolors.obj", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
|
||||
EXPECT_EQ(scene->mNumMeshes, 1U);
|
||||
const aiMesh *const mesh = scene->mMeshes[0];
|
||||
EXPECT_EQ(mesh->mNumVertices, 9U);
|
||||
EXPECT_EQ(mesh->mNumFaces, 3U);
|
||||
EXPECT_TRUE(mesh->HasVertexColors(0));
|
||||
|
||||
const aiVector3D *const vertices = mesh->mVertices;
|
||||
const aiColor4D *const colors = mesh->mColors[0];
|
||||
EXPECT_EQ(aiVector3D(0.0f, 0.0f, 0.0f), vertices[0]);
|
||||
EXPECT_EQ(aiColor4D(0.0f, 0.0f, 0.0f, 1.0f), colors[0]);
|
||||
EXPECT_EQ(aiVector3D(0.0f, 0.0f, 1.0f), vertices[1]);
|
||||
EXPECT_EQ(aiColor4D(0.0f, 0.0f, 1.0f, 1.0f), colors[1]);
|
||||
EXPECT_EQ(aiVector3D(0.0f, 1.0f, 0.0f), vertices[2]);
|
||||
EXPECT_EQ(aiColor4D(0.0f, 0.0f, 0.0f, 1.0f), colors[2]);
|
||||
EXPECT_EQ(aiVector3D(0.0f, 0.0f, 0.0f), vertices[3]);
|
||||
EXPECT_EQ(aiColor4D(0.0f, 0.0f, 0.0f, 1.0f), colors[3]);
|
||||
EXPECT_EQ(aiVector3D(1.0f, 0.0f, 0.0f), vertices[4]);
|
||||
EXPECT_EQ(aiColor4D(1.0f, 0.6f, 0.3f, 1.0f), colors[4]);
|
||||
EXPECT_EQ(aiVector3D(0.0f, 1.0f, 0.0f), vertices[5]);
|
||||
EXPECT_EQ(aiColor4D(0.0f, 0.0f, 0.0f, 1.0f), colors[5]);
|
||||
EXPECT_EQ(aiVector3D(0.0f, 0.0f, 1.0f), vertices[6]);
|
||||
EXPECT_EQ(aiColor4D(0.0f, 0.0f, 1.0f, 1.0f), colors[6]);
|
||||
EXPECT_EQ(aiVector3D(1.0f, 1.0f, 0.0f), vertices[7]);
|
||||
EXPECT_EQ(aiColor4D(0.0f, 0.0f, 0.0f, 1.0f), colors[7]);
|
||||
EXPECT_EQ(aiVector3D(1.0f, 0.0f, 0.0f), vertices[8]);
|
||||
EXPECT_EQ(aiColor4D(1.0f, 0.6f, 0.3f, 1.0f), colors[8]);
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
::Assimp::Exporter exporter;
|
||||
EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "obj", ASSIMP_TEST_MODELS_DIR "/OBJ/test_out.obj"));
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
}
|
||||
|
||||
TEST_F(utObjImportExport, no_vertex_colors_Test) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *const scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/box.obj", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
|
||||
EXPECT_EQ(scene->mNumMeshes, 1U);
|
||||
const aiMesh *const mesh = scene->mMeshes[0];
|
||||
EXPECT_FALSE(mesh->HasVertexColors(0));
|
||||
}
|
||||
|
||||
TEST_F(utObjImportExport, issue1453_segfault) {
|
||||
static const char *curObjModel =
|
||||
"v 0.0 0.0 0.0\n"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ TEST_F(utPLYImportExport, exportTest_Success) {
|
|||
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
//Test issue 1623, crash when loading two PLY files in a row
|
||||
// Test issue 1623, crash when loading two PLY files in a row
|
||||
TEST_F(utPLYImportExport, importerMultipleTest) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", aiProcess_ValidateDataStructure);
|
||||
|
|
@ -109,7 +109,7 @@ TEST_F(utPLYImportExport, importPLYwithUV) {
|
|||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMeshes[0]);
|
||||
//This test model is using n-gons, so 6 faces instead of 12 tris
|
||||
// This test model is using n-gons, so 6 faces instead of 12 tris
|
||||
EXPECT_EQ(6u, scene->mMeshes[0]->mNumFaces);
|
||||
EXPECT_EQ(aiPrimitiveType_POLYGON, scene->mMeshes[0]->mPrimitiveTypes);
|
||||
EXPECT_EQ(true, scene->mMeshes[0]->HasTextureCoords(0));
|
||||
|
|
@ -121,10 +121,26 @@ TEST_F(utPLYImportExport, importBinaryPLY) {
|
|||
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_NE(nullptr, scene->mMeshes[0]);
|
||||
//This test model is double sided, so 12 faces instead of 6
|
||||
// This test model is double sided, so 12 faces instead of 6
|
||||
EXPECT_EQ(12u, scene->mMeshes[0]->mNumFaces);
|
||||
}
|
||||
|
||||
// Tests of a PLY file gets read with \r\n as newlines instead of just \n (i.e. solidwork exported ply files)
|
||||
TEST_F(utPLYImportExport, importBinaryPLYWithRNNewline) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube_binary_header_with_RN_newline.ply", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMeshes[0]);
|
||||
// This test model is double sided, so 12 faces instead of 6
|
||||
ASSERT_EQ(12u, scene->mMeshes[0]->mNumFaces);
|
||||
// Also check if the indices were parsed correctly
|
||||
ASSERT_EQ(3u, scene->mMeshes[0]->mFaces[0].mNumIndices);
|
||||
EXPECT_EQ(0u, scene->mMeshes[0]->mFaces[0].mIndices[0]);
|
||||
EXPECT_EQ(1u, scene->mMeshes[0]->mFaces[0].mIndices[1]);
|
||||
EXPECT_EQ(2u, scene->mMeshes[0]->mFaces[0].mIndices[2]);
|
||||
}
|
||||
|
||||
TEST_F(utPLYImportExport, vertexColorTest) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/float-color.ply", aiProcess_ValidateDataStructure);
|
||||
|
|
@ -144,7 +160,7 @@ TEST_F(utPLYImportExport, vertexColorTest) {
|
|||
TEST_F(utPLYImportExport, pointcloudTest) {
|
||||
Assimp::Importer importer;
|
||||
|
||||
//Could not use aiProcess_ValidateDataStructure since it's missing faces.
|
||||
// Could not use aiProcess_ValidateDataStructure since it's missing faces.
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/issue623.ply", 0);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
|
||||
|
|
@ -176,7 +192,72 @@ static const char *test_file =
|
|||
|
||||
TEST_F(utPLYImportExport, parseErrorTest) {
|
||||
Assimp::Importer importer;
|
||||
//Could not use aiProcess_ValidateDataStructure since it's missing faces.
|
||||
// Could not use aiProcess_ValidateDataStructure since it's missing faces.
|
||||
const aiScene *scene = importer.ReadFileFromMemory(test_file, strlen(test_file), 0);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
// This file is invalid, we just want to ensure that the importer is not crashing
|
||||
TEST_F(utPLYImportExport, parseInvalid) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/invalid/crash-30d6d0f7c529b3b66b4131700b7a4580cd7082df.ply", 0);
|
||||
EXPECT_EQ(nullptr, scene);
|
||||
}
|
||||
|
||||
TEST_F(utPLYImportExport, payload_JVN42386607) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/payload_JVN42386607", 0);
|
||||
EXPECT_EQ(nullptr, scene);
|
||||
}
|
||||
|
||||
// Tests Issue #5729. Test, if properties defined multiple times. Unclear what to do, better to abort than to crash entirely
|
||||
TEST_F(utPLYImportExport, parseInvalidDoubleProperty) {
|
||||
const char data[] = "ply\n"
|
||||
"format ascii 1.0\n"
|
||||
"element vertex 4\n"
|
||||
"property float x\n"
|
||||
"property float y\n"
|
||||
"property float z\n"
|
||||
"element vertex 8\n"
|
||||
"property float x\n"
|
||||
"property float y\n"
|
||||
"property float z\n"
|
||||
"end_header\n"
|
||||
"0.0 0.0 0.0 0.0 0.0 0.0\n"
|
||||
"0.0 0.0 1.0 0.0 0.0 1.0\n"
|
||||
"0.0 1.0 0.0 0.0 1.0 0.0\n"
|
||||
"0.0 0.0 1.0\n"
|
||||
"0.0 1.0 0.0 0.0 0.0 1.0\n"
|
||||
"0.0 1.0 1.0 0.0 1.0 1.0\n";
|
||||
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFileFromMemory(data, sizeof(data), 0);
|
||||
EXPECT_EQ(nullptr, scene);
|
||||
}
|
||||
|
||||
// Tests Issue #5729. Test, if properties defined multiple times. Unclear what to do, better to abort than to crash entirely
|
||||
TEST_F(utPLYImportExport, parseInvalidDoubleCustomProperty) {
|
||||
const char data[] = "ply\n"
|
||||
"format ascii 1.0\n"
|
||||
"element vertex 4\n"
|
||||
"property float x\n"
|
||||
"property float y\n"
|
||||
"property float z\n"
|
||||
"element name 8\n"
|
||||
"property float x\n"
|
||||
"element name 5\n"
|
||||
"property float x\n"
|
||||
"end_header\n"
|
||||
"0.0 0.0 0.0 100.0 10.0\n"
|
||||
"0.0 0.0 1.0 200.0 20.0\n"
|
||||
"0.0 1.0 0.0 300.0 30.0\n"
|
||||
"0.0 1.0 1.0 400.0 40.0\n"
|
||||
"0.0 0.0 0.0 500.0 50.0\n"
|
||||
"0.0 0.0 1.0 600.0 60.0\n"
|
||||
"0.0 1.0 0.0 700.0 70.0\n"
|
||||
"0.0 1.0 1.0 800.0 80.0\n";
|
||||
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFileFromMemory(data, sizeof(data), 0);
|
||||
EXPECT_EQ(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue