Skip to content

Commit

Permalink
fix: texture/cubemap patch data can be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksims Mihejevs committed Aug 24, 2015
1 parent 6b02da2 commit 1214a75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# PlayCanvas Engine Changes

### 0.173.0
* Added tags (`pc.Tags`) interface to pc.Asset
* Added findByTag method to pc.AssetRegistry
* [FIX] Texture and CubeMap data in patch can be optional

### 0.172.0
* Added 'curve' script attributes
* Added 'colorcurve' script attributes
Expand Down
8 changes: 4 additions & 4 deletions src/resources/resources_cubemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ pc.extend(pc, function () {
if (cubemap.name !== assetCubeMap.name)
cubemap.name = assetCubeMap.name;

if (cubemap.rgbm !== !! assetCubeMap.data.rgbm)
if (assetCubeMap.hasOwnProperty('rgbm') && cubemap.rgbm !== !! assetCubeMap.data.rgbm)
cubemap.rgbm = !! assetCubeMap.data.rgbm;

cubemap.fixCubemapSeams = !! assetCubeMap._dds;

if (cubemap.minFilter !== assetCubeMap.data.minFilter)
if (assetCubeMap.hasOwnProperty('minFilter') && cubemap.minFilter !== assetCubeMap.data.minFilter)
cubemap.minFilter = assetCubeMap.data.minFilter;

if (cubemap.magFilter !== assetCubeMap.data.magFilter)
if (assetCubeMap.hasOwnProperty('magFilter') && cubemap.magFilter !== assetCubeMap.data.magFilter)
cubemap.magFilter = assetCubeMap.data.magFilter;

if (cubemap.anisotropy !== assetCubeMap.data.anisotropy)
if (assetCubeMap.hasOwnProperty('anisotropy') && cubemap.anisotropy !== assetCubeMap.data.anisotropy)
cubemap.anisotropy = assetCubeMap.data.anisotropy;

if (cubemap.addressU !== pc.ADDRESS_CLAMP_TO_EDGE)
Expand Down
12 changes: 6 additions & 6 deletions src/resources/resources_texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,22 @@ pc.extend(pc, function () {
if (texture.name !== asset.name)
texture.name = asset.name;

if (asset.data.minfilter && texture.minFilter !== JSON_FILTER_MODE[asset.data.minfilter])
if (asset.data.hasOwnProperty('minfilter') && texture.minFilter !== JSON_FILTER_MODE[asset.data.minfilter])
texture.minFilter = JSON_FILTER_MODE[asset.data.minfilter];

if (asset.data.magfilter && texture.magFilter !== JSON_FILTER_MODE[asset.data.magfilter])
if (asset.data.hasOwnProperty('magfilter') && texture.magFilter !== JSON_FILTER_MODE[asset.data.magfilter])
texture.magFilter = JSON_FILTER_MODE[asset.data.magfilter];

if (asset.data.addressu && texture.addressU !== JSON_ADDRESS_MODE[asset.data.addressu])
if (asset.data.hasOwnProperty('addressu') && texture.addressU !== JSON_ADDRESS_MODE[asset.data.addressu])
texture.addressU = JSON_ADDRESS_MODE[asset.data.addressu];

if (asset.data.addressv && texture.addressV !== JSON_ADDRESS_MODE[asset.data.addressv])
if (asset.data.hasOwnProperty('addressv') && texture.addressV !== JSON_ADDRESS_MODE[asset.data.addressv])
texture.addressV = JSON_ADDRESS_MODE[asset.data.addressv];

if (texture.anisotropy !== asset.data.anisotropy)
if (asset.data.hasOwnProperty('anisotropy') && texture.anisotropy !== asset.data.anisotropy)
texture.anisotropy = asset.data.anisotropy;

if (texture.rgbm !== !! asset.data.rgbm)
if (asset.data.hasOwnProperty('rgbm') && texture.rgbm !== !! asset.data.rgbm)
texture.rgbm = !! asset.data.rgbm;
}
};
Expand Down

0 comments on commit 1214a75

Please sign in to comment.