@colijnit/configurator 12.0.12 → 12.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/colijnit-configurator.umd.js +250 -190
- package/bundles/colijnit-configurator.umd.js.map +1 -1
- package/esm2015/helper/variation-helper.js +117 -90
- package/esm2015/model/material.js +1 -1
- package/esm2015/model/variation-settings.js +1 -1
- package/esm2015/utils/asset.utils.js +31 -43
- package/esm2015/utils/image.utils.js +3 -2
- package/esm2015/utils/variation-utils.js +44 -18
- package/fesm2015/colijnit-configurator.js +192 -150
- package/fesm2015/colijnit-configurator.js.map +1 -1
- package/model/material.d.ts +4 -0
- package/model/variation-settings.d.ts +17 -10
- package/package.json +2 -2
- package/utils/asset.utils.d.ts +2 -0
- package/utils/image.utils.d.ts +1 -1
|
@@ -797,7 +797,8 @@
|
|
|
797
797
|
var ImageUtils = /** @class */ (function () {
|
|
798
798
|
function ImageUtils() {
|
|
799
799
|
}
|
|
800
|
-
ImageUtils.CreateTextureFromBase64 = function (id, base64, material) {
|
|
800
|
+
ImageUtils.CreateTextureFromBase64 = function (id, base64, material, defaultFlip) {
|
|
801
|
+
if (defaultFlip === void 0) { defaultFlip = false; }
|
|
801
802
|
return new Promise(function (resolve) {
|
|
802
803
|
if (ImageUtils.textures.has(id)) {
|
|
803
804
|
resolve(ImageUtils.textures.get(id));
|
|
@@ -813,6 +814,7 @@
|
|
|
813
814
|
texture.wrapS = THREE__namespace.RepeatWrapping;
|
|
814
815
|
texture.wrapT = THREE__namespace.RepeatWrapping;
|
|
815
816
|
texture.repeat = new THREE__namespace.Vector2(material ? material.repeatX : 1, material ? material.repeatY : 1);
|
|
817
|
+
texture.flipY = defaultFlip;
|
|
816
818
|
texture.needsUpdate = true;
|
|
817
819
|
ImageUtils.textures.set(id, texture);
|
|
818
820
|
resolve(texture);
|
|
@@ -865,9 +867,9 @@
|
|
|
865
867
|
}
|
|
866
868
|
AssetUtils.CreateMaterialFromAsset = function (asset) {
|
|
867
869
|
return __awaiter(this, void 0, void 0, function () {
|
|
868
|
-
var material, _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
869
|
-
return __generator(this, function (
|
|
870
|
-
switch (
|
|
870
|
+
var material, _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, metalness, roughness;
|
|
871
|
+
return __generator(this, function (_m) {
|
|
872
|
+
switch (_m.label) {
|
|
871
873
|
case 0:
|
|
872
874
|
material = new Material();
|
|
873
875
|
if (!asset) {
|
|
@@ -880,24 +882,24 @@
|
|
|
880
882
|
_a = material;
|
|
881
883
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_texture', asset.texture, material)];
|
|
882
884
|
case 1:
|
|
883
|
-
_a.texture =
|
|
885
|
+
_a.texture = _m.sent();
|
|
884
886
|
material.texture.encoding = THREE.sRGBEncoding;
|
|
885
887
|
material.textureFilename = asset.textureFilename;
|
|
886
|
-
|
|
888
|
+
_m.label = 2;
|
|
887
889
|
case 2:
|
|
888
890
|
if (!asset.normal) return [3 /*break*/, 4];
|
|
889
891
|
_b = material;
|
|
890
892
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_normal', asset.normal, material)];
|
|
891
893
|
case 3:
|
|
892
|
-
_b.normal =
|
|
894
|
+
_b.normal = _m.sent();
|
|
893
895
|
material.normalFilename = asset.normalFilename;
|
|
894
|
-
|
|
896
|
+
_m.label = 4;
|
|
895
897
|
case 4:
|
|
896
898
|
if (!asset.orm) return [3 /*break*/, 6];
|
|
897
899
|
_c = material;
|
|
898
900
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_orm', asset.orm, material)];
|
|
899
901
|
case 5:
|
|
900
|
-
_c.ao =
|
|
902
|
+
_c.ao = _m.sent();
|
|
901
903
|
material.roughness = material.ao;
|
|
902
904
|
material.metalness = material.ao;
|
|
903
905
|
material.aoFilename = asset.ormFilename;
|
|
@@ -909,50 +911,88 @@
|
|
|
909
911
|
_d = material;
|
|
910
912
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_ao', asset.ao, material)];
|
|
911
913
|
case 7:
|
|
912
|
-
_d.ao =
|
|
914
|
+
_d.ao = _m.sent();
|
|
913
915
|
material.aoFilename = asset.aoFilename;
|
|
914
|
-
|
|
916
|
+
_m.label = 8;
|
|
915
917
|
case 8:
|
|
916
918
|
if (!asset.metalness) return [3 /*break*/, 10];
|
|
917
919
|
_e = material;
|
|
918
920
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_metalness', asset.metalness, material)];
|
|
919
921
|
case 9:
|
|
920
|
-
_e.metalness =
|
|
922
|
+
_e.metalness = _m.sent();
|
|
921
923
|
material.metalnessFilename = asset.metalnessFilename;
|
|
922
|
-
|
|
924
|
+
_m.label = 10;
|
|
923
925
|
case 10:
|
|
924
926
|
if (!asset.roughness) return [3 /*break*/, 12];
|
|
925
927
|
_f = material;
|
|
926
928
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_roughness', asset.roughness, material)];
|
|
927
929
|
case 11:
|
|
928
|
-
_f.roughness =
|
|
930
|
+
_f.roughness = _m.sent();
|
|
929
931
|
material.roughnessFilename = asset.roughnessFilename;
|
|
930
|
-
|
|
932
|
+
_m.label = 12;
|
|
931
933
|
case 12:
|
|
932
934
|
if (!asset.displacement) return [3 /*break*/, 14];
|
|
933
935
|
_g = material;
|
|
934
936
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_displacement', asset.displacement, material)];
|
|
935
937
|
case 13:
|
|
936
|
-
_g.displacement =
|
|
938
|
+
_g.displacement = _m.sent();
|
|
937
939
|
material.displacementFilename = asset.displacementFilename;
|
|
938
|
-
|
|
940
|
+
_m.label = 14;
|
|
939
941
|
case 14:
|
|
940
942
|
if (!asset.envMap) return [3 /*break*/, 16];
|
|
941
943
|
_h = material;
|
|
942
|
-
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_env', asset.envMap, material)];
|
|
944
|
+
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_env', asset.envMap, material, true)];
|
|
943
945
|
case 15:
|
|
944
|
-
_h.envMap =
|
|
946
|
+
_h.envMap = _m.sent();
|
|
945
947
|
material.envMapFilename = asset.envMapFilename;
|
|
946
|
-
|
|
948
|
+
_m.label = 16;
|
|
947
949
|
case 16:
|
|
948
|
-
if (!asset.
|
|
950
|
+
if (!asset.sheenColorMap) return [3 /*break*/, 18];
|
|
949
951
|
_j = material;
|
|
950
|
-
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '
|
|
952
|
+
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_sheen_color', asset.sheenColorMap, material)];
|
|
951
953
|
case 17:
|
|
952
|
-
_j.
|
|
954
|
+
_j.sheenColorMap = _m.sent();
|
|
955
|
+
material.sheenColorMapFileName = asset.sheenColorMapFilename;
|
|
956
|
+
_m.label = 18;
|
|
957
|
+
case 18:
|
|
958
|
+
if (!asset.sheenRoughnessMap) return [3 /*break*/, 20];
|
|
959
|
+
_k = material;
|
|
960
|
+
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_sheen_roughness', asset.sheenRoughnessMap, material)];
|
|
961
|
+
case 19:
|
|
962
|
+
_k.sheenRoughnessMap = _m.sent();
|
|
963
|
+
material.sheenRoughnessMapFileName = asset.sheenRoughnessMapFilename;
|
|
964
|
+
_m.label = 20;
|
|
965
|
+
case 20:
|
|
966
|
+
if (!asset.emissive) return [3 /*break*/, 22];
|
|
967
|
+
_l = material;
|
|
968
|
+
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_emissive', asset.emissive, material)];
|
|
969
|
+
case 21:
|
|
970
|
+
_l.emissive = _m.sent();
|
|
953
971
|
material.emissiveFileName = asset.emissiveFilename;
|
|
954
|
-
|
|
955
|
-
case
|
|
972
|
+
_m.label = 22;
|
|
973
|
+
case 22:
|
|
974
|
+
metalness = parseFloat(asset['metalness']);
|
|
975
|
+
if (!isNaN(metalness)) {
|
|
976
|
+
material.metalnessValue = Math.min(1, metalness);
|
|
977
|
+
}
|
|
978
|
+
roughness = parseFloat(asset['roughness']);
|
|
979
|
+
if (!isNaN(roughness)) {
|
|
980
|
+
material.roughnessValue = Math.min(1, roughness);
|
|
981
|
+
}
|
|
982
|
+
material.sheen = asset.sheen;
|
|
983
|
+
material.emissiveIntensityValue = asset.emissiveIntensity;
|
|
984
|
+
material.emissiveValue = asset.emissiveValue;
|
|
985
|
+
material.side = asset.side;
|
|
986
|
+
material.sheenColor = asset.sheenColor;
|
|
987
|
+
material.sheenRoughness = asset.sheenRoughness;
|
|
988
|
+
material.opacity = asset.opacity;
|
|
989
|
+
material.transparent = asset.transparent;
|
|
990
|
+
material.envMapIntensity = asset.envMapIntensity;
|
|
991
|
+
material.reflectivity = asset.reflectivity;
|
|
992
|
+
material.displacementValue = asset.displacementValue;
|
|
993
|
+
material.transparency = asset.transparency;
|
|
994
|
+
material.transmission = asset.transmission;
|
|
995
|
+
return [2 /*return*/, material];
|
|
956
996
|
}
|
|
957
997
|
});
|
|
958
998
|
});
|
|
@@ -976,44 +1016,6 @@
|
|
|
976
1016
|
if (!isNaN(repeaty)) {
|
|
977
1017
|
material.repeatY = repeaty;
|
|
978
1018
|
}
|
|
979
|
-
var metalness = parseFloat(settings['metalness']);
|
|
980
|
-
if (!isNaN(metalness)) {
|
|
981
|
-
material.metalnessValue = Math.min(1, metalness);
|
|
982
|
-
}
|
|
983
|
-
var roughness = parseFloat(settings['roughness']);
|
|
984
|
-
if (!isNaN(roughness)) {
|
|
985
|
-
material.roughnessValue = Math.min(1, roughness);
|
|
986
|
-
}
|
|
987
|
-
if (settings.hasOwnProperty('side')) {
|
|
988
|
-
material.side = settings.side;
|
|
989
|
-
}
|
|
990
|
-
if (settings.hasOwnProperty('sheenColor')) {
|
|
991
|
-
material.sheenColor = settings.sheenColor;
|
|
992
|
-
}
|
|
993
|
-
if (settings.hasOwnProperty('opacity')) {
|
|
994
|
-
material.opacity = settings.opacity;
|
|
995
|
-
}
|
|
996
|
-
if (settings.hasOwnProperty('transparent')) {
|
|
997
|
-
material.transparent = settings.transparent;
|
|
998
|
-
}
|
|
999
|
-
if (settings.hasOwnProperty('envMap')) {
|
|
1000
|
-
material.envMap = settings.envMap;
|
|
1001
|
-
}
|
|
1002
|
-
if (settings.hasOwnProperty('envMapIntensity')) {
|
|
1003
|
-
material.envMapIntensity = settings.envMapIntensity;
|
|
1004
|
-
}
|
|
1005
|
-
if (settings.hasOwnProperty('reflectivity')) {
|
|
1006
|
-
material.reflectivity = settings.reflectivity;
|
|
1007
|
-
}
|
|
1008
|
-
if (settings.hasOwnProperty('displacementValue')) {
|
|
1009
|
-
material.displacementValue = settings.displacementValue;
|
|
1010
|
-
}
|
|
1011
|
-
if (settings.hasOwnProperty('transparency')) {
|
|
1012
|
-
material.transparency = settings.transparency;
|
|
1013
|
-
}
|
|
1014
|
-
if (settings.hasOwnProperty('transmission')) {
|
|
1015
|
-
material.transmission = settings.transmission;
|
|
1016
|
-
}
|
|
1017
1019
|
};
|
|
1018
1020
|
return AssetUtils;
|
|
1019
1021
|
}());
|
|
@@ -1162,31 +1164,31 @@
|
|
|
1162
1164
|
};
|
|
1163
1165
|
VariationUtils.CreateSettingsBasedOnIndex = function (index, variationSettings, zipContent) {
|
|
1164
1166
|
return __awaiter(this, void 0, void 0, function () {
|
|
1165
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1166
|
-
return __generator(this, function (
|
|
1167
|
-
switch (
|
|
1167
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1168
|
+
return __generator(this, function (_m) {
|
|
1169
|
+
switch (_m.label) {
|
|
1168
1170
|
case 0:
|
|
1169
1171
|
if (!index.normalFile) return [3 /*break*/, 2];
|
|
1170
1172
|
_a = variationSettings;
|
|
1171
1173
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.normalFile], index.normalFile)];
|
|
1172
1174
|
case 1:
|
|
1173
|
-
_a.normal =
|
|
1175
|
+
_a.normal = _m.sent();
|
|
1174
1176
|
variationSettings.normalFilename = index.normalFile;
|
|
1175
|
-
|
|
1177
|
+
_m.label = 2;
|
|
1176
1178
|
case 2:
|
|
1177
1179
|
if (!index.diffuseFile) return [3 /*break*/, 4];
|
|
1178
1180
|
_b = variationSettings;
|
|
1179
1181
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.diffuseFile], index.diffuseFile)];
|
|
1180
1182
|
case 3:
|
|
1181
|
-
_b.texture =
|
|
1183
|
+
_b.texture = _m.sent();
|
|
1182
1184
|
variationSettings.textureFilename = index.diffuseFile;
|
|
1183
|
-
|
|
1185
|
+
_m.label = 4;
|
|
1184
1186
|
case 4:
|
|
1185
1187
|
if (!index.ormFile) return [3 /*break*/, 6];
|
|
1186
1188
|
_c = variationSettings;
|
|
1187
1189
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.ormFile], index.ormFile)];
|
|
1188
1190
|
case 5:
|
|
1189
|
-
_c.orm =
|
|
1191
|
+
_c.orm = _m.sent();
|
|
1190
1192
|
variationSettings.ormFilename = index.ormFile;
|
|
1191
1193
|
return [3 /*break*/, 12];
|
|
1192
1194
|
case 6:
|
|
@@ -1194,74 +1196,93 @@
|
|
|
1194
1196
|
_d = variationSettings;
|
|
1195
1197
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.aoFile], index.aoFile)];
|
|
1196
1198
|
case 7:
|
|
1197
|
-
_d.ao =
|
|
1199
|
+
_d.ao = _m.sent();
|
|
1198
1200
|
variationSettings.aoFilename = index.aoFile;
|
|
1199
|
-
|
|
1201
|
+
_m.label = 8;
|
|
1200
1202
|
case 8:
|
|
1201
1203
|
if (!index.metalnessFile) return [3 /*break*/, 10];
|
|
1202
1204
|
_e = variationSettings;
|
|
1203
1205
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.metalnessFile], index.metalnessFile)];
|
|
1204
1206
|
case 9:
|
|
1205
|
-
_e.metalness =
|
|
1207
|
+
_e.metalness = _m.sent();
|
|
1206
1208
|
variationSettings.metalnessFilename = index.metalnessFile;
|
|
1207
|
-
|
|
1209
|
+
_m.label = 10;
|
|
1208
1210
|
case 10:
|
|
1209
1211
|
if (!index.roughnessFile) return [3 /*break*/, 12];
|
|
1210
1212
|
_f = variationSettings;
|
|
1211
1213
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.roughnessFile], index.roughnessFile)];
|
|
1212
1214
|
case 11:
|
|
1213
|
-
_f.roughness =
|
|
1215
|
+
_f.roughness = _m.sent();
|
|
1214
1216
|
variationSettings.roughnessFilename = index.roughnessFile;
|
|
1215
|
-
|
|
1217
|
+
_m.label = 12;
|
|
1216
1218
|
case 12:
|
|
1217
1219
|
if (!index.displacementFile) return [3 /*break*/, 14];
|
|
1218
1220
|
_g = variationSettings;
|
|
1219
1221
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.displacementFile], index.displacementFile)];
|
|
1220
1222
|
case 13:
|
|
1221
|
-
_g.displacement =
|
|
1223
|
+
_g.displacement = _m.sent();
|
|
1222
1224
|
variationSettings.displacementFilename = index.displacementFile;
|
|
1223
|
-
|
|
1225
|
+
_m.label = 14;
|
|
1224
1226
|
case 14:
|
|
1225
1227
|
if (!index.emissiveFile) return [3 /*break*/, 16];
|
|
1226
1228
|
_h = variationSettings;
|
|
1227
1229
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.emissiveFile], index.emissiveFile)];
|
|
1228
1230
|
case 15:
|
|
1229
|
-
_h.emissive =
|
|
1231
|
+
_h.emissive = _m.sent();
|
|
1230
1232
|
variationSettings.emissiveFilename = index.emissiveFile;
|
|
1231
|
-
|
|
1233
|
+
_m.label = 16;
|
|
1232
1234
|
case 16:
|
|
1233
1235
|
if (!index.envMapFile) return [3 /*break*/, 18];
|
|
1234
1236
|
_j = variationSettings;
|
|
1235
1237
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.envMapFile], index.envMapFile)];
|
|
1236
1238
|
case 17:
|
|
1237
|
-
_j.envMap =
|
|
1239
|
+
_j.envMap = _m.sent();
|
|
1238
1240
|
variationSettings.envMapFilename = index.envMapFile;
|
|
1239
|
-
|
|
1241
|
+
_m.label = 18;
|
|
1240
1242
|
case 18:
|
|
1243
|
+
if (!index.sheenColorMapFile) return [3 /*break*/, 20];
|
|
1241
1244
|
_k = variationSettings;
|
|
1242
|
-
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[
|
|
1245
|
+
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.sheenColorMapFile], index.sheenColorMapFile)];
|
|
1243
1246
|
case 19:
|
|
1244
|
-
_k.
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1247
|
+
_k.sheenColorMap = _m.sent();
|
|
1248
|
+
variationSettings.sheenColorMapFilename = index.sheenColorMapFile;
|
|
1249
|
+
_m.label = 20;
|
|
1250
|
+
case 20:
|
|
1251
|
+
if (!index.sheenRoughnessMapFile) return [3 /*break*/, 22];
|
|
1252
|
+
_l = variationSettings;
|
|
1253
|
+
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.sheenRoughnessMapFile], index.sheenRoughnessMapFile)];
|
|
1254
|
+
case 21:
|
|
1255
|
+
_l.sheenRoughnessMap = _m.sent();
|
|
1256
|
+
variationSettings.sheenRoughnessMapFilename = index.sheenColorMapFile;
|
|
1257
|
+
_m.label = 22;
|
|
1258
|
+
case 22:
|
|
1259
|
+
if (index.repeat) {
|
|
1260
|
+
variationSettings.settings = {
|
|
1261
|
+
repeatx: index.repeat.repeatx,
|
|
1262
|
+
repeaty: index.repeat.repeaty
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
// variationSettings.settings =
|
|
1266
|
+
// await VariationUtils.LoadFileContentFromZip(zipContent.files['repeat.json'], 'repeat.json', false) || {};
|
|
1267
|
+
variationSettings.metalness = index.metalness;
|
|
1268
|
+
variationSettings.roughness = index.roughness;
|
|
1269
|
+
variationSettings.sheen = index.sheen;
|
|
1249
1270
|
if (index.sheenColor) {
|
|
1250
|
-
variationSettings.
|
|
1271
|
+
variationSettings.sheenColor = new THREE__namespace.Color(index.sheenColor.r, index.sheenColor.g, index.sheenColor.b);
|
|
1251
1272
|
}
|
|
1252
|
-
variationSettings.
|
|
1253
|
-
variationSettings.
|
|
1254
|
-
variationSettings.
|
|
1255
|
-
variationSettings.
|
|
1273
|
+
variationSettings.sheenRoughness = index.sheenRoughness;
|
|
1274
|
+
variationSettings.envMapIntensity = index.envMapIntensity;
|
|
1275
|
+
variationSettings.transparent = index.transparent;
|
|
1276
|
+
variationSettings.opacity = index.opacity;
|
|
1256
1277
|
if (index.emissiveValue) {
|
|
1257
|
-
variationSettings.
|
|
1278
|
+
variationSettings.emissiveValue = new THREE__namespace.Color(index.emissiveValue.r, index.emissiveValue.g, index.emissiveValue.b);
|
|
1258
1279
|
}
|
|
1259
|
-
variationSettings.
|
|
1260
|
-
variationSettings.
|
|
1261
|
-
variationSettings.
|
|
1262
|
-
variationSettings.
|
|
1263
|
-
variationSettings.
|
|
1264
|
-
variationSettings.
|
|
1280
|
+
variationSettings.emissiveIntensity = index.emissiveIntensity;
|
|
1281
|
+
variationSettings.reflectivity = index.reflectivity;
|
|
1282
|
+
variationSettings.displacementValue = index.displacementValue;
|
|
1283
|
+
variationSettings.side = index.side;
|
|
1284
|
+
variationSettings.transparency = index.transparency;
|
|
1285
|
+
variationSettings.transmission = index.transmission;
|
|
1265
1286
|
return [2 /*return*/];
|
|
1266
1287
|
}
|
|
1267
1288
|
});
|
|
@@ -1332,6 +1353,18 @@
|
|
|
1332
1353
|
variationSettings.envMapFilename = fileName;
|
|
1333
1354
|
}));
|
|
1334
1355
|
}
|
|
1356
|
+
else if (file_1.name.toLowerCase().indexOf('sheenColorMap') > -1 && this_1.FileIsImage(file_1.name)) {
|
|
1357
|
+
allLoaded.push(zipContent.files[fileName].async('base64').then(function (sheenColorMapFile) {
|
|
1358
|
+
variationSettings.sheenColorMap = "data:image/" + _this.GetBase64FileType(file_1.name) + ";base64," + sheenColorMapFile;
|
|
1359
|
+
variationSettings.sheenColorMapFilename = fileName;
|
|
1360
|
+
}));
|
|
1361
|
+
}
|
|
1362
|
+
else if (file_1.name.toLowerCase().indexOf('sheenRoughnessMap') > -1 && this_1.FileIsImage(file_1.name)) {
|
|
1363
|
+
allLoaded.push(zipContent.files[fileName].async('base64').then(function (sheenRoughnessMapFile) {
|
|
1364
|
+
variationSettings.sheenRoughnessMap = "data:image/" + _this.GetBase64FileType(file_1.name) + ";base64," + sheenRoughnessMapFile;
|
|
1365
|
+
variationSettings.sheenRoughnessMapFilename = fileName;
|
|
1366
|
+
}));
|
|
1367
|
+
}
|
|
1335
1368
|
else if (file_1.name.indexOf('.jp') > -1) {
|
|
1336
1369
|
allLoaded.push(zipContent.files[fileName].async('base64').then(function (textureFile) {
|
|
1337
1370
|
variationSettings.texture = 'data:image/jpeg;base64,' + textureFile;
|
|
@@ -1793,171 +1826,198 @@
|
|
|
1793
1826
|
};
|
|
1794
1827
|
VariationHelper.prototype._setMeshMaterialFromVariation = function (name, variation, usePbr) {
|
|
1795
1828
|
if (usePbr === void 0) { usePbr = false; }
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1829
|
+
var material = variation.material;
|
|
1830
|
+
if (material.texture) {
|
|
1831
|
+
material.texture.needsUpdate = true;
|
|
1832
|
+
material.texture.mapping = THREE__namespace.EquirectangularReflectionMapping;
|
|
1799
1833
|
}
|
|
1800
1834
|
if (!usePbr) {
|
|
1801
1835
|
var newMaterial = new THREE__namespace.MeshPhongMaterial({
|
|
1802
1836
|
name: name,
|
|
1803
|
-
shininess:
|
|
1804
|
-
specular:
|
|
1805
|
-
map:
|
|
1806
|
-
normalMap:
|
|
1837
|
+
shininess: material.shininess,
|
|
1838
|
+
specular: material.specular,
|
|
1839
|
+
map: material.texture,
|
|
1840
|
+
normalMap: material.normal
|
|
1807
1841
|
});
|
|
1808
1842
|
newMaterial.color.setRGB(0.8, 0.8, 0.8);
|
|
1809
1843
|
newMaterial.needsUpdate = true;
|
|
1810
1844
|
return newMaterial;
|
|
1811
1845
|
}
|
|
1812
|
-
if (
|
|
1846
|
+
if (material.sheen || material.sheenColor || material.reflectivity) { // TODO: Proper check for all unique physical material properties
|
|
1813
1847
|
var params = {
|
|
1814
1848
|
// side: material.side ? material.side : FrontSide,
|
|
1815
1849
|
name: name,
|
|
1816
|
-
roughness:
|
|
1817
|
-
metalness:
|
|
1818
|
-
envMapIntensity:
|
|
1819
|
-
clearcoatMap:
|
|
1820
|
-
clearcoatRoughnessMap:
|
|
1850
|
+
roughness: material.roughnessValue ? material.roughnessValue : 1,
|
|
1851
|
+
metalness: material.metalnessValue ? material.metalnessValue : 0,
|
|
1852
|
+
envMapIntensity: material.envMapIntensity ? material.envMapIntensity : 0.01,
|
|
1853
|
+
clearcoatMap: material.clearcoatMap ? material.clearcoatMap : null,
|
|
1854
|
+
clearcoatRoughnessMap: material.clearcoatRoughnessMap ? material.clearcoatRoughnessMap : null,
|
|
1821
1855
|
// wireframe: true,
|
|
1822
1856
|
// opacity: 0.3,
|
|
1823
1857
|
// transparent: true,
|
|
1824
1858
|
};
|
|
1825
|
-
if (
|
|
1826
|
-
params.displacementScale =
|
|
1859
|
+
if (material.displacementValue) {
|
|
1860
|
+
params.displacementScale = material.displacementValue;
|
|
1827
1861
|
}
|
|
1828
|
-
if (
|
|
1829
|
-
params.
|
|
1862
|
+
if (material.opacity) {
|
|
1863
|
+
params.opacity = material.opacity;
|
|
1830
1864
|
}
|
|
1831
|
-
if (
|
|
1832
|
-
params.
|
|
1865
|
+
if (material.transparency) {
|
|
1866
|
+
params.transmission = material.transparency;
|
|
1833
1867
|
}
|
|
1834
|
-
if (
|
|
1835
|
-
params.
|
|
1868
|
+
if (material.transmission) {
|
|
1869
|
+
params.transmission = material.transmission;
|
|
1836
1870
|
}
|
|
1837
|
-
if (
|
|
1838
|
-
params.
|
|
1871
|
+
if (material.transparent) {
|
|
1872
|
+
params.transparent = material.transparent;
|
|
1839
1873
|
}
|
|
1840
|
-
if (
|
|
1841
|
-
params.
|
|
1874
|
+
if (material.emissiveValue) {
|
|
1875
|
+
params.emissive = material.emissiveValue;
|
|
1842
1876
|
}
|
|
1843
|
-
if (
|
|
1844
|
-
params.
|
|
1877
|
+
if (material.emissiveIntensityValue) {
|
|
1878
|
+
params.emissiveIntensity = material.emissiveIntensityValue;
|
|
1879
|
+
}
|
|
1880
|
+
if (material.texture) {
|
|
1881
|
+
params.map = material.texture;
|
|
1845
1882
|
params.map.needsUpdate = true;
|
|
1846
1883
|
}
|
|
1847
|
-
if (
|
|
1848
|
-
params.aoMap =
|
|
1884
|
+
if (material.ao) {
|
|
1885
|
+
params.aoMap = material.ao;
|
|
1849
1886
|
params.aoMap.needsUpdate = true;
|
|
1850
1887
|
}
|
|
1851
|
-
if (
|
|
1852
|
-
params.roughnessMap =
|
|
1888
|
+
if (material.roughness) {
|
|
1889
|
+
params.roughnessMap = material.roughness;
|
|
1853
1890
|
params.roughnessMap.needsUpdate = true;
|
|
1854
|
-
//
|
|
1891
|
+
// material.roughness.magFilter = NearestFilter;
|
|
1855
1892
|
}
|
|
1856
|
-
if (
|
|
1857
|
-
params.metalnessMap =
|
|
1893
|
+
if (material.metalness) {
|
|
1894
|
+
params.metalnessMap = material.metalness;
|
|
1858
1895
|
params.metalnessMap.needsUpdate = true;
|
|
1859
1896
|
}
|
|
1860
|
-
if (
|
|
1861
|
-
params.normalMap =
|
|
1897
|
+
if (material.normal) {
|
|
1898
|
+
params.normalMap = material.normal;
|
|
1862
1899
|
params.normalMap.needsUpdate = true;
|
|
1863
1900
|
}
|
|
1864
|
-
if (
|
|
1865
|
-
params.displacementMap =
|
|
1901
|
+
if (material.displacement) {
|
|
1902
|
+
params.displacementMap = material.displacement;
|
|
1866
1903
|
params.displacementMap.needsUpdate = true;
|
|
1867
1904
|
}
|
|
1868
|
-
if (
|
|
1869
|
-
params.emissiveMap =
|
|
1905
|
+
if (material.emissive) {
|
|
1906
|
+
params.emissiveMap = material.emissive;
|
|
1870
1907
|
params.emissiveMap.needsUpdate = true;
|
|
1871
1908
|
}
|
|
1872
|
-
if (
|
|
1873
|
-
if (
|
|
1874
|
-
params.envMap =
|
|
1909
|
+
if (material.envMap) {
|
|
1910
|
+
if (material.envMapIntensity != null || 0) {
|
|
1911
|
+
params.envMap = material.envMap;
|
|
1875
1912
|
params.envMap.needsUpdate = true;
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1913
|
+
material.envMap.mapping = THREE__namespace.EquirectangularReflectionMapping;
|
|
1914
|
+
material.envMap.minFilter = THREE__namespace.NearestFilter;
|
|
1915
|
+
material.envMap.magFilter = THREE__namespace.NearestFilter;
|
|
1879
1916
|
}
|
|
1880
1917
|
}
|
|
1881
|
-
if (
|
|
1882
|
-
params.reflectivity =
|
|
1918
|
+
if (material.reflectivity) {
|
|
1919
|
+
params.reflectivity = material.reflectivity;
|
|
1883
1920
|
}
|
|
1884
|
-
if (
|
|
1885
|
-
params.side =
|
|
1921
|
+
if (material.side) {
|
|
1922
|
+
params.side = material.side;
|
|
1886
1923
|
}
|
|
1887
1924
|
var newMaterial = new THREE__namespace.MeshPhysicalMaterial(params);
|
|
1888
1925
|
newMaterial.color.setRGB(1, 1, 1);
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
newMaterial.transmission = variation.material.transmission;
|
|
1926
|
+
if (material.sheen) {
|
|
1927
|
+
newMaterial.sheen = material.sheen;
|
|
1892
1928
|
}
|
|
1929
|
+
if (material.sheenColor) {
|
|
1930
|
+
newMaterial.sheenColor = material.sheenColor;
|
|
1931
|
+
}
|
|
1932
|
+
if (material.sheenRoughness) {
|
|
1933
|
+
newMaterial.sheenRoughness = material.sheenRoughness;
|
|
1934
|
+
}
|
|
1935
|
+
if (material.sheenColorMap) {
|
|
1936
|
+
newMaterial.sheenColorMap = material.sheenColorMap;
|
|
1937
|
+
newMaterial.sheenColorMap.needsUpdate = true;
|
|
1938
|
+
}
|
|
1939
|
+
if (material.sheenRoughnessMap) {
|
|
1940
|
+
newMaterial.sheenRoughnessMap = material.sheenRoughnessMap;
|
|
1941
|
+
newMaterial.sheenRoughnessMap.needsUpdate = true;
|
|
1942
|
+
}
|
|
1943
|
+
if (material.transmission) {
|
|
1944
|
+
newMaterial.transmission = material.transmission;
|
|
1945
|
+
}
|
|
1946
|
+
newMaterial.needsUpdate = true;
|
|
1893
1947
|
return newMaterial;
|
|
1894
1948
|
}
|
|
1895
1949
|
else {
|
|
1896
1950
|
var params = {
|
|
1897
1951
|
// side: material.side ? material.side : FrontSide,
|
|
1898
1952
|
name: name,
|
|
1899
|
-
roughness:
|
|
1900
|
-
metalness:
|
|
1901
|
-
envMapIntensity:
|
|
1953
|
+
roughness: material.roughnessValue ? material.roughnessValue : 1,
|
|
1954
|
+
metalness: material.metalnessValue ? material.metalnessValue : 0,
|
|
1955
|
+
envMapIntensity: material.envMapIntensity ? material.envMapIntensity : 0.01
|
|
1902
1956
|
// wireframe: true,
|
|
1903
1957
|
// opacity: 0.3,
|
|
1904
1958
|
// transparent: true,
|
|
1905
1959
|
};
|
|
1906
|
-
if (
|
|
1907
|
-
params.displacementScale =
|
|
1960
|
+
if (material.displacementValue) {
|
|
1961
|
+
params.displacementScale = material.displacementValue;
|
|
1962
|
+
}
|
|
1963
|
+
if (material.opacity) {
|
|
1964
|
+
params.opacity = material.opacity;
|
|
1965
|
+
}
|
|
1966
|
+
if (material.transparency) {
|
|
1967
|
+
params.opacity = material.transparency;
|
|
1908
1968
|
}
|
|
1909
|
-
if (
|
|
1910
|
-
params.opacity =
|
|
1969
|
+
if (material.transmission) {
|
|
1970
|
+
params.opacity = material.transmission;
|
|
1911
1971
|
}
|
|
1912
|
-
if (
|
|
1913
|
-
params.transparent =
|
|
1972
|
+
if (material.transparent) {
|
|
1973
|
+
params.transparent = material.transparent;
|
|
1914
1974
|
}
|
|
1915
|
-
if (
|
|
1916
|
-
params.emissive =
|
|
1975
|
+
if (material.emissiveValue) {
|
|
1976
|
+
params.emissive = material.emissiveValue;
|
|
1917
1977
|
}
|
|
1918
|
-
if (
|
|
1919
|
-
params.emissiveIntensity =
|
|
1978
|
+
if (material.emissiveIntensityValue) {
|
|
1979
|
+
params.emissiveIntensity = material.emissiveIntensityValue;
|
|
1920
1980
|
}
|
|
1921
|
-
if (
|
|
1922
|
-
params.map =
|
|
1981
|
+
if (material.texture) {
|
|
1982
|
+
params.map = material.texture;
|
|
1923
1983
|
params.map.needsUpdate = true;
|
|
1924
1984
|
}
|
|
1925
|
-
if (
|
|
1926
|
-
params.aoMap =
|
|
1985
|
+
if (material.ao) {
|
|
1986
|
+
params.aoMap = material.ao;
|
|
1927
1987
|
params.aoMap.needsUpdate = true;
|
|
1928
1988
|
}
|
|
1929
|
-
if (
|
|
1930
|
-
params.roughnessMap =
|
|
1989
|
+
if (material.roughness) {
|
|
1990
|
+
params.roughnessMap = material.roughness;
|
|
1931
1991
|
params.roughnessMap.needsUpdate = true;
|
|
1932
|
-
//
|
|
1992
|
+
// material.roughness.magFilter = NearestFilter;
|
|
1933
1993
|
}
|
|
1934
|
-
if (
|
|
1935
|
-
params.metalnessMap =
|
|
1994
|
+
if (material.metalness) {
|
|
1995
|
+
params.metalnessMap = material.metalness;
|
|
1936
1996
|
params.metalnessMap.needsUpdate = true;
|
|
1937
1997
|
}
|
|
1938
|
-
if (
|
|
1939
|
-
params.normalMap =
|
|
1998
|
+
if (material.normal) {
|
|
1999
|
+
params.normalMap = material.normal;
|
|
1940
2000
|
params.normalMap.needsUpdate = true;
|
|
1941
2001
|
}
|
|
1942
|
-
if (
|
|
1943
|
-
params.displacementMap =
|
|
2002
|
+
if (material.displacement) {
|
|
2003
|
+
params.displacementMap = material.displacement;
|
|
1944
2004
|
params.displacementMap.needsUpdate = true;
|
|
1945
2005
|
}
|
|
1946
|
-
if (
|
|
1947
|
-
params.emissiveMap =
|
|
2006
|
+
if (material.emissive) {
|
|
2007
|
+
params.emissiveMap = material.emissive;
|
|
1948
2008
|
params.emissiveMap.needsUpdate = true;
|
|
1949
2009
|
}
|
|
1950
|
-
if (
|
|
1951
|
-
if (
|
|
1952
|
-
params.envMap =
|
|
2010
|
+
if (material.envMap) {
|
|
2011
|
+
if (material.envMapIntensity != null || 0) {
|
|
2012
|
+
params.envMap = material.envMap;
|
|
1953
2013
|
params.envMap.needsUpdate = true;
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2014
|
+
material.envMap.mapping = THREE__namespace.EquirectangularReflectionMapping;
|
|
2015
|
+
material.envMap.minFilter = THREE__namespace.NearestFilter;
|
|
2016
|
+
material.envMap.magFilter = THREE__namespace.NearestFilter;
|
|
1957
2017
|
}
|
|
1958
2018
|
}
|
|
1959
|
-
if (
|
|
1960
|
-
params.side =
|
|
2019
|
+
if (material.side) {
|
|
2020
|
+
params.side = material.side;
|
|
1961
2021
|
}
|
|
1962
2022
|
var newMaterial = new THREE__namespace.MeshStandardMaterial(params);
|
|
1963
2023
|
newMaterial.color.setRGB(1, 1, 1);
|