History

add a hack method to NetworkGeometry to change a material texture by name

Stephen Birarda committed 12 years ago

Commit cc28fe91 parent 047ee0a3 files · +23 −0Browse files

Showing the changes to interface/src/renderer/GeometryCache.cpp (1 of 3 files). Show all

Unified · Split

interface/src/renderer/GeometryCache.cpp+18−0
@@ -613,6 +613,24 @@ void NetworkGeometry::clearLoadPriority(const QPointer<QObject>& owner) { · 612 unmodified lines
613613 }
614614 }
615615
616+void NetworkGeometry::setTextureWithNameToURL(const QString& name, const QUrl& url) {
617+ for (int i = 0; i < _meshes.size(); i++) {
618+ NetworkMesh& mesh = _meshes[i];
619+ for (int j = 0; j < mesh.parts.size(); j++) {
620+ NetworkMeshPart& part = mesh.parts[j];
621+
622+ QSharedPointer<NetworkTexture> matchingTexture = QSharedPointer<NetworkTexture>();
623+ if (part.diffuseTexture->getName() == name) {
624+ part.diffuseTexture =
625+ Application::getInstance()->getTextureCache()->getTexture(url, DEFAULT_TEXTURE,
626+ _geometry.meshes[i].isEye, QByteArray());
627+ part.diffuseTexture->setName(name);
628+ part.diffuseTexture->setLoadPriorities(_loadPriorities);
629+ }
630+ }
631+ }
632+}
633+
616634 /// Reads geometry in a worker thread.
617635 class GeometryReader : public QRunnable {
618636 public: