mirror of
https://github.com/overte-org/overte.git
synced 2025-06-15 21:59:22 +02:00
Merge pull request #10775 from 1P-Cusack/21401
Adding support for loading obj.gz files in ModelCache.
This commit is contained in:
commit
48aadb2899
1 changed files with 14 additions and 2 deletions
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
|
||||||
|
#include <Gzip.h>
|
||||||
|
|
||||||
#include "ModelNetworkingLogging.h"
|
#include "ModelNetworkingLogging.h"
|
||||||
#include <Trace.h>
|
#include <Trace.h>
|
||||||
#include <StatTracker.h>
|
#include <StatTracker.h>
|
||||||
|
@ -171,7 +173,9 @@ void GeometryReader::run() {
|
||||||
|
|
||||||
QString urlname = _url.path().toLower();
|
QString urlname = _url.path().toLower();
|
||||||
if (!urlname.isEmpty() && !_url.path().isEmpty() &&
|
if (!urlname.isEmpty() && !_url.path().isEmpty() &&
|
||||||
(_url.path().toLower().endsWith(".fbx") || _url.path().toLower().endsWith(".obj"))) {
|
(_url.path().toLower().endsWith(".fbx") ||
|
||||||
|
_url.path().toLower().endsWith(".obj") ||
|
||||||
|
_url.path().toLower().endsWith(".obj.gz"))) {
|
||||||
FBXGeometry::Pointer fbxGeometry;
|
FBXGeometry::Pointer fbxGeometry;
|
||||||
|
|
||||||
if (_url.path().toLower().endsWith(".fbx")) {
|
if (_url.path().toLower().endsWith(".fbx")) {
|
||||||
|
@ -181,6 +185,14 @@ void GeometryReader::run() {
|
||||||
}
|
}
|
||||||
} else if (_url.path().toLower().endsWith(".obj")) {
|
} else if (_url.path().toLower().endsWith(".obj")) {
|
||||||
fbxGeometry.reset(OBJReader().readOBJ(_data, _mapping, _combineParts, _url));
|
fbxGeometry.reset(OBJReader().readOBJ(_data, _mapping, _combineParts, _url));
|
||||||
|
} else if (_url.path().toLower().endsWith(".obj.gz")) {
|
||||||
|
QByteArray uncompressedData;
|
||||||
|
if (gunzip(_data, uncompressedData)){
|
||||||
|
fbxGeometry.reset(OBJReader().readOBJ(uncompressedData, _mapping, _combineParts, _url));
|
||||||
|
} else {
|
||||||
|
throw QString("failed to decompress .obj.gz" );
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw QString("unsupported format");
|
throw QString("unsupported format");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue