mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 03:50:16 +02:00
working toward fixing compound hulls
This commit is contained in:
parent
8d00f0ab8f
commit
a1cab2c0d1
4 changed files with 19 additions and 12 deletions
|
@ -32,6 +32,7 @@ class GeometryExtra {
|
||||||
public:
|
public:
|
||||||
const QVariantHash& mapping;
|
const QVariantHash& mapping;
|
||||||
const QUrl& textureBaseUrl;
|
const QUrl& textureBaseUrl;
|
||||||
|
bool combineParts;
|
||||||
};
|
};
|
||||||
|
|
||||||
QUrl resolveTextureBaseUrl(const QUrl& url, const QUrl& textureBaseUrl) {
|
QUrl resolveTextureBaseUrl(const QUrl& url, const QUrl& textureBaseUrl) {
|
||||||
|
@ -89,7 +90,7 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto modelCache = DependencyManager::get<ModelCache>();
|
auto modelCache = DependencyManager::get<ModelCache>();
|
||||||
GeometryExtra extra{ mapping, _textureBaseUrl };
|
GeometryExtra extra{ mapping, _textureBaseUrl, false }; // XXX
|
||||||
|
|
||||||
// Get the raw GeometryResource
|
// Get the raw GeometryResource
|
||||||
_geometryResource = modelCache->getResource(url, QUrl(), &extra).staticCast<GeometryResource>();
|
_geometryResource = modelCache->getResource(url, QUrl(), &extra).staticCast<GeometryResource>();
|
||||||
|
@ -129,8 +130,8 @@ void GeometryMappingResource::onGeometryMappingLoaded(bool success) {
|
||||||
class GeometryReader : public QRunnable {
|
class GeometryReader : public QRunnable {
|
||||||
public:
|
public:
|
||||||
GeometryReader(QWeakPointer<Resource>& resource, const QUrl& url, const QVariantHash& mapping,
|
GeometryReader(QWeakPointer<Resource>& resource, const QUrl& url, const QVariantHash& mapping,
|
||||||
const QByteArray& data) :
|
const QByteArray& data, bool combineParts) :
|
||||||
_resource(resource), _url(url), _mapping(mapping), _data(data) {
|
_resource(resource), _url(url), _mapping(mapping), _data(data), _combineParts(combineParts) {
|
||||||
|
|
||||||
DependencyManager::get<StatTracker>()->incrementStat("PendingProcessing");
|
DependencyManager::get<StatTracker>()->incrementStat("PendingProcessing");
|
||||||
}
|
}
|
||||||
|
@ -142,6 +143,7 @@ private:
|
||||||
QUrl _url;
|
QUrl _url;
|
||||||
QVariantHash _mapping;
|
QVariantHash _mapping;
|
||||||
QByteArray _data;
|
QByteArray _data;
|
||||||
|
bool _combineParts;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GeometryReader::run() {
|
void GeometryReader::run() {
|
||||||
|
@ -210,8 +212,8 @@ void GeometryReader::run() {
|
||||||
class GeometryDefinitionResource : public GeometryResource {
|
class GeometryDefinitionResource : public GeometryResource {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GeometryDefinitionResource(const QUrl& url, const QVariantHash& mapping, const QUrl& textureBaseUrl) :
|
GeometryDefinitionResource(const QUrl& url, const QVariantHash& mapping, const QUrl& textureBaseUrl, bool combineParts) :
|
||||||
GeometryResource(url, resolveTextureBaseUrl(url, textureBaseUrl)), _mapping(mapping) {}
|
GeometryResource(url, resolveTextureBaseUrl(url, textureBaseUrl)), _mapping(mapping), _combineParts(combineParts) {}
|
||||||
|
|
||||||
QString getType() const override { return "GeometryDefinition"; }
|
QString getType() const override { return "GeometryDefinition"; }
|
||||||
|
|
||||||
|
@ -222,10 +224,11 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantHash _mapping;
|
QVariantHash _mapping;
|
||||||
|
bool _combineParts;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GeometryDefinitionResource::downloadFinished(const QByteArray& data) {
|
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) {
|
void GeometryDefinitionResource::setGeometryDefinition(FBXGeometry::Pointer fbxGeometry) {
|
||||||
|
@ -266,7 +269,7 @@ ModelCache::ModelCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<Resource> ModelCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
QSharedPointer<Resource> ModelCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
||||||
const void* extra) {
|
const void* extra) {
|
||||||
Resource* resource = nullptr;
|
Resource* resource = nullptr;
|
||||||
if (url.path().toLower().endsWith(".fst")) {
|
if (url.path().toLower().endsWith(".fst")) {
|
||||||
resource = new GeometryMappingResource(url);
|
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);
|
const GeometryExtra* geometryExtra = static_cast<const GeometryExtra*>(extra);
|
||||||
auto mapping = geometryExtra ? geometryExtra->mapping : QVariantHash();
|
auto mapping = geometryExtra ? geometryExtra->mapping : QVariantHash();
|
||||||
auto textureBaseUrl = geometryExtra ? geometryExtra->textureBaseUrl : QUrl();
|
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);
|
return QSharedPointer<Resource>(resource, &Resource::deleter);
|
||||||
}
|
}
|
||||||
|
|
||||||
GeometryResource::Pointer ModelCache::getGeometryResource(const QUrl& url, const QVariantHash& mapping, const QUrl& textureBaseUrl) {
|
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>();
|
GeometryResource::Pointer resource = getResource(url, QUrl(), &geometryExtra).staticCast<GeometryResource>();
|
||||||
if (resource) {
|
if (resource) {
|
||||||
if (resource->isLoaded() && resource->shouldSetTextures()) {
|
if (resource->isLoaded() && resource->shouldSetTextures()) {
|
||||||
|
|
|
@ -142,7 +142,7 @@ protected:
|
||||||
friend class GeometryMappingResource;
|
friend class GeometryMappingResource;
|
||||||
|
|
||||||
virtual QSharedPointer<Resource> createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
virtual QSharedPointer<Resource> createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
||||||
const void* extra) override;
|
const void* extra) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ModelCache();
|
ModelCache();
|
||||||
|
|
|
@ -295,8 +295,8 @@ protected:
|
||||||
|
|
||||||
/// Creates a new resource.
|
/// Creates a new resource.
|
||||||
virtual QSharedPointer<Resource> createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
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 addUnusedResource(const QSharedPointer<Resource>& resource);
|
||||||
void removeUnusedResource(const QSharedPointer<Resource>& resource);
|
void removeUnusedResource(const QSharedPointer<Resource>& resource);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
#include <Trace.h>
|
||||||
#include <VHACD.h>
|
#include <VHACD.h>
|
||||||
#include "VHACDUtilApp.h"
|
#include "VHACDUtilApp.h"
|
||||||
#include "VHACDUtil.h"
|
#include "VHACDUtil.h"
|
||||||
|
@ -98,6 +99,8 @@ VHACDUtilApp::VHACDUtilApp(int argc, char* argv[]) :
|
||||||
{
|
{
|
||||||
vhacd::VHACDUtil vUtil;
|
vhacd::VHACDUtil vUtil;
|
||||||
|
|
||||||
|
DependencyManager::set<tracing::Tracer>();
|
||||||
|
|
||||||
// parse command-line
|
// parse command-line
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription("High Fidelity Object Decomposer");
|
parser.setApplicationDescription("High Fidelity Object Decomposer");
|
||||||
|
|
Loading…
Reference in a new issue