Fix and test for GLTF.
parent
fabfcf3cb0
commit
81984002d3
|
@ -743,7 +743,7 @@ void glTFImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOS
|
|||
ImportLights(asset);
|
||||
|
||||
ImportNodes(asset);
|
||||
|
||||
ImportCommonMetadata(asset);
|
||||
|
||||
if (pScene->mNumMeshes == 0) {
|
||||
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
|
||||
|
|
|
@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/postprocess.h>
|
||||
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/commonMetaData.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
|
@ -63,6 +64,31 @@ TEST_F( utglTFImportExport, importglTFFromFileTest ) {
|
|||
EXPECT_TRUE( importerTest() );
|
||||
}
|
||||
|
||||
TEST_F(utglTFImportExport, sceneMetadata) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF/TwoBoxes/TwoBoxes.gltf", aiProcess_ValidateDataStructure);
|
||||
ASSERT_TRUE(scene);
|
||||
ASSERT_TRUE(scene->mMetaData);
|
||||
{
|
||||
ASSERT_TRUE(scene->mMetaData->HasKey(AI_METADATA_SOURCE_FORMAT));
|
||||
aiString format;
|
||||
ASSERT_TRUE(scene->mMetaData->Get(AI_METADATA_SOURCE_FORMAT, format));
|
||||
ASSERT_EQ(strcmp(format.C_Str(), "glTF Importer"), 0);
|
||||
}
|
||||
{
|
||||
ASSERT_TRUE(scene->mMetaData->HasKey(AI_METADATA_SOURCE_FORMAT_VERSION));
|
||||
aiString version;
|
||||
ASSERT_TRUE(scene->mMetaData->Get(AI_METADATA_SOURCE_FORMAT_VERSION, version));
|
||||
ASSERT_EQ(strcmp(version.C_Str(), "1.0"), 0);
|
||||
}
|
||||
{
|
||||
ASSERT_TRUE(scene->mMetaData->HasKey(AI_METADATA_SOURCE_GENERATOR));
|
||||
aiString generator;
|
||||
ASSERT_TRUE(scene->mMetaData->Get(AI_METADATA_SOURCE_GENERATOR, generator));
|
||||
ASSERT_EQ(strncmp(generator.C_Str(), "collada2gltf", 12), 0);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(utglTFImportExport, incorrect_vertex_arrays) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene* scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF/IncorrectVertexArrays/Cube_v1.gltf",
|
||||
|
|
Loading…
Reference in New Issue