diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index 7e1de5055d..399084b42a 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -32,6 +32,7 @@ class GeometryExtra { public: const QVariantHash& mapping; const QUrl& textureBaseUrl; + bool combineParts; }; QUrl resolveTextureBaseUrl(const QUrl& url, const QUrl& textureBaseUrl) { @@ -89,7 +90,7 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) { } auto modelCache = DependencyManager::get<ModelCache>(); - GeometryExtra extra{ mapping, _textureBaseUrl }; + GeometryExtra extra{ mapping, _textureBaseUrl, false }; // XXX // Get the raw GeometryResource _geometryResource = modelCache->getResource(url, QUrl(), &extra).staticCast<GeometryResource>(); @@ -129,8 +130,8 @@ void GeometryMappingResource::onGeometryMappingLoaded(bool success) { class GeometryReader : public QRunnable { public: GeometryReader(QWeakPointer<Resource>& resource, const QUrl& url, const QVariantHash& mapping, - const QByteArray& data) : - _resource(resource), _url(url), _mapping(mapping), _data(data) { + const QByteArray& data, bool combineParts) : + _resource(resource), _url(url), _mapping(mapping), _data(data), _combineParts(combineParts) { DependencyManager::get<StatTracker>()->incrementStat("PendingProcessing"); } @@ -142,6 +143,7 @@ private: QUrl _url; QVariantHash _mapping; QByteArray _data; + bool _combineParts; }; void GeometryReader::run() { @@ -210,8 +212,8 @@ void GeometryReader::run() { class GeometryDefinitionResource : public GeometryResource { Q_OBJECT public: - GeometryDefinitionResource(const QUrl& url, const QVariantHash& mapping, const QUrl& textureBaseUrl) : - GeometryResource(url, resolveTextureBaseUrl(url, textureBaseUrl)), _mapping(mapping) {} + GeometryDefinitionResource(const QUrl& url, const QVariantHash& mapping, const QUrl& textureBaseUrl, bool combineParts) : + GeometryResource(url, resolveTextureBaseUrl(url, textureBaseUrl)), _mapping(mapping), _combineParts(combineParts) {} QString getType() const override { return "GeometryDefinition"; } @@ -222,10 +224,11 @@ protected: private: QVariantHash _mapping; + bool _combineParts; }; void GeometryDefinitionResource::downloadFinished(const QByteArray& data) { - QThreadPool::globalInstance()->start(new GeometryReader(_self, _url, _mapping, data)); + QThreadPool::globalInstance()->start(new GeometryReader(_self, _url, _mapping, data, _combineParts)); } void GeometryDefinitionResource::setGeometryDefinition(FBXGeometry::Pointer fbxGeometry) { @@ -266,7 +269,7 @@ ModelCache::ModelCache() { } QSharedPointer<Resource> ModelCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback, - const void* extra) { + const void* extra) { Resource* resource = nullptr; if (url.path().toLower().endsWith(".fst")) { resource = new GeometryMappingResource(url); @@ -274,14 +277,15 @@ QSharedPointer<Resource> ModelCache::createResource(const QUrl& url, const QShar const GeometryExtra* geometryExtra = static_cast<const GeometryExtra*>(extra); auto mapping = geometryExtra ? geometryExtra->mapping : QVariantHash(); auto textureBaseUrl = geometryExtra ? geometryExtra->textureBaseUrl : QUrl(); - resource = new GeometryDefinitionResource(url, mapping, textureBaseUrl); + bool combineParts = geometryExtra ? geometryExtra->combineParts : false; + resource = new GeometryDefinitionResource(url, mapping, textureBaseUrl, combineParts); } return QSharedPointer<Resource>(resource, &Resource::deleter); } GeometryResource::Pointer ModelCache::getGeometryResource(const QUrl& url, const QVariantHash& mapping, const QUrl& textureBaseUrl) { - GeometryExtra geometryExtra = { mapping, textureBaseUrl }; + GeometryExtra geometryExtra = { mapping, textureBaseUrl, false }; // XXX GeometryResource::Pointer resource = getResource(url, QUrl(), &geometryExtra).staticCast<GeometryResource>(); if (resource) { if (resource->isLoaded() && resource->shouldSetTextures()) { diff --git a/libraries/model-networking/src/model-networking/ModelCache.h b/libraries/model-networking/src/model-networking/ModelCache.h index 2cd96a84c7..3952924b27 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.h +++ b/libraries/model-networking/src/model-networking/ModelCache.h @@ -142,7 +142,7 @@ protected: friend class GeometryMappingResource; virtual QSharedPointer<Resource> createResource(const QUrl& url, const QSharedPointer<Resource>& fallback, - const void* extra) override; + const void* extra) override; private: ModelCache(); diff --git a/libraries/networking/src/ResourceCache.h b/libraries/networking/src/ResourceCache.h index 8f1f1baed2..53ccd2c386 100644 --- a/libraries/networking/src/ResourceCache.h +++ b/libraries/networking/src/ResourceCache.h @@ -295,8 +295,8 @@ protected: /// Creates a new resource. virtual QSharedPointer<Resource> createResource(const QUrl& url, const QSharedPointer<Resource>& fallback, - const void* extra) = 0; - + const void* extra) = 0; + void addUnusedResource(const QSharedPointer<Resource>& resource); void removeUnusedResource(const QSharedPointer<Resource>& resource); diff --git a/tools/vhacd-util/src/VHACDUtilApp.cpp b/tools/vhacd-util/src/VHACDUtilApp.cpp index cae184a49c..4d48bdf2bf 100644 --- a/tools/vhacd-util/src/VHACDUtilApp.cpp +++ b/tools/vhacd-util/src/VHACDUtilApp.cpp @@ -10,6 +10,7 @@ // #include <QCommandLineParser> +#include <Trace.h> #include <VHACD.h> #include "VHACDUtilApp.h" #include "VHACDUtil.h" @@ -98,6 +99,8 @@ VHACDUtilApp::VHACDUtilApp(int argc, char* argv[]) : { vhacd::VHACDUtil vUtil; + DependencyManager::set<tracing::Tracer>(); + // parse command-line QCommandLineParser parser; parser.setApplicationDescription("High Fidelity Object Decomposer");