Merge branch 'master' into draco_1.5.6

pull/4978/head
Kim Kulling 2023-03-09 13:45:44 +01:00 committed by GitHub
commit 348e672567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 1 deletions

View File

@ -50,6 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdio.h>
#include <unordered_map>
using namespace Assimp;
void mydummy() {}
@ -78,7 +80,7 @@ public:
};
typedef std::vector<unsigned int> UIntVector;
typedef std::map<uint64_t, Edge> EdgeMap;
typedef std::unordered_map<uint64_t, Edge> EdgeMap;
// ---------------------------------------------------------------------------
// Hashing function to derive an index into an #EdgeMap from two given

View File

@ -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) {

View File

@ -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) {