From ec7fcb60f3ebaa8ce1a7b05d0065f083d3f4be4b Mon Sep 17 00:00:00 2001 From: Marko Kudjerski Date: Mon, 30 Apr 2018 18:28:21 -0700 Subject: [PATCH 1/4] Updated the license date --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 60e86a1cc7..deb80afc19 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013-2016, High Fidelity, Inc. +Copyright (c) 2013-2018, High Fidelity, Inc. All rights reserved. licensing@highfidelity.io From 2a16ba57ac84b9e3988c6a122dddc57b5346413e Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 8 Nov 2018 15:24:57 -0800 Subject: [PATCH 2/4] fix image entity crash --- .../src/model-networking/ModelCache.cpp | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index 8194361897..dd58b0e75e 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -631,14 +631,16 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur _name = material.name.toStdString(); if (!material.albedoTexture.filename.isEmpty()) { auto map = fetchTextureMap(textureBaseUrl, material.albedoTexture, image::TextureUsage::ALBEDO_TEXTURE, MapChannel::ALBEDO_MAP); - _albedoTransform = material.albedoTexture.transform; - map->setTextureTransform(_albedoTransform); + if (map) { + _albedoTransform = material.albedoTexture.transform; + map->setTextureTransform(_albedoTransform); - if (!material.opacityTexture.filename.isEmpty()) { - if (material.albedoTexture.filename == material.opacityTexture.filename) { - // Best case scenario, just indicating that the albedo map contains transparency - // TODO: Different albedo/opacity maps are not currently supported - map->setUseAlphaChannel(true); + if (!material.opacityTexture.filename.isEmpty()) { + if (material.albedoTexture.filename == material.opacityTexture.filename) { + // Best case scenario, just indicating that the albedo map contains transparency + // TODO: Different albedo/opacity maps are not currently supported + map->setUseAlphaChannel(true); + } } } @@ -670,7 +672,9 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur if (!material.occlusionTexture.filename.isEmpty()) { auto map = fetchTextureMap(textureBaseUrl, material.occlusionTexture, image::TextureUsage::OCCLUSION_TEXTURE, MapChannel::OCCLUSION_MAP); - map->setTextureTransform(material.occlusionTexture.transform); + if (map) { + map->setTextureTransform(material.occlusionTexture.transform); + } setTextureMap(MapChannel::OCCLUSION_MAP, map); } @@ -686,10 +690,12 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur if (!material.lightmapTexture.filename.isEmpty()) { auto map = fetchTextureMap(textureBaseUrl, material.lightmapTexture, image::TextureUsage::LIGHTMAP_TEXTURE, MapChannel::LIGHTMAP_MAP); - _lightmapTransform = material.lightmapTexture.transform; - _lightmapParams = material.lightmapParams; - map->setTextureTransform(_lightmapTransform); - map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); + if (map) { + _lightmapTransform = material.lightmapTexture.transform; + _lightmapParams = material.lightmapParams; + map->setTextureTransform(_lightmapTransform); + map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); + } setTextureMap(MapChannel::LIGHTMAP_MAP, map); } } @@ -709,9 +715,11 @@ void NetworkMaterial::setTextures(const QVariantMap& textureMap) { if (!albedoName.isEmpty()) { auto url = textureMap.contains(albedoName) ? textureMap[albedoName].toUrl() : QUrl(); auto map = fetchTextureMap(url, image::TextureUsage::ALBEDO_TEXTURE, MapChannel::ALBEDO_MAP); - map->setTextureTransform(_albedoTransform); - // when reassigning the albedo texture we also check for the alpha channel used as opacity - map->setUseAlphaChannel(true); + if (map) { + map->setTextureTransform(_albedoTransform); + // when reassigning the albedo texture we also check for the alpha channel used as opacity + map->setUseAlphaChannel(true); + } setTextureMap(MapChannel::ALBEDO_MAP, map); } @@ -757,8 +765,10 @@ void NetworkMaterial::setTextures(const QVariantMap& textureMap) { if (!lightmapName.isEmpty()) { auto url = textureMap.contains(lightmapName) ? textureMap[lightmapName].toUrl() : QUrl(); auto map = fetchTextureMap(url, image::TextureUsage::LIGHTMAP_TEXTURE, MapChannel::LIGHTMAP_MAP); - map->setTextureTransform(_lightmapTransform); - map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); + if (map) { + map->setTextureTransform(_lightmapTransform); + map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); + } setTextureMap(MapChannel::LIGHTMAP_MAP, map); } } From 5d000495df53ce03224b9ea1efcd78c7e33bf967 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 8 Nov 2018 15:33:18 -0800 Subject: [PATCH 3/4] making requested changes --- .../src/model-networking/ModelCache.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index dd58b0e75e..c298cc5580 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -642,9 +642,9 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur map->setUseAlphaChannel(true); } } - } - setTextureMap(MapChannel::ALBEDO_MAP, map); + setTextureMap(MapChannel::ALBEDO_MAP, map); + } } @@ -674,8 +674,8 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur auto map = fetchTextureMap(textureBaseUrl, material.occlusionTexture, image::TextureUsage::OCCLUSION_TEXTURE, MapChannel::OCCLUSION_MAP); if (map) { map->setTextureTransform(material.occlusionTexture.transform); + setTextureMap(MapChannel::OCCLUSION_MAP, map); } - setTextureMap(MapChannel::OCCLUSION_MAP, map); } if (!material.emissiveTexture.filename.isEmpty()) { @@ -695,8 +695,8 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur _lightmapParams = material.lightmapParams; map->setTextureTransform(_lightmapTransform); map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); + setTextureMap(MapChannel::LIGHTMAP_MAP, map); } - setTextureMap(MapChannel::LIGHTMAP_MAP, map); } } @@ -719,8 +719,8 @@ void NetworkMaterial::setTextures(const QVariantMap& textureMap) { map->setTextureTransform(_albedoTransform); // when reassigning the albedo texture we also check for the alpha channel used as opacity map->setUseAlphaChannel(true); + setTextureMap(MapChannel::ALBEDO_MAP, map); } - setTextureMap(MapChannel::ALBEDO_MAP, map); } if (!normalName.isEmpty()) { @@ -768,8 +768,8 @@ void NetworkMaterial::setTextures(const QVariantMap& textureMap) { if (map) { map->setTextureTransform(_lightmapTransform); map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); + setTextureMap(MapChannel::LIGHTMAP_MAP, map); } - setTextureMap(MapChannel::LIGHTMAP_MAP, map); } } From f5b89ee7aa47770e45a2b7b387547d4500a0bdf4 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 8 Nov 2018 15:43:45 -0800 Subject: [PATCH 4/4] reverting previous change --- .../src/model-networking/ModelCache.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index c298cc5580..dd58b0e75e 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -642,9 +642,9 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur map->setUseAlphaChannel(true); } } - - setTextureMap(MapChannel::ALBEDO_MAP, map); } + + setTextureMap(MapChannel::ALBEDO_MAP, map); } @@ -674,8 +674,8 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur auto map = fetchTextureMap(textureBaseUrl, material.occlusionTexture, image::TextureUsage::OCCLUSION_TEXTURE, MapChannel::OCCLUSION_MAP); if (map) { map->setTextureTransform(material.occlusionTexture.transform); - setTextureMap(MapChannel::OCCLUSION_MAP, map); } + setTextureMap(MapChannel::OCCLUSION_MAP, map); } if (!material.emissiveTexture.filename.isEmpty()) { @@ -695,8 +695,8 @@ NetworkMaterial::NetworkMaterial(const HFMMaterial& material, const QUrl& textur _lightmapParams = material.lightmapParams; map->setTextureTransform(_lightmapTransform); map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); - setTextureMap(MapChannel::LIGHTMAP_MAP, map); } + setTextureMap(MapChannel::LIGHTMAP_MAP, map); } } @@ -719,8 +719,8 @@ void NetworkMaterial::setTextures(const QVariantMap& textureMap) { map->setTextureTransform(_albedoTransform); // when reassigning the albedo texture we also check for the alpha channel used as opacity map->setUseAlphaChannel(true); - setTextureMap(MapChannel::ALBEDO_MAP, map); } + setTextureMap(MapChannel::ALBEDO_MAP, map); } if (!normalName.isEmpty()) { @@ -768,8 +768,8 @@ void NetworkMaterial::setTextures(const QVariantMap& textureMap) { if (map) { map->setTextureTransform(_lightmapTransform); map->setLightmapOffsetScale(_lightmapParams.x, _lightmapParams.y); - setTextureMap(MapChannel::LIGHTMAP_MAP, map); } + setTextureMap(MapChannel::LIGHTMAP_MAP, map); } }