mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 01:24:51 +02:00
embedded model geometry
This commit is contained in:
parent
75c1bdbf0d
commit
ae09aec5d9
2 changed files with 16 additions and 3 deletions
18
libraries/fbx/src/GLTFSerializer.cpp
Normal file → Executable file
18
libraries/fbx/src/GLTFSerializer.cpp
Normal file → Executable file
|
@ -939,10 +939,15 @@ HFMModel::Pointer GLTFSerializer::read(const QByteArray& data, const QVariantHas
|
|||
}
|
||||
|
||||
bool GLTFSerializer::readBinary(const QString& url, QByteArray& outdata) {
|
||||
QUrl binaryUrl = _url.resolved(url);
|
||||
|
||||
bool success;
|
||||
std::tie<bool, QByteArray>(success, outdata) = requestData(binaryUrl);
|
||||
|
||||
if (url.contains("data:application/octet-stream;base64,") || url.contains("data:image/png;base64,") || url.contains("data:image/jpeg;base64,")) {
|
||||
QString binaryUrl = url.split(",")[1];
|
||||
std::tie<bool, QByteArray>(success, outdata) = requestEmbeddedData(binaryUrl);
|
||||
} else {
|
||||
QUrl binaryUrl = _url.resolved(url);
|
||||
std::tie<bool, QByteArray>(success, outdata) = requestData(binaryUrl);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
@ -975,6 +980,13 @@ std::tuple<bool, QByteArray> GLTFSerializer::requestData(QUrl& url) {
|
|||
}
|
||||
}
|
||||
|
||||
std::tuple<bool, QByteArray> GLTFSerializer::requestEmbeddedData(QString binaryUrl) {
|
||||
QByteArray urlBin = binaryUrl.toUtf8();
|
||||
QByteArray result = QByteArray::fromBase64(urlBin);
|
||||
|
||||
return std::make_tuple(true, result);
|
||||
}
|
||||
|
||||
|
||||
QNetworkReply* GLTFSerializer::request(QUrl& url, bool isTest) {
|
||||
if (!qApp) {
|
||||
|
|
1
libraries/fbx/src/GLTFSerializer.h
Normal file → Executable file
1
libraries/fbx/src/GLTFSerializer.h
Normal file → Executable file
|
@ -772,6 +772,7 @@ private:
|
|||
QVector<glm::vec3>& out_vertices, QVector<glm::vec3>& out_normals);
|
||||
|
||||
std::tuple<bool, QByteArray> requestData(QUrl& url);
|
||||
std::tuple<bool, QByteArray> requestEmbeddedData(QString binaryUrl);
|
||||
QNetworkReply* request(QUrl& url, bool isTest);
|
||||
bool doesResourceExist(const QString& url);
|
||||
|
||||
|
|
Loading…
Reference in a new issue