mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
Add the usage of the glTF-Sample-Models test models.
This commit is contained in:
parent
17f888c6e2
commit
38854a8dda
2 changed files with 58 additions and 7 deletions
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Declare dependencies
|
# Declare dependencies
|
||||||
macro (setup_testcase_dependencies)
|
macro (setup_testcase_dependencies)
|
||||||
|
@ -70,6 +73,15 @@ macro (setup_testcase_dependencies)
|
||||||
DOWNLOAD_NO_EXTRACT true CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
DOWNLOAD_NO_EXTRACT true CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ExternalProject_Add(
|
||||||
|
gltf_samples
|
||||||
|
PREFIX "models"
|
||||||
|
GIT_REPOSITORY "https://github.com/KhronosGroup/glTF-Sample-models"
|
||||||
|
GIT_TAG "master"
|
||||||
|
DOWNLOAD_NO_EXTRACT true CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_dependencies(${TARGET_NAME} ukr_franny)
|
add_dependencies(${TARGET_NAME} ukr_franny)
|
||||||
add_dependencies(${TARGET_NAME} dragon_franny)
|
add_dependencies(${TARGET_NAME} dragon_franny)
|
||||||
|
@ -77,6 +89,7 @@ macro (setup_testcase_dependencies)
|
||||||
add_dependencies(${TARGET_NAME} madders1)
|
add_dependencies(${TARGET_NAME} madders1)
|
||||||
add_dependencies(${TARGET_NAME} madders2)
|
add_dependencies(${TARGET_NAME} madders2)
|
||||||
add_dependencies(${TARGET_NAME} broken)
|
add_dependencies(${TARGET_NAME} broken)
|
||||||
|
add_dependencies(${TARGET_NAME} gltf_samples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,14 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
|
||||||
|
// This test checks a large amount of files. To debug more comfortably and avoid going through
|
||||||
|
// a lot of uninteresting data, QTest allows us to narrow down what gets run with command line
|
||||||
|
// arguments, like this:
|
||||||
|
//
|
||||||
|
// ./model-serializers-ModelSerializersTests loadGLTF:gltf2.0-RecursiveSkeletons.glb
|
||||||
|
//
|
||||||
|
// This will run only the loadGLTF test, and only on the gltf2.0-RecursiveSkeletons.glb file.
|
||||||
|
|
||||||
#include "ModelSerializersTests.h"
|
#include "ModelSerializersTests.h"
|
||||||
#include "GLTFSerializer.h"
|
#include "GLTFSerializer.h"
|
||||||
#include "FBXSerializer.h"
|
#include "FBXSerializer.h"
|
||||||
|
@ -29,7 +37,7 @@
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDirIterator>
|
||||||
|
|
||||||
QTEST_MAIN(ModelSerializersTests)
|
QTEST_MAIN(ModelSerializersTests)
|
||||||
|
|
||||||
|
@ -52,21 +60,45 @@ void ModelSerializersTests::initTestCase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelSerializersTests::loadGLTF_data() {
|
void ModelSerializersTests::loadGLTF_data() {
|
||||||
|
// We feed a large amount of files into the test. Some we expect to fail, some we expect to load with issues. The
|
||||||
|
// added columns below indicate our expectations for each file.
|
||||||
|
|
||||||
|
|
||||||
QTest::addColumn<QString>("filename");
|
QTest::addColumn<QString>("filename");
|
||||||
|
QTest::addColumn<bool>("expectParseFail");
|
||||||
QTest::addColumn<bool>("expectWarnings");
|
QTest::addColumn<bool>("expectWarnings");
|
||||||
QTest::addColumn<bool>("expectErrors");
|
QTest::addColumn<bool>("expectErrors");
|
||||||
|
|
||||||
QTest::newRow("ready-player-me-good1") << "models/src/DragonAvatar1.glb.gz" << false << false;
|
QTest::newRow("ready-player-me-good1") << "models/src/DragonAvatar1.glb.gz" << false << false << false;
|
||||||
QTest::newRow("ready-player-me-good2") << "models/src/UkraineFranny.glb.gz" << false << false;
|
QTest::newRow("ready-player-me-good2") << "models/src/UkraineFranny.glb.gz" << false << false << false;
|
||||||
QTest::newRow("ready-player-me-good3") << "models/src/Franny.glb.gz" << false << false;
|
QTest::newRow("ready-player-me-good3") << "models/src/Franny.glb.gz" << false << false << false;
|
||||||
QTest::newRow("ready-player-me-good4") << "models/src/womanInTShirt.glb.gz" << false << false;
|
QTest::newRow("ready-player-me-good4") << "models/src/womanInTShirt.glb.gz" << false << false << false;
|
||||||
QTest::newRow("ready-player-me-good5") << "models/src/female-avatar-with-swords.glb.gz" << false << false;
|
QTest::newRow("ready-player-me-good5") << "models/src/female-avatar-with-swords.glb.gz" << false << false << false;
|
||||||
QTest::newRow("ready-player-me-broken1") << "models/src/broken-2022-11-27.glb.gz" << false << true;
|
QTest::newRow("ready-player-me-broken1") << "models/src/broken-2022-11-27.glb.gz" << false << true;
|
||||||
|
|
||||||
|
|
||||||
|
// We can't parse GLTF 1.0 at present, and probably not ever. We're expecting all these to fail.
|
||||||
|
QDirIterator it("models/src/gltf_samples/1.0", QStringList() << "*.glb", QDir::Files, QDirIterator::Subdirectories);
|
||||||
|
while(it.hasNext()) {
|
||||||
|
QString filename = it.next();
|
||||||
|
QFileInfo fi(filename);
|
||||||
|
QString testname = "gltf1.0-" + fi.fileName();
|
||||||
|
QTest::newRow(testname.toUtf8().data()) << filename << true << false << false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDirIterator it2("models/src/gltf_samples/2.0", QStringList() << "*.glb", QDir::Files, QDirIterator::Subdirectories);
|
||||||
|
while(it2.hasNext()) {
|
||||||
|
QString filename = it2.next();
|
||||||
|
QFileInfo fi(filename);
|
||||||
|
QString testname = "gltf2.0-" + fi.fileName();
|
||||||
|
QTest::newRow(testname.toUtf8().data()) << filename << false << false << false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelSerializersTests::loadGLTF() {
|
void ModelSerializersTests::loadGLTF() {
|
||||||
QFETCH(QString, filename);
|
QFETCH(QString, filename);
|
||||||
|
QFETCH(bool, expectParseFail);
|
||||||
QFETCH(bool, expectWarnings);
|
QFETCH(bool, expectWarnings);
|
||||||
QFETCH(bool, expectErrors);
|
QFETCH(bool, expectErrors);
|
||||||
|
|
||||||
|
@ -110,7 +142,13 @@ void ModelSerializersTests::loadGLTF() {
|
||||||
|
|
||||||
|
|
||||||
hfm::Model::Pointer model = loader.load(uncompressedData, serializerMapping, url, webMediaType);
|
hfm::Model::Pointer model = loader.load(uncompressedData, serializerMapping, url, webMediaType);
|
||||||
QVERIFY(model);
|
QVERIFY(expectParseFail == !model);
|
||||||
|
|
||||||
|
if (!model) {
|
||||||
|
// We expected this parse to fail, so nothing more to do here.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QVERIFY(!model->meshes.empty());
|
QVERIFY(!model->meshes.empty());
|
||||||
QVERIFY(!model->joints.empty());
|
QVERIFY(!model->joints.empty());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue