mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
update assimp to 6.0.5
This commit is contained in:
parent
2d2eb57e2e
commit
f5cf21cfeb
941 changed files with 22718 additions and 12240 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -42,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
#include "UnitTestPCH.h"
|
||||
#include "MathTest.h"
|
||||
#include <array>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
|
@ -156,5 +155,20 @@ TEST_F(AssimpAPITest_aiMatrix3x3, aiMatrix3FromToTest) {
|
|||
const auto from = aiVector3D(1,2,1).Normalize(), to = aiVector3D(-1,1,1).Normalize();
|
||||
aiMatrix3x3::FromToMatrix(from, to, result_cpp);
|
||||
aiMatrix3FromTo(&result_c, &from, &to);
|
||||
EXPECT_EQ(result_cpp, result_c);
|
||||
EXPECT_TRUE(result_cpp.Equal(result_c, Epsilon));
|
||||
}
|
||||
|
||||
TEST_F(AssimpAPITest_aiMatrix3x3, operatorTest) {
|
||||
std::array<ai_real, 9> value = { 1, 2, 3, 4, 5, 6, 7, 8,9};
|
||||
result_cpp = aiMatrix3x3( value[0], value[1], value[2], value[3],
|
||||
value[4], value[5], value[6], value[7],
|
||||
value[8]);
|
||||
size_t idx=0;
|
||||
for (unsigned int i = 0; i < 3; ++i) {
|
||||
for (unsigned int j = 0; j < 3; ++j) {
|
||||
ai_real curValue = result_cpp[i][j];
|
||||
EXPECT_EQ(curValue, value[idx]);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "UnitTestPCH.h"
|
||||
#include "MathTest.h"
|
||||
#include <assimp/MathFunctions.h>
|
||||
#include <array>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
|
@ -260,5 +261,22 @@ TEST_F(AssimpAPITest_aiMatrix4x4, aiMatrix4FromToTest) {
|
|||
const auto from = aiVector3D(1,2,1).Normalize(), to = aiVector3D(-1,1,1).Normalize();
|
||||
aiMatrix4x4::FromToMatrix(from, to, result_cpp);
|
||||
aiMatrix4FromTo(&result_c, &from, &to);
|
||||
EXPECT_EQ(result_cpp, result_c);
|
||||
EXPECT_TRUE(result_cpp.Equal(result_c, Epsilon));
|
||||
}
|
||||
|
||||
TEST_F(AssimpAPITest_aiMatrix4x4, operatorTest) {
|
||||
std::array<ai_real, 16> value = { 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16 };
|
||||
result_cpp = aiMatrix4x4( value[0], value[1], value[2], value[3],
|
||||
value[4], value[5], value[6], value[7],
|
||||
value[8], value[9], value[10], value[11],
|
||||
value[12], value[13], value[14], value[15] );
|
||||
size_t idx=0;
|
||||
for (unsigned int i = 0; i < 4; ++i) {
|
||||
for (unsigned int j = 0; j < 4; ++j) {
|
||||
ai_real curValue = result_cpp[i][j];
|
||||
EXPECT_EQ(curValue, value[idx]);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
@ -88,7 +88,10 @@ TEST_F(AssimpAPITest_aiQuaternion, aiQuaternionFromNormalizedQuaternionTest) {
|
|||
const auto qvec3 = random_unit_vec3();
|
||||
result_cpp = aiQuaternion(qvec3);
|
||||
aiQuaternionFromNormalizedQuaternion(&result_c, &qvec3);
|
||||
EXPECT_EQ(result_cpp, result_c);
|
||||
// Use a larger tolerance because FMA contraction differences in
|
||||
// 1.0 - x*x - y*y - z*z can flip the sign of a near-zero residual,
|
||||
// causing w = 0 vs w = sqrt(tiny) ≈ 1e-4.
|
||||
EXPECT_TRUE(result_cpp.Equal(result_c, 1e-4f));
|
||||
}
|
||||
|
||||
TEST_F(AssimpAPITest_aiQuaternion, aiQuaternionAreEqualTest) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -48,9 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
using namespace Assimp;
|
||||
|
||||
class utLineSplitter : public ::testing::Test {
|
||||
// empty
|
||||
};
|
||||
class utLineSplitter : public ::testing::Test {};
|
||||
|
||||
TEST_F(utLineSplitter, tokenizetest) {
|
||||
DefaultIOSystem fs;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
66
Engine/lib/assimp/test/unit/Common/utParsingUtils.cpp
Normal file
66
Engine/lib/assimp/test/unit/Common/utParsingUtils.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2026, 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/ParsingUtils.h>
|
||||
#include <assimp/fast_atof.h>
|
||||
#include <array>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
class utParsingUtils : public ::testing::Test {};
|
||||
|
||||
TEST_F(utParsingUtils, parseFloatsStringTest) {
|
||||
const std::array<float, 16> floatArray = {
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 7.54979e-8f, -1.0f, 0.0f,
|
||||
0.0f, 1.0f, 7.54979e-8f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f};
|
||||
const std::string floatArrayAsStr = "1 0 0 0 0 7.54979e-8 -1 0 0 1 7.54979e-8 0 0 0 0 1";
|
||||
const char *content = floatArrayAsStr.c_str();
|
||||
const char *end = content + floatArrayAsStr.size();
|
||||
for (float i : floatArray) {
|
||||
float value = 0.0f;
|
||||
SkipSpacesAndLineEnd(&content, end);
|
||||
content = fast_atoreal_move(content, value);
|
||||
EXPECT_FLOAT_EQ(value, i);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, 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-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -95,3 +95,10 @@ TEST(utCOBImporter, importSpider66) {
|
|||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/COB/spider_6_6.cob", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
TEST(utCOBImporter, importInvalidHeader) {
|
||||
Assimp::Importer importer;
|
||||
constexpr char Header[] = "Caligari ??LZSCALEb";
|
||||
const aiScene *scene = importer.ReadFileFromMemory(Header, sizeof(Header), aiProcess_ValidateDataStructure);
|
||||
ASSERT_EQ(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "../../include/assimp/DefaultLogger.hpp"
|
||||
#include "UnitTestPCH.h"
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <ctime>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
|
@ -43,20 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
using namespace ::Assimp;
|
||||
|
||||
class TestDefaultIOStream : public DefaultIOStream {
|
||||
class TestDefaultIOStream final : public DefaultIOStream {
|
||||
public:
|
||||
TestDefaultIOStream()
|
||||
: DefaultIOStream() {
|
||||
// empty
|
||||
}
|
||||
|
||||
TestDefaultIOStream( FILE* pFile, const std::string &strFilename )
|
||||
: DefaultIOStream( pFile, strFilename ) {
|
||||
// empty
|
||||
}
|
||||
|
||||
virtual ~TestDefaultIOStream() {
|
||||
// empty
|
||||
}
|
||||
TestDefaultIOStream() = default;
|
||||
TestDefaultIOStream(FILE* pFile, const std::string &strFilename) : DefaultIOStream(pFile, strFilename) {}
|
||||
~TestDefaultIOStream() override = default;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -49,18 +47,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
namespace Assimp {
|
||||
|
||||
class TestModelFacttory {
|
||||
class TestModelFactory {
|
||||
public:
|
||||
TestModelFacttory() {
|
||||
// empty
|
||||
}
|
||||
TestModelFactory() = default;
|
||||
|
||||
~TestModelFacttory() {
|
||||
// empty
|
||||
}
|
||||
~TestModelFactory() = default;
|
||||
|
||||
static aiScene *createDefaultTestModel( float &opacity ) {
|
||||
aiScene *scene( new aiScene );
|
||||
auto *scene = new aiScene;
|
||||
scene->mNumMaterials = 1;
|
||||
scene->mMaterials = new aiMaterial*[scene->mNumMaterials];
|
||||
scene->mMaterials[ 0 ] = new aiMaterial;
|
||||
|
|
@ -89,7 +83,7 @@ public:
|
|||
scene->mMeshes[ 0 ]->mFaces[ 0 ].mIndices[ 1 ] = 1;
|
||||
scene->mMeshes[ 0 ]->mFaces[ 0 ].mIndices[ 2 ] = 2;
|
||||
|
||||
scene->mRootNode = new aiNode();
|
||||
scene->mRootNode = new aiNode;
|
||||
scene->mRootNode->mNumMeshes = 1;
|
||||
scene->mRootNode->mMeshes = new unsigned int[1]{ 0 };
|
||||
|
||||
|
|
|
|||
27
Engine/lib/assimp/test/unit/Tools/TestTools.h
Normal file
27
Engine/lib/assimp/test/unit/Tools/TestTools.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
namespace Assimp::Unittest {
|
||||
|
||||
class TestTools final {
|
||||
public:
|
||||
TestTools() = default;
|
||||
~TestTools() = default;
|
||||
static bool openFilestream(FILE **pFile, const char *filename, const char *mode);
|
||||
};
|
||||
|
||||
inline bool TestTools::openFilestream(FILE **fs, const char *filename, const char *mode) {
|
||||
#if defined(_WIN32)
|
||||
errno_t err{ 0 };
|
||||
err = fopen_s(fs, filename, mode);
|
||||
EXPECT_EQ(err, 0);
|
||||
#else
|
||||
*fs = fopen(filename, mode);
|
||||
#endif
|
||||
return fs != nullptr;
|
||||
}
|
||||
|
||||
} // namespace Assimp::Unittest
|
||||
|
|
@ -3,8 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -39,42 +39,60 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#pragma once
|
||||
#ifdef _WIN32
|
||||
# ifndef _CRT_NONSTDC_NO_DEPRECATE
|
||||
# define _CRT_NONSTDC_NO_DEPRECATE
|
||||
# endif // _CRT_NONSTDC_NO_DEPRECATE
|
||||
# ifndef _CRT_SECURE_NO_WARNINGS
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
|
||||
#define TMP_PATH "./"
|
||||
# define TMP_PATH "./"
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define TMP_PATH "/tmp/"
|
||||
# define TMP_PATH "/var/tmp/"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#include <io.h>
|
||||
inline FILE* MakeTmpFile(char* tmplate)
|
||||
{
|
||||
auto pathtemplate = _mktemp(tmplate);
|
||||
inline FILE* MakeTmpFile(char* tmplate, size_t len, std::string &tmpName) {
|
||||
size_t tmpLen = len + 1;
|
||||
char *pathtemplate = new char[tmpLen];
|
||||
strcpy_s(pathtemplate, tmpLen, tmplate);
|
||||
int err_code = _mktemp_s(pathtemplate, tmpLen);
|
||||
EXPECT_EQ(err_code, 0);
|
||||
EXPECT_NE(pathtemplate, nullptr);
|
||||
if(pathtemplate == nullptr)
|
||||
{
|
||||
if(pathtemplate == nullptr) {
|
||||
delete[] pathtemplate;
|
||||
return nullptr;
|
||||
}
|
||||
auto* fs = std::fopen(pathtemplate, "w+");
|
||||
errno_t err;
|
||||
FILE *fs{nullptr};
|
||||
err = fopen_s(&fs, pathtemplate, "w+");
|
||||
EXPECT_EQ(0, err);
|
||||
tmpName = pathtemplate;
|
||||
EXPECT_NE(fs, nullptr);
|
||||
delete[] pathtemplate;
|
||||
|
||||
return fs;
|
||||
}
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
inline FILE* MakeTmpFile(char* tmplate)
|
||||
{
|
||||
inline FILE *MakeTmpFile(char *tmplate, size_t len, std::string &tmpName) {
|
||||
auto fd = mkstemp(tmplate);
|
||||
EXPECT_NE(-1, fd);
|
||||
if(fd == -1)
|
||||
{
|
||||
if(fd == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
auto fs = fdopen(fd, "w+");
|
||||
EXPECT_NE(nullptr, fs);
|
||||
tmpName += tmplate;
|
||||
|
||||
return fs;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -141,3 +141,14 @@ TEST(utACImportExport, testFormatDetection) {
|
|||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/TestFormatDetection", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
TEST(utACImportExport, importDobuleSidedFaces) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AC/doubleSidedFace.ac", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
// The scene contains one double-sided, rectangular AC surface. It should resolve to two quads (front + back) with eight
|
||||
// vertices (one per side to guarantee proper normal vectors).
|
||||
ASSERT_EQ(scene->mNumMeshes, 1u);
|
||||
ASSERT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
|
||||
ASSERT_EQ(scene->mMeshes[0]->mNumVertices, 8u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -46,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>
|
||||
#include <assimp/SpatialSort.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
|
@ -221,3 +220,25 @@ TEST(utBlenderImporter, importFleurOptonl) {
|
|||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/BLEND/fleurOptonl.blend", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
/// This test contains a default cube with subdivision surface modifier and a default cube with subdivision surface applied.
|
||||
/// Vertices should be identical.
|
||||
TEST_F(utBlenderImporterExporter, importBlendWithSubdivisionSurface) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/BLEND/subdivision_test_277.blend", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
EXPECT_EQ(scene->mNumMeshes, 2u);
|
||||
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, scene->mMeshes[1]->mNumVertices);
|
||||
|
||||
SpatialSort spatialSortVertices0;
|
||||
spatialSortVertices0.Fill(scene->mMeshes[0]->mVertices, scene->mMeshes[0]->mNumVertices, sizeof(aiVector3D), true);
|
||||
|
||||
for (unsigned int i = 0; i < scene->mMeshes[1]->mNumVertices; ++i)
|
||||
{
|
||||
auto positionMesh1 = scene->mMeshes[1]->mVertices[i];
|
||||
std::vector<unsigned int> spatialSortResult;
|
||||
spatialSortVertices0.FindPositions(positionMesh1, 1.0e-6f, spatialSortResult);
|
||||
|
||||
EXPECT_TRUE(scene->mMeshes[0]->mVertices[spatialSortResult[0]].Equal(positionMesh1));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ TEST_F(utColladaExport, testExportCamera) {
|
|||
|
||||
EXPECT_EQ(AI_SUCCESS, ex->Export(pTest, "collada", file));
|
||||
const unsigned int origNumCams(pTest->mNumCameras);
|
||||
//std::vector<float> origFOV;
|
||||
|
||||
std::unique_ptr<float[]> origFOV(new float[origNumCams]);
|
||||
std::unique_ptr<float[]> orifClipPlaneNear(new float[origNumCams]);
|
||||
std::unique_ptr<float[]> orifClipPlaneFar(new float[origNumCams]);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -67,12 +67,13 @@ public:
|
|||
aiScene *sceneCopy;
|
||||
};
|
||||
|
||||
virtual bool importerTest() final {
|
||||
Assimp::Importer importer;
|
||||
bool importerTest() final {
|
||||
Importer importer;
|
||||
{
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/duck.dae", aiProcess_ValidateDataStructure);
|
||||
if (scene == nullptr)
|
||||
if (scene == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Expected number of items
|
||||
EXPECT_EQ(scene->mNumMeshes, 1u);
|
||||
|
|
@ -99,8 +100,9 @@ public:
|
|||
|
||||
{
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/box_nested_animation.dae", aiProcess_ValidateDataStructure);
|
||||
if (scene == nullptr)
|
||||
if (scene == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Expect only one animation with the correct name
|
||||
EXPECT_EQ(scene->mNumAnimations, 1u);
|
||||
|
|
@ -111,55 +113,55 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
typedef std::pair<std::string, std::string> IdNameString;
|
||||
typedef std::map<std::string, std::string> IdNameMap;
|
||||
using IdNameString = std::pair<std::string, std::string>;
|
||||
using IdNameMap = std::map<std::string, std::string>;
|
||||
|
||||
template <typename T>
|
||||
static inline IdNameString GetColladaIdName(const T *item, size_t index) {
|
||||
static IdNameString GetColladaIdName(const T *item, size_t index) {
|
||||
std::ostringstream stream;
|
||||
stream << typeid(T).name() << "@" << index;
|
||||
if (item->mMetaData) {
|
||||
aiString aiStr;
|
||||
if (item->mMetaData->Get(AI_METADATA_COLLADA_ID, aiStr))
|
||||
if (aiString aiStr; item->mMetaData->Get(AI_METADATA_COLLADA_ID, aiStr)) {
|
||||
return std::make_pair(std::string(aiStr.C_Str()), stream.str());
|
||||
}
|
||||
}
|
||||
return std::make_pair(std::string(), stream.str());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline IdNameString GetItemIdName(const T *item, size_t index) {
|
||||
static IdNameString GetItemIdName(const T *item, size_t index) {
|
||||
std::ostringstream stream;
|
||||
stream << typeid(T).name() << "@" << index;
|
||||
return std::make_pair(std::string(item->mName.C_Str()), stream.str());
|
||||
}
|
||||
|
||||
// Specialisations
|
||||
static inline IdNameString GetItemIdName(aiMaterial *item, size_t index) {
|
||||
static IdNameString GetItemIdName(aiMaterial *item, size_t index) {
|
||||
std::ostringstream stream;
|
||||
stream << typeid(aiMaterial).name() << "@" << index;
|
||||
return std::make_pair(std::string(item->GetName().C_Str()), stream.str());
|
||||
}
|
||||
|
||||
static inline IdNameString GetItemIdName(aiTexture *item, size_t index) {
|
||||
static IdNameString GetItemIdName(const aiTexture *item, size_t index) {
|
||||
std::ostringstream stream;
|
||||
stream << typeid(aiTexture).name() << "@" << index;
|
||||
return std::make_pair(std::string(item->mFilename.C_Str()), stream.str());
|
||||
}
|
||||
|
||||
static inline void ReportDuplicate(IdNameMap &itemIdMap, const IdNameString &namePair, const char *typeNameStr) {
|
||||
static void ReportDuplicate(IdNameMap &itemIdMap, const IdNameString &namePair, const char *typeNameStr) {
|
||||
const auto result = itemIdMap.insert(namePair);
|
||||
EXPECT_TRUE(result.second) << "Duplicate '" << typeNameStr << "' name: '" << namePair.first << "'. " << namePair.second << " == " << result.first->second;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline void CheckUniqueIds(IdNameMap &itemIdMap, unsigned int itemCount, T **itemArray) {
|
||||
static void CheckUniqueIds(IdNameMap &itemIdMap, unsigned int itemCount, T **itemArray) {
|
||||
for (size_t idx = 0; idx < itemCount; ++idx) {
|
||||
IdNameString namePair = GetItemIdName(itemArray[idx], idx);
|
||||
ReportDuplicate(itemIdMap, namePair, typeid(T).name());
|
||||
}
|
||||
}
|
||||
|
||||
static inline void CheckUniqueIds(IdNameMap &itemIdMap, const aiNode *parent, size_t index) {
|
||||
static void CheckUniqueIds(IdNameMap &itemIdMap, const aiNode *parent, size_t index) {
|
||||
IdNameString namePair = GetItemIdName(parent, index);
|
||||
ReportDuplicate(itemIdMap, namePair, typeid(aiNode).name());
|
||||
|
||||
|
|
@ -168,7 +170,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
static inline void CheckNodeIdNames(IdNameMap &nodeIdMap, IdNameMap &nodeNameMap, const aiNode *parent, size_t index) {
|
||||
static void CheckNodeIdNames(IdNameMap &nodeIdMap, IdNameMap &nodeNameMap, const aiNode *parent, size_t index) {
|
||||
IdNameString namePair = GetItemIdName(parent, index);
|
||||
IdNameString idPair = GetColladaIdName(parent, index);
|
||||
ReportDuplicate(nodeIdMap, idPair, typeid(aiNode).name());
|
||||
|
|
@ -178,7 +180,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetAllNodeNames(const aiString &newName, aiNode *node) {
|
||||
static void SetAllNodeNames(const aiString &newName, aiNode *node) {
|
||||
node->mName = newName;
|
||||
for (size_t idx = 0; idx < node->mNumChildren; ++idx) {
|
||||
SetAllNodeNames(newName, node->mChildren[idx]);
|
||||
|
|
@ -187,7 +189,7 @@ public:
|
|||
|
||||
void ImportAndCheckIds(const char *file, const aiScene *origScene) {
|
||||
// Import the Collada using the 'default' where aiNode and aiMesh names are the Collada ids
|
||||
Assimp::Importer importer;
|
||||
Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(file, aiProcess_ValidateDataStructure);
|
||||
ASSERT_TRUE(scene != nullptr) << "Fatal: could not re-import " << file;
|
||||
EXPECT_EQ(origScene->mNumMeshes, scene->mNumMeshes) << "in " << file;
|
||||
|
|
@ -210,7 +212,7 @@ public:
|
|||
void ImportAsNames(const char *file, const aiScene *origScene) {
|
||||
// Import the Collada but using the user-visible names for aiNode and aiMesh
|
||||
// Note that this mode may not support bones or animations
|
||||
Assimp::Importer importer;
|
||||
Importer importer;
|
||||
importer.SetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_USE_COLLADA_NAMES, 1);
|
||||
|
||||
const aiScene *scene = importer.ReadFile(file, aiProcess_ValidateDataStructure);
|
||||
|
|
@ -249,8 +251,8 @@ unsigned int GetMeshUseCount(const aiNode *rootNode) {
|
|||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
TEST_F(utColladaImportExport, exportRootNodeMeshTest) {
|
||||
Assimp::Importer importer;
|
||||
Assimp::Exporter exporter;
|
||||
Importer importer;
|
||||
Exporter exporter;
|
||||
const char *outFile = "exportRootNodeMeshTest_out.dae";
|
||||
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/duck.dae", aiProcess_ValidateDataStructure);
|
||||
|
|
@ -295,8 +297,8 @@ TEST_F(utColladaImportExport, exportRootNodeMeshTest) {
|
|||
}
|
||||
|
||||
TEST_F(utColladaImportExport, exporterUniqueIdsTest) {
|
||||
Assimp::Importer importer;
|
||||
Assimp::Exporter exporter;
|
||||
Importer importer;
|
||||
Exporter exporter;
|
||||
const char *outFileEmpty = "exportMeshIdTest_empty_out.dae";
|
||||
const char *outFileNamed = "exportMeshIdTest_named_out.dae";
|
||||
|
||||
|
|
@ -409,7 +411,7 @@ TEST_F(utColladaZaeImportExport, importBlenFromFileTest) {
|
|||
}
|
||||
|
||||
TEST_F(utColladaZaeImportExport, importMakeHumanTest) {
|
||||
Assimp::Importer importer;
|
||||
Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/human.zae", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
|
||||
|
|
@ -429,3 +431,22 @@ TEST_F(utColladaZaeImportExport, importMakeHumanTest) {
|
|||
EXPECT_TRUE(scene->mMetaData->Get(AI_METADATA_SOURCE_FORMAT_VERSION, value)) << "No format version metadata";
|
||||
EXPECT_STREQ("1.4.1", value.C_Str());
|
||||
}
|
||||
|
||||
static constexpr char kData[] = " \
|
||||
<?xml version=\"1.0\" encoding=\"utf-8\"?> \
|
||||
<COLLADA version=\"1.4.1\"> \
|
||||
<library_geometries> \
|
||||
<geometry id=\"fuzz2772-geo\" name=\"fuzz2772\"> \
|
||||
<mesh> \
|
||||
<triangles count=\"1\"><input semantic=\"VERTEXERTEX\" source=\"#fuzz2772-verts\" offset=\"0\"/><p>0 1 2</p></triangles> \
|
||||
</mesh> \
|
||||
</geometry> \
|
||||
</library_geometries> \
|
||||
</COLLADA> \
|
||||
";
|
||||
|
||||
TEST_F(utColladaZaeImportExport, import_causes_heap_overflow_issue6373) {
|
||||
Importer importer;
|
||||
const aiScene *scene = importer.ReadFileFromMemory(kData, sizeof(kData), aiProcess_ValidateDataStructure);
|
||||
EXPECT_EQ(nullptr, scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <gtest/gtest.h>
|
||||
#include "TestIOStream.h"
|
||||
#include "UnitTestFileGenerator.h"
|
||||
#include "Tools/TestTools.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
|
@ -60,8 +61,9 @@ TEST_F( utDefaultIOStream, FileSizeTest ) {
|
|||
const auto dataSize = sizeof(data);
|
||||
const auto dataCount = dataSize / sizeof(*data);
|
||||
|
||||
char fpath[] = { TMP_PATH"rndfp.XXXXXX" };
|
||||
auto* fs = MakeTmpFile(fpath);
|
||||
char fpath[] = { TMP_PATH"rndfp.XXXXXX\0" };
|
||||
std::string tmpName;
|
||||
auto *fs = MakeTmpFile(fpath, std::strlen(fpath), tmpName);
|
||||
ASSERT_NE(nullptr, fs);
|
||||
{
|
||||
auto written = std::fwrite(data, sizeof(*data), dataCount, fs );
|
||||
|
|
@ -71,13 +73,13 @@ TEST_F( utDefaultIOStream, FileSizeTest ) {
|
|||
ASSERT_EQ(vflush, 0);
|
||||
|
||||
std::fclose(fs);
|
||||
fs = std::fopen(fpath, "r");
|
||||
|
||||
ASSERT_NE(nullptr, fs);
|
||||
EXPECT_TRUE(Unittest::TestTools::openFilestream(&fs, tmpName.c_str(), "r"));
|
||||
ASSERT_NE(nullptr, fs);
|
||||
|
||||
TestDefaultIOStream myStream( fs, fpath);
|
||||
size_t size = myStream.FileSize();
|
||||
EXPECT_EQ( size, dataSize);
|
||||
}
|
||||
remove(fpath);
|
||||
remove(tmpName.c_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -122,6 +120,7 @@ protected:
|
|||
TEST_CASE(0e-19);
|
||||
TEST_CASE(400012);
|
||||
TEST_CASE(5.9e-76);
|
||||
TEST_CASE(7.54979e-8);
|
||||
TEST_CASE_INF(inf);
|
||||
TEST_CASE_INF(inf);
|
||||
TEST_CASE_INF(infinity);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -44,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "UnitTestPCH.h"
|
||||
#include <assimp/IOStreamBuffer.h>
|
||||
#include "TestIOStream.h"
|
||||
#include "Tools/TestTools.h"
|
||||
#include "UnitTestFileGenerator.h"
|
||||
|
||||
class IOStreamBufferTest : public ::testing::Test {
|
||||
|
|
@ -86,18 +85,21 @@ TEST_F( IOStreamBufferTest, open_close_Test ) {
|
|||
const auto dataCount = dataSize / sizeof(*data);
|
||||
|
||||
char fname[]={ "octest.XXXXXX" };
|
||||
auto* fs = MakeTmpFile(fname);
|
||||
std::string tmpName;
|
||||
auto* fs = MakeTmpFile(fname, std::strlen(fname), tmpName);
|
||||
ASSERT_NE(nullptr, fs);
|
||||
|
||||
auto written = std::fwrite( data, sizeof(*data), dataCount, fs );
|
||||
auto written = std::fwrite(data, sizeof(*data), dataCount, fs);
|
||||
EXPECT_NE( 0U, written );
|
||||
auto flushResult = std::fflush( fs );
|
||||
ASSERT_EQ(0, flushResult);
|
||||
std::fclose( fs );
|
||||
fs = std::fopen(fname, "r");
|
||||
ASSERT_NE(nullptr, fs);
|
||||
fclose(fs);
|
||||
|
||||
FILE *new_fs{ nullptr };
|
||||
EXPECT_TRUE(Unittest::TestTools::openFilestream(&new_fs, tmpName.c_str(), "r"));
|
||||
ASSERT_NE(nullptr, new_fs);
|
||||
{
|
||||
TestDefaultIOStream myStream( fs, fname );
|
||||
TestDefaultIOStream myStream(new_fs, fname);
|
||||
|
||||
EXPECT_TRUE( myBuffer.open( &myStream ) );
|
||||
EXPECT_FALSE( myBuffer.open( &myStream ) );
|
||||
|
|
@ -111,8 +113,9 @@ TEST_F( IOStreamBufferTest, readlineTest ) {
|
|||
const auto dataSize = sizeof(data);
|
||||
const auto dataCount = dataSize / sizeof(*data);
|
||||
|
||||
char fname[]={ "readlinetest.XXXXXX" };
|
||||
auto* fs = MakeTmpFile(fname);
|
||||
char fname[]={ "readlinetest.XXXXXX\0" };
|
||||
std::string tmpName;
|
||||
auto* fs = MakeTmpFile(fname, std::strlen(fname), tmpName);
|
||||
ASSERT_NE(nullptr, fs);
|
||||
|
||||
auto written = std::fwrite( data, sizeof(*data), dataCount, fs );
|
||||
|
|
@ -121,23 +124,25 @@ TEST_F( IOStreamBufferTest, readlineTest ) {
|
|||
auto flushResult = std::fflush(fs);
|
||||
ASSERT_EQ(0, flushResult);
|
||||
std::fclose(fs);
|
||||
fs = std::fopen(fname, "r");
|
||||
ASSERT_NE(nullptr, fs);
|
||||
|
||||
FILE *new_fs{ nullptr };
|
||||
EXPECT_TRUE(Unittest::TestTools::openFilestream(&new_fs, tmpName.c_str(), "r"));
|
||||
ASSERT_NE(nullptr, new_fs);
|
||||
|
||||
const auto tCacheSize = 26u;
|
||||
|
||||
IOStreamBuffer<char> myBuffer( tCacheSize );
|
||||
EXPECT_EQ(tCacheSize, myBuffer.cacheSize() );
|
||||
IOStreamBuffer<char> myBuffer(tCacheSize);
|
||||
EXPECT_EQ(tCacheSize, myBuffer.cacheSize());
|
||||
|
||||
TestDefaultIOStream myStream( fs, fname );
|
||||
TestDefaultIOStream myStream(new_fs, fname);
|
||||
auto size = myStream.FileSize();
|
||||
auto numBlocks = size / myBuffer.cacheSize();
|
||||
if ( size % myBuffer.cacheSize() > 0 ) {
|
||||
numBlocks++;
|
||||
}
|
||||
EXPECT_TRUE( myBuffer.open( &myStream ) );
|
||||
EXPECT_EQ( numBlocks, myBuffer.getNumBlocks() );
|
||||
EXPECT_TRUE( myBuffer.close() );
|
||||
EXPECT_TRUE(myBuffer.open(&myStream));
|
||||
EXPECT_EQ(numBlocks, myBuffer.getNumBlocks() );
|
||||
EXPECT_TRUE(myBuffer.close() );
|
||||
}
|
||||
|
||||
TEST_F( IOStreamBufferTest, accessBlockIndexTest ) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -299,7 +299,7 @@ aiImporterDesc s_failingImporterDescription = {
|
|||
class FailingImporter : public Assimp::BaseImporter {
|
||||
public:
|
||||
virtual ~FailingImporter() = default;
|
||||
virtual bool CanRead(const std::string &, Assimp::IOSystem *, bool) const override {
|
||||
bool CanRead(const std::string &, Assimp::IOSystem *, bool) const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ class utIssues : public ::testing::Test {};
|
|||
|
||||
TEST_F( utIssues, OpacityBugWhenExporting_727 ) {
|
||||
float opacity;
|
||||
aiScene *scene = TestModelFacttory::createDefaultTestModel(opacity);
|
||||
aiScene *scene = TestModelFactory::createDefaultTestModel(opacity);
|
||||
Assimp::Importer importer;
|
||||
Assimp::Exporter exporter;
|
||||
|
||||
|
|
@ -69,11 +69,12 @@ TEST_F( utIssues, OpacityBugWhenExporting_727 ) {
|
|||
const aiScene *newScene( importer.ReadFile( path, aiProcess_ValidateDataStructure ) );
|
||||
ASSERT_NE( nullptr, newScene );
|
||||
float newOpacity;
|
||||
if ( newScene->mNumMaterials > 0 ) {
|
||||
if (newScene->mNumMaterials > 0 ) {
|
||||
EXPECT_EQ( AI_SUCCESS, newScene->mMaterials[ 0 ]->Get( AI_MATKEY_OPACITY, newOpacity ) );
|
||||
EXPECT_FLOAT_EQ( opacity, newOpacity );
|
||||
}
|
||||
delete scene;
|
||||
|
||||
TestModelFactory::releaseDefaultTestModel(&scene);
|
||||
|
||||
// Cleanup. Delete exported dae.dae file
|
||||
EXPECT_EQ(0, std::remove(path.c_str()));
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -260,13 +260,15 @@ TEST_F(MaterialSystemTest, testMaterialTextureTypeEnum) {
|
|||
case aiTextureType_METALNESS:
|
||||
case aiTextureType_DIFFUSE_ROUGHNESS:
|
||||
case aiTextureType_AMBIENT_OCCLUSION:
|
||||
case aiTextureType_SHEEN:
|
||||
case aiTextureType_CLEARCOAT:
|
||||
case aiTextureType_TRANSMISSION:
|
||||
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:
|
||||
case aiTextureType_ANISOTROPY:
|
||||
case aiTextureType_GLTF_METALLIC_ROUGHNESS:
|
||||
case aiTextureType_UNKNOWN:
|
||||
if (i > maxTextureType)
|
||||
maxTextureType = i;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ TEST_F( utMetadata, copy_test ) {
|
|||
|
||||
// bool test
|
||||
{
|
||||
bool v;
|
||||
bool v = true;
|
||||
EXPECT_TRUE( copy.Get( "bool", v ) );
|
||||
EXPECT_EQ( bv, v );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
using namespace Assimp;
|
||||
|
||||
static const float VertComponents[24 * 3] = {
|
||||
static constexpr float VertComponents[24 * 3] = {
|
||||
-0.500000, 0.500000, 0.500000,
|
||||
-0.500000, 0.500000, -0.500000,
|
||||
-0.500000, -0.500000, -0.500000,
|
||||
|
|
@ -76,7 +76,7 @@ static const float VertComponents[24 * 3] = {
|
|||
0.500000, -0.500000, 0.500000f
|
||||
};
|
||||
|
||||
static const char *ObjModel =
|
||||
static constexpr char ObjModel[] =
|
||||
"o 1\n"
|
||||
"\n"
|
||||
"# Vertex list\n"
|
||||
|
|
@ -103,7 +103,7 @@ static const char *ObjModel =
|
|||
"\n"
|
||||
"# End of file\n";
|
||||
|
||||
static const char *ObjModel_Issue1111 =
|
||||
static constexpr char ObjModel_Issue1111[] =
|
||||
"o 1\n"
|
||||
"\n"
|
||||
"# Vertex list\n"
|
||||
|
|
@ -408,7 +408,7 @@ TEST_F(utObjImportExport, homogeneous_coordinates_divide_by_zero_Test) {
|
|||
EXPECT_EQ(nullptr, scene);
|
||||
}
|
||||
|
||||
TEST_F(utObjImportExport, 0based_array_Test) {
|
||||
TEST_F(utObjImportExport, zero_based_array_Test) {
|
||||
static const char *curObjModel =
|
||||
"v -0.500000 0.000000 0.400000\n"
|
||||
"v -0.500000 0.000000 -0.800000\n"
|
||||
|
|
@ -525,3 +525,17 @@ TEST_F(utObjImportExport, import_with_line_continuations) {
|
|||
EXPECT_NEAR(vertices[2].y, 0.5f, threshold);
|
||||
EXPECT_NEAR(vertices[2].z, -0.5f, threshold);
|
||||
}
|
||||
|
||||
TEST_F(utObjImportExport, issue2355_mtl_texture_prefix) {
|
||||
::Assimp::Importer importer;
|
||||
const aiScene *const scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/OBJ/mtl_different_folder.obj", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
|
||||
EXPECT_EQ(scene->mNumMaterials, 2U);
|
||||
const aiMaterial *const material = scene->mMaterials[1];
|
||||
|
||||
aiString texturePath;
|
||||
material->GetTexture(aiTextureType_DIFFUSE, 0, &texturePath);
|
||||
// The MTL file is in `folder`, the image path should have been prefixed with the folder
|
||||
EXPECT_STREQ("folder/image.jpg", texturePath.C_Str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -38,22 +38,19 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef ASSIMP_BUILD_NO_OBJ_IMPORTER
|
||||
|
||||
#include "AssetLib/Obj/ObjFileParser.h"
|
||||
#include "AssetLib/Obj/ObjTools.h"
|
||||
#include "UnitTestPCH.h"
|
||||
|
||||
using namespace ::Assimp;
|
||||
|
||||
class utObjTools : public ::testing::Test {
|
||||
// empty
|
||||
};
|
||||
class utObjTools : public ::testing::Test {};
|
||||
|
||||
class TestObjFileParser : public ObjFileParser {
|
||||
public:
|
||||
TestObjFileParser() :
|
||||
ObjFileParser() {
|
||||
// empty
|
||||
}
|
||||
TestObjFileParser() = default;
|
||||
|
||||
~TestObjFileParser() = default;
|
||||
|
||||
|
|
@ -84,7 +81,7 @@ TEST_F(utObjTools, skipDataLine_TwoLines_Success) {
|
|||
buffer.resize(data.size());
|
||||
::memcpy(&buffer[0], &data[0], data.size());
|
||||
test_parser.setBuffer(buffer);
|
||||
static const size_t Size = 4096UL;
|
||||
static constexpr size_t Size = 4096UL;
|
||||
char data_buffer[Size];
|
||||
|
||||
test_parser.testCopyNextWord(data_buffer, Size);
|
||||
|
|
@ -112,3 +109,5 @@ TEST_F(utObjTools, countComponents_TwoLines_Success) {
|
|||
size_t numComps = test_parser.testGetNumComponentsInDataDefinition();
|
||||
EXPECT_EQ(3U, numComps);
|
||||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_OBJ_IMPORTER
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -141,6 +141,27 @@ TEST_F(utPLYImportExport, importBinaryPLYWithRNNewline) {
|
|||
EXPECT_EQ(2u, scene->mMeshes[0]->mFaces[0].mIndices[2]);
|
||||
}
|
||||
|
||||
// Tests of a PLY file gets read with \n as the fist character in the BINARY part
|
||||
TEST_F(utPLYImportExport, importBinaryPLYWithNewlineInBinary) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube_binary_starts_with_nl.ply", aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_NE(nullptr, scene);
|
||||
ASSERT_NE(nullptr, scene->mMeshes[0]);
|
||||
ASSERT_EQ(8u, scene->mMeshes[0]->mNumVertices);
|
||||
// Make sure the first binary float was read correctly
|
||||
ASSERT_FLOAT_EQ(5.967534f, scene->mMeshes[0]->mVertices[0][0]);
|
||||
ASSERT_FLOAT_EQ(0, scene->mMeshes[0]->mVertices[0][1]);
|
||||
ASSERT_FLOAT_EQ(0, scene->mMeshes[0]->mVertices[0][2]);
|
||||
|
||||
ASSERT_EQ(6u, scene->mMeshes[0]->mNumFaces);
|
||||
// Also check if the indices were parsed correctly
|
||||
ASSERT_EQ(4u, 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);
|
||||
|
|
|
|||
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