|
@@ -436,6 +436,31 @@ TEST_F(utglTF2ImportExport, error_string_preserved) {
|
|
|
ASSERT_NE(error.find("BoxTextured0.bin"), std::string::npos) << "Error string should contain an error about missing .bin file";
|
|
|
}
|
|
|
|
|
|
+TEST_F(utglTF2ImportExport, export_bad_accessor_bounds) {
|
|
|
+ Assimp::Importer importer;
|
|
|
+ Assimp::Exporter exporter;
|
|
|
+ const aiScene* scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxWithInfinites-glTF-Binary/BoxWithInfinites.glb", aiProcess_ValidateDataStructure);
|
|
|
+ ASSERT_NE(scene, nullptr);
|
|
|
+
|
|
|
+ EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "glb2", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxWithInfinites-glTF-Binary/BoxWithInfinites_out.glb"));
|
|
|
+ EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "gltf2", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxWithInfinites-glTF-Binary/BoxWithInfinites_out.gltf"));
|
|
|
+}
|
|
|
+
|
|
|
+TEST_F(utglTF2ImportExport, export_normalized_normals) {
|
|
|
+ Assimp::Importer importer;
|
|
|
+ Assimp::Exporter exporter;
|
|
|
+ const aiScene* scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxBadNormals-glTF-Binary/BoxBadNormals.glb", aiProcess_ValidateDataStructure);
|
|
|
+ ASSERT_NE(scene, nullptr);
|
|
|
+ EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "glb2", ASSIMP_TEST_MODELS_DIR "/glTF2/BoxBadNormals-glTF-Binary/BoxBadNormals_out.glb"));
|
|
|
+
|
|
|
+ // load in again and ensure normal-length normals but no Nan's or Inf's introduced
|
|
|
+ scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxBadNormals-glTF-Binary/BoxBadNormals_out.glb", aiProcess_ValidateDataStructure);
|
|
|
+ for ( auto i = 0u; i < scene->mMeshes[0]->mNumVertices; ++i ) {
|
|
|
+ const auto length = scene->mMeshes[0]->mNormals[i].Length();
|
|
|
+ EXPECT_TRUE(abs(length) < 1e-6 || abs(length - 1) < 1e-6);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
#endif // ASSIMP_BUILD_NO_EXPORT
|
|
|
|
|
|
TEST_F(utglTF2ImportExport, sceneMetadata) {
|