mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 10:06:57 +02:00
repairs for texture replacement by name
This commit is contained in:
parent
bb652c0784
commit
209c12cb1c
3 changed files with 16 additions and 10 deletions
|
@ -620,12 +620,19 @@ void NetworkGeometry::setTextureWithNameToURL(const QString& name, const QUrl& u
|
||||||
NetworkMeshPart& part = mesh.parts[j];
|
NetworkMeshPart& part = mesh.parts[j];
|
||||||
|
|
||||||
QSharedPointer<NetworkTexture> matchingTexture = QSharedPointer<NetworkTexture>();
|
QSharedPointer<NetworkTexture> matchingTexture = QSharedPointer<NetworkTexture>();
|
||||||
if (part.diffuseTexture->getName() == name) {
|
if (part.diffuseTextureName == name) {
|
||||||
part.diffuseTexture =
|
part.diffuseTexture =
|
||||||
Application::getInstance()->getTextureCache()->getTexture(url, DEFAULT_TEXTURE,
|
Application::getInstance()->getTextureCache()->getTexture(url, DEFAULT_TEXTURE,
|
||||||
_geometry.meshes[i].isEye, QByteArray());
|
_geometry.meshes[i].isEye, QByteArray());
|
||||||
part.diffuseTexture->setName(name);
|
|
||||||
part.diffuseTexture->setLoadPriorities(_loadPriorities);
|
part.diffuseTexture->setLoadPriorities(_loadPriorities);
|
||||||
|
} else if (part.normalTextureName == name) {
|
||||||
|
part.normalTexture = Application::getInstance()->getTextureCache()->getTexture(url, DEFAULT_TEXTURE,
|
||||||
|
false, QByteArray());
|
||||||
|
part.normalTexture->setLoadPriorities(_loadPriorities);
|
||||||
|
} else if (part.specularTextureName == name) {
|
||||||
|
part.specularTexture = Application::getInstance()->getTextureCache()->getTexture(url, DEFAULT_TEXTURE,
|
||||||
|
false, QByteArray());
|
||||||
|
part.specularTexture->setLoadPriorities(_loadPriorities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -746,21 +753,21 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
||||||
networkPart.diffuseTexture = Application::getInstance()->getTextureCache()->getTexture(
|
networkPart.diffuseTexture = Application::getInstance()->getTextureCache()->getTexture(
|
||||||
_textureBase.resolved(QUrl(part.diffuseTexture.filename)), DEFAULT_TEXTURE,
|
_textureBase.resolved(QUrl(part.diffuseTexture.filename)), DEFAULT_TEXTURE,
|
||||||
mesh.isEye, part.diffuseTexture.content);
|
mesh.isEye, part.diffuseTexture.content);
|
||||||
networkPart.diffuseTexture->setName(part.diffuseTexture.name);
|
networkPart.diffuseTextureName = part.diffuseTexture.name;
|
||||||
networkPart.diffuseTexture->setLoadPriorities(_loadPriorities);
|
networkPart.diffuseTexture->setLoadPriorities(_loadPriorities);
|
||||||
}
|
}
|
||||||
if (!part.normalTexture.filename.isEmpty()) {
|
if (!part.normalTexture.filename.isEmpty()) {
|
||||||
networkPart.normalTexture = Application::getInstance()->getTextureCache()->getTexture(
|
networkPart.normalTexture = Application::getInstance()->getTextureCache()->getTexture(
|
||||||
_textureBase.resolved(QUrl(part.normalTexture.filename)), NORMAL_TEXTURE,
|
_textureBase.resolved(QUrl(part.normalTexture.filename)), NORMAL_TEXTURE,
|
||||||
false, part.normalTexture.content);
|
false, part.normalTexture.content);
|
||||||
networkPart.normalTexture->setName(part.normalTexture.name);
|
networkPart.normalTextureName = part.normalTexture.name;
|
||||||
networkPart.normalTexture->setLoadPriorities(_loadPriorities);
|
networkPart.normalTexture->setLoadPriorities(_loadPriorities);
|
||||||
}
|
}
|
||||||
if (!part.specularTexture.filename.isEmpty()) {
|
if (!part.specularTexture.filename.isEmpty()) {
|
||||||
networkPart.specularTexture = Application::getInstance()->getTextureCache()->getTexture(
|
networkPart.specularTexture = Application::getInstance()->getTextureCache()->getTexture(
|
||||||
_textureBase.resolved(QUrl(part.specularTexture.filename)), SPECULAR_TEXTURE,
|
_textureBase.resolved(QUrl(part.specularTexture.filename)), SPECULAR_TEXTURE,
|
||||||
false, part.specularTexture.content);
|
false, part.specularTexture.content);
|
||||||
networkPart.specularTexture->setName(part.specularTexture.name);
|
networkPart.specularTextureName = part.specularTexture.name;
|
||||||
networkPart.specularTexture->setLoadPriorities(_loadPriorities);
|
networkPart.specularTexture->setLoadPriorities(_loadPriorities);
|
||||||
}
|
}
|
||||||
networkMesh.parts.append(networkPart);
|
networkMesh.parts.append(networkPart);
|
||||||
|
|
|
@ -140,8 +140,11 @@ private:
|
||||||
class NetworkMeshPart {
|
class NetworkMeshPart {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
QString diffuseTextureName;
|
||||||
QSharedPointer<NetworkTexture> diffuseTexture;
|
QSharedPointer<NetworkTexture> diffuseTexture;
|
||||||
|
QString normalTextureName;
|
||||||
QSharedPointer<NetworkTexture> normalTexture;
|
QSharedPointer<NetworkTexture> normalTexture;
|
||||||
|
QString specularTextureName;
|
||||||
QSharedPointer<NetworkTexture> specularTexture;
|
QSharedPointer<NetworkTexture> specularTexture;
|
||||||
|
|
||||||
bool isTranslucent() const;
|
bool isTranslucent() const;
|
||||||
|
|
|
@ -145,9 +145,6 @@ public:
|
||||||
|
|
||||||
/// Returns the lazily-computed average texture color.
|
/// Returns the lazily-computed average texture color.
|
||||||
const QColor& getAverageColor() const { return _averageColor; }
|
const QColor& getAverageColor() const { return _averageColor; }
|
||||||
|
|
||||||
const QString& getName() const { return _name; }
|
|
||||||
void setName(const QString& name) { _name = name; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -159,7 +156,6 @@ protected:
|
||||||
virtual void imageLoaded(const QImage& image);
|
virtual void imageLoaded(const QImage& image);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _name;
|
|
||||||
TextureType _type;
|
TextureType _type;
|
||||||
bool _translucent;
|
bool _translucent;
|
||||||
QColor _averageColor;
|
QColor _averageColor;
|
||||||
|
|
Loading…
Reference in a new issue