clement's comments from PR14858

This commit is contained in:
SamGondelman 2019-02-12 09:51:11 -08:00
parent d2ecc21f0b
commit 189ccfde4a
8 changed files with 19 additions and 20 deletions

View file

@ -41,7 +41,7 @@ QSharedPointer<Resource> AnimationCache::createResource(const QUrl& url) {
} }
QSharedPointer<Resource> AnimationCache::createResourceCopy(const QSharedPointer<Resource>& resource) { QSharedPointer<Resource> AnimationCache::createResourceCopy(const QSharedPointer<Resource>& resource) {
return QSharedPointer<Resource>(new Animation(*resource.staticCast<Animation>().data()), &Resource::deleter); return QSharedPointer<Resource>(new Animation(*resource.staticCast<Animation>()), &Resource::deleter);
} }
AnimationReader::AnimationReader(const QUrl& url, const QByteArray& data) : AnimationReader::AnimationReader(const QUrl& url, const QByteArray& data) :

View file

@ -40,5 +40,5 @@ QSharedPointer<Resource> SoundCache::createResource(const QUrl& url) {
} }
QSharedPointer<Resource> SoundCache::createResourceCopy(const QSharedPointer<Resource>& resource) { QSharedPointer<Resource> SoundCache::createResourceCopy(const QSharedPointer<Resource>& resource) {
return QSharedPointer<Resource>(new Sound(*resource.staticCast<Sound>().data()), &Resource::deleter); return QSharedPointer<Resource>(new Sound(*resource.staticCast<Sound>()), &Resource::deleter);
} }

View file

@ -425,7 +425,7 @@ QSharedPointer<Resource> MaterialCache::createResource(const QUrl& url) {
} }
QSharedPointer<Resource> MaterialCache::createResourceCopy(const QSharedPointer<Resource>& resource) { QSharedPointer<Resource> MaterialCache::createResourceCopy(const QSharedPointer<Resource>& resource) {
return QSharedPointer<Resource>(new NetworkMaterialResource(*resource.staticCast<NetworkMaterialResource>().data()), &Resource::deleter); return QSharedPointer<Resource>(new NetworkMaterialResource(*resource.staticCast<NetworkMaterialResource>()), &Resource::deleter);
} }
NetworkMaterial::NetworkMaterial(const NetworkMaterial& m) : NetworkMaterial::NetworkMaterial(const NetworkMaterial& m) :

View file

@ -29,5 +29,5 @@ QSharedPointer<Resource> ShaderCache::createResource(const QUrl& url) {
} }
QSharedPointer<Resource> ShaderCache::createResourceCopy(const QSharedPointer<Resource>& resource) { QSharedPointer<Resource> ShaderCache::createResourceCopy(const QSharedPointer<Resource>& resource) {
return QSharedPointer<Resource>(new NetworkShader(*resource.staticCast<NetworkShader>().data()), &Resource::deleter); return QSharedPointer<Resource>(new NetworkShader(*resource.staticCast<NetworkShader>()), &Resource::deleter);
} }

View file

@ -197,16 +197,16 @@ public:
namespace std { namespace std {
template <> template <>
struct hash<QByteArray> { struct hash<QByteArray> {
size_t operator()(const QByteArray& a) const { size_t operator()(const QByteArray& byteArray) const {
return qHash(a); return qHash(byteArray);
} }
}; };
template <> template <>
struct hash<TextureExtra> { struct hash<TextureExtra> {
size_t operator()(const TextureExtra& a) const { size_t operator()(const TextureExtra& textureExtra) const {
size_t result = 0; size_t result = 0;
hash_combine(result, (int)a.type, a.content, a.maxNumPixels); hash_combine(result, (int)textureExtra.type, textureExtra.content, textureExtra.maxNumPixels);
return result; return result;
} }
}; };
@ -328,14 +328,13 @@ QSharedPointer<Resource> TextureCache::createResource(const QUrl& url) {
} }
QSharedPointer<Resource> TextureCache::createResourceCopy(const QSharedPointer<Resource>& resource) { QSharedPointer<Resource> TextureCache::createResourceCopy(const QSharedPointer<Resource>& resource) {
return QSharedPointer<Resource>(new NetworkTexture(*resource.staticCast<NetworkTexture>().data()), &Resource::deleter); return QSharedPointer<Resource>(new NetworkTexture(*resource.staticCast<NetworkTexture>()), &Resource::deleter);
} }
int networkTexturePointerMetaTypeId = qRegisterMetaType<QWeakPointer<NetworkTexture>>(); int networkTexturePointerMetaTypeId = qRegisterMetaType<QWeakPointer<NetworkTexture>>();
NetworkTexture::NetworkTexture(const QUrl& url, bool resourceTexture) : NetworkTexture::NetworkTexture(const QUrl& url, bool resourceTexture) :
Resource(url), Resource(url)
_maxNumPixels(100)
{ {
if (resourceTexture) { if (resourceTexture) {
_textureSource = std::make_shared<gpu::TextureSource>(url); _textureSource = std::make_shared<gpu::TextureSource>(url);

View file

@ -76,9 +76,9 @@ namespace std {
template <> template <>
struct hash<GeometryExtra> { struct hash<GeometryExtra> {
size_t operator()(const GeometryExtra& a) const { size_t operator()(const GeometryExtra& geometryExtra) const {
size_t result = 0; size_t result = 0;
hash_combine(result, a.mapping, a.textureBaseUrl, a.combineParts); hash_combine(result, geometryExtra.mapping, geometryExtra.textureBaseUrl, geometryExtra.combineParts);
return result; return result;
} }
}; };
@ -394,7 +394,7 @@ QSharedPointer<Resource> ModelCache::createResource(const QUrl& url) {
} }
QSharedPointer<Resource> ModelCache::createResourceCopy(const QSharedPointer<Resource>& resource) { QSharedPointer<Resource> ModelCache::createResourceCopy(const QSharedPointer<Resource>& resource) {
return QSharedPointer<Resource>(new GeometryDefinitionResource(*resource.staticCast<GeometryDefinitionResource>().data()), &Resource::deleter); return QSharedPointer<Resource>(new GeometryDefinitionResource(*resource.staticCast<GeometryDefinitionResource>()), &Resource::deleter);
} }
GeometryResource::Pointer ModelCache::getGeometryResource(const QUrl& url, GeometryResource::Pointer ModelCache::getGeometryResource(const QUrl& url,

View file

@ -496,7 +496,7 @@ protected:
int _requestID; int _requestID;
ResourceRequest* _request { nullptr }; ResourceRequest* _request { nullptr };
size_t _extraHash; size_t _extraHash { std::numeric_limits<size_t>::max() };
public slots: public slots:
void handleDownloadProgress(uint64_t bytesReceived, uint64_t bytesTotal); void handleDownloadProgress(uint64_t bytesReceived, uint64_t bytesTotal);

View file

@ -54,5 +54,5 @@ QSharedPointer<Resource> ClipCache::createResource(const QUrl& url) {
} }
QSharedPointer<Resource> ClipCache::createResourceCopy(const QSharedPointer<Resource>& resource) { QSharedPointer<Resource> ClipCache::createResourceCopy(const QSharedPointer<Resource>& resource) {
return QSharedPointer<Resource>(new NetworkClipLoader(*resource.staticCast<NetworkClipLoader>().data()), &Resource::deleter); return QSharedPointer<Resource>(new NetworkClipLoader(*resource.staticCast<NetworkClipLoader>()), &Resource::deleter);
} }