Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 427 files). Show all
Unified · Split
| @@ -1678,15 +1678,15 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch, bool noBlend) { · 1677 unmodified lines | ||
| 1678 | 1678 | } |
| 1679 | 1679 | } |
| 1680 | 1680 | |
| 1681 | −GeometryReader::GeometryReader(const QUrl& url, QNetworkReply* reply, const QVariantHash& mapping) : | |
| 1681 | +GeometryReader::GeometryReader(const QUrl& url, const QByteArray& data, const QVariantHash& mapping) : | |
| 1682 | 1682 | _url(url), |
| 1683 | − _reply(reply), | |
| 1683 | + _data(data), | |
| 1684 | 1684 | _mapping(mapping) { |
| 1685 | 1685 | } |
| 1686 | 1686 | |
| 1687 | 1687 | void GeometryReader::run() { |
| 1688 | 1688 | try { |
| 1689 | − if (!_reply) { | |
| 1689 | + if (_data.isEmpty()) { | |
| 1690 | 1690 | throw QString("Reply is NULL ?!"); |
| 1691 | 1691 | } |
| 1692 | 1692 | QString urlname = _url.path().toLower(); |
| @@ -1701,9 +1701,9 @@ void GeometryReader::run() { · 8 unmodified lines | ||
| 1701 | 1701 | if (_url.path().toLower().endsWith(".fbx")) { |
| 1702 | 1702 | const bool grabLightmaps = true; |
| 1703 | 1703 | const float lightmapLevel = 1.0f; |
| 1704 | − fbxgeo = readFBX(_reply, _mapping, _url.path(), grabLightmaps, lightmapLevel); | |
| 1704 | + fbxgeo = readFBX(_data, _mapping, _url.path(), grabLightmaps, lightmapLevel); | |
| 1705 | 1705 | } else if (_url.path().toLower().endsWith(".obj")) { |
| 1706 | − fbxgeo = OBJReader().readOBJ(_reply, _mapping, &_url); | |
| 1706 | + fbxgeo = OBJReader().readOBJ(_data, _mapping, _url); | |
| 1707 | 1707 | } else { |
| 1708 | 1708 | QString errorStr("usupported format"); |
| 1709 | 1709 | emit onError(NetworkGeometry::ModelParseError, errorStr); |
| @@ -1717,7 +1717,6 @@ void GeometryReader::run() { · 7 unmodified lines | ||
| 1717 | 1717 | qCDebug(renderutils) << "Error reading " << _url << ": " << error; |
| 1718 | 1718 | emit onError(NetworkGeometry::ModelParseError, error); |
| 1719 | 1719 | } |
| 1720 | − _reply->deleteLater(); | |
| 1721 | 1720 | } |
| 1722 | 1721 | |
| 1723 | 1722 | NetworkGeometry::NetworkGeometry(const QUrl& url, bool delayLoad, const QVariantHash& mapping, const QUrl& textureBaseUrl) : |
| @@ -1746,8 +1745,10 @@ void NetworkGeometry::attemptRequest() { · 22 unmodified lines | ||
| 1746 | 1745 | |
| 1747 | 1746 | void NetworkGeometry::attemptRequestInternal() { |
| 1748 | 1747 | if (_url.path().toLower().endsWith(".fst")) { |
| 1748 | + _mappingUrl = _url; | |
| 1749 | 1749 | requestMapping(_url); |
| 1750 | 1750 | } else { |
| 1751 | + _modelUrl = _url; | |
| 1751 | 1752 | requestModel(_url); |
| 1752 | 1753 | } |
| 1753 | 1754 | } |
| @@ -1832,8 +1833,8 @@ void NetworkGeometry::requestMapping(const QUrl& url) { · 78 unmodified lines | ||
| 1832 | 1833 | _resource->deleteLater(); |
| 1833 | 1834 | } |
| 1834 | 1835 | _resource = new Resource(url, false); |
| 1835 | − connect(_resource, SIGNAL(loaded(QNetworkReply&)), SLOT(mappingRequestDone(QNetworkReply&))); | |
| 1836 | − connect(_resource, SIGNAL(failed(QNetworkReply::NetworkError)), SLOT(mappingRequestError(QNetworkReply::NetworkError))); | |
| 1836 | + connect(_resource, &Resource::loaded, this, &NetworkGeometry::mappingRequestDone); | |
| 1837 | + connect(_resource, &Resource::failed, this, &NetworkGeometry::mappingRequestError); | |
| 1837 | 1838 | } |
| 1838 | 1839 | |
| 1839 | 1840 | void NetworkGeometry::requestModel(const QUrl& url) { |
| @@ -1841,18 +1842,19 @@ void NetworkGeometry::requestModel(const QUrl& url) { · 1 unmodified line | ||
| 1841 | 1842 | if (_resource) { |
| 1842 | 1843 | _resource->deleteLater(); |
| 1843 | 1844 | } |
| 1845 | + _modelUrl = url; | |
| 1844 | 1846 | _resource = new Resource(url, false); |
| 1845 | − connect(_resource, SIGNAL(loaded(QNetworkReply&)), SLOT(modelRequestDone(QNetworkReply&))); | |
| 1846 | − connect(_resource, SIGNAL(failed(QNetworkReply::NetworkError)), SLOT(modelRequestError(QNetworkReply::NetworkError))); | |
| 1847 | + connect(_resource, &Resource::loaded, this, &NetworkGeometry::modelRequestDone); | |
| 1848 | + connect(_resource, &Resource::failed, this, &NetworkGeometry::modelRequestError); | |
| 1847 | 1849 | } |
| 1848 | 1850 | |
| 1849 | −void NetworkGeometry::mappingRequestDone(QNetworkReply& reply) { | |
| 1851 | +void NetworkGeometry::mappingRequestDone(const QByteArray& data) { | |
| 1850 | 1852 | assert(_state == RequestMappingState); |
| 1851 | 1853 | |
| 1852 | 1854 | // parse the mapping file |
| 1853 | − _mapping = FSTReader::readMapping(reply.readAll()); | |
| 1855 | + _mapping = FSTReader::readMapping(data); | |
| 1854 | 1856 | |
| 1855 | − QUrl replyUrl = reply.url(); | |
| 1857 | + QUrl replyUrl = _mappingUrl; | |
| 1856 | 1858 | QString modelUrlStr = _mapping.value("filename").toString(); |
| 1857 | 1859 | if (modelUrlStr.isNull()) { |
| 1858 | 1860 | qCDebug(renderutils) << "Mapping file " << _url << "has no \"filename\" entry"; |
| @@ -1867,8 +1869,8 @@ void NetworkGeometry::mappingRequestDone(QNetworkReply& reply) { · 8 unmodified lines | ||
| 1867 | 1869 | _textureBaseUrl = replyUrl.resolved(texdir); |
| 1868 | 1870 | } |
| 1869 | 1871 | |
| 1870 | − QUrl modelUrl = replyUrl.resolved(modelUrlStr); | |
| 1871 | − requestModel(modelUrl); | |
| 1872 | + _modelUrl = replyUrl.resolved(modelUrlStr); | |
| 1873 | + requestModel(_modelUrl); | |
| 1872 | 1874 | } |
| 1873 | 1875 | } |
| 1874 | 1876 | |
| @@ -1878,13 +1880,13 @@ void NetworkGeometry::mappingRequestError(QNetworkReply::NetworkError error) { · 3 unmodified lines | ||
| 1878 | 1880 | emit onFailure(*this, MappingRequestError); |
| 1879 | 1881 | } |
| 1880 | 1882 | |
| 1881 | −void NetworkGeometry::modelRequestDone(QNetworkReply& reply) { | |
| 1883 | +void NetworkGeometry::modelRequestDone(const QByteArray& data) { | |
| 1882 | 1884 | assert(_state == RequestModelState); |
| 1883 | 1885 | |
| 1884 | 1886 | _state = ParsingModelState; |
| 1885 | 1887 | |
| 1886 | 1888 | // asynchronously parse the model file. |
| 1887 | − GeometryReader* geometryReader = new GeometryReader(reply.url(), &reply, _mapping); | |
| 1889 | + GeometryReader* geometryReader = new GeometryReader(_modelUrl, data, _mapping); | |
| 1888 | 1890 | connect(geometryReader, SIGNAL(onSuccess(FBXGeometry*)), SLOT(modelParseSuccess(FBXGeometry*))); |
| 1889 | 1891 | connect(geometryReader, SIGNAL(onError(int, QString)), SLOT(modelParseError(int, QString))); |
| 1890 | 1892 | |