@colijnit/configurator 12.0.16 → 12.0.17
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 +178 -120
- package/bundles/colijnit-configurator.umd.js.map +1 -1
- package/esm2015/app/builder.js +25 -22
- package/esm2015/helper/variation-helper.js +41 -22
- package/esm2015/model/material.js +1 -1
- package/esm2015/model/variation-settings.js +4 -2
- package/esm2015/utils/asset.utils.js +16 -10
- package/esm2015/utils/variation-utils.js +18 -8
- package/fesm2015/colijnit-configurator.js +99 -59
- package/fesm2015/colijnit-configurator.js.map +1 -1
- package/model/material.d.ts +4 -1
- package/model/variation-settings.d.ts +12 -1
- package/package.json +1 -1
- package/utils/asset.utils.d.ts +1 -0
|
@@ -777,9 +777,14 @@
|
|
|
777
777
|
return SceneUtils;
|
|
778
778
|
}());
|
|
779
779
|
|
|
780
|
+
var VariationSettingsSettings = /** @class */ (function () {
|
|
781
|
+
function VariationSettingsSettings() {
|
|
782
|
+
}
|
|
783
|
+
return VariationSettingsSettings;
|
|
784
|
+
}());
|
|
780
785
|
var VariationSettings = /** @class */ (function () {
|
|
781
786
|
function VariationSettings() {
|
|
782
|
-
this.settings =
|
|
787
|
+
this.settings = new VariationSettingsSettings();
|
|
783
788
|
this.loading = false;
|
|
784
789
|
this.loaded = new rxjs.Subject();
|
|
785
790
|
}
|
|
@@ -871,9 +876,9 @@
|
|
|
871
876
|
}
|
|
872
877
|
AssetUtils.CreateMaterialFromAsset = function (asset) {
|
|
873
878
|
return __awaiter(this, void 0, void 0, function () {
|
|
874
|
-
var material, _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l,
|
|
875
|
-
return __generator(this, function (
|
|
876
|
-
switch (
|
|
879
|
+
var material, _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
880
|
+
return __generator(this, function (_o) {
|
|
881
|
+
switch (_o.label) {
|
|
877
882
|
case 0:
|
|
878
883
|
material = new Material();
|
|
879
884
|
if (!asset) {
|
|
@@ -886,24 +891,24 @@
|
|
|
886
891
|
_a = material;
|
|
887
892
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_texture', asset.texture, material)];
|
|
888
893
|
case 1:
|
|
889
|
-
_a.texture =
|
|
894
|
+
_a.texture = _o.sent();
|
|
890
895
|
material.texture.encoding = THREE.sRGBEncoding;
|
|
891
896
|
material.textureFilename = asset.textureFilename;
|
|
892
|
-
|
|
897
|
+
_o.label = 2;
|
|
893
898
|
case 2:
|
|
894
899
|
if (!asset.normal) return [3 /*break*/, 4];
|
|
895
900
|
_b = material;
|
|
896
901
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_normal', asset.normal, material)];
|
|
897
902
|
case 3:
|
|
898
|
-
_b.normal =
|
|
903
|
+
_b.normal = _o.sent();
|
|
899
904
|
material.normalFilename = asset.normalFilename;
|
|
900
|
-
|
|
905
|
+
_o.label = 4;
|
|
901
906
|
case 4:
|
|
902
907
|
if (!asset.orm) return [3 /*break*/, 6];
|
|
903
908
|
_c = material;
|
|
904
909
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_orm', asset.orm, material)];
|
|
905
910
|
case 5:
|
|
906
|
-
_c.ao =
|
|
911
|
+
_c.ao = _o.sent();
|
|
907
912
|
material.roughness = material.ao;
|
|
908
913
|
material.metalness = material.ao;
|
|
909
914
|
material.aoFilename = asset.ormFilename;
|
|
@@ -915,74 +920,74 @@
|
|
|
915
920
|
_d = material;
|
|
916
921
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_ao', asset.ao, material)];
|
|
917
922
|
case 7:
|
|
918
|
-
_d.ao =
|
|
923
|
+
_d.ao = _o.sent();
|
|
919
924
|
material.aoFilename = asset.aoFilename;
|
|
920
|
-
|
|
925
|
+
_o.label = 8;
|
|
921
926
|
case 8:
|
|
922
927
|
if (!asset.metalness) return [3 /*break*/, 10];
|
|
923
928
|
_e = material;
|
|
924
929
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_metalness', asset.metalness, material)];
|
|
925
930
|
case 9:
|
|
926
|
-
_e.metalness =
|
|
931
|
+
_e.metalness = _o.sent();
|
|
927
932
|
material.metalnessFilename = asset.metalnessFilename;
|
|
928
|
-
|
|
933
|
+
_o.label = 10;
|
|
929
934
|
case 10:
|
|
930
935
|
if (!asset.roughness) return [3 /*break*/, 12];
|
|
931
936
|
_f = material;
|
|
932
937
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_roughness', asset.roughness, material)];
|
|
933
938
|
case 11:
|
|
934
|
-
_f.roughness =
|
|
939
|
+
_f.roughness = _o.sent();
|
|
935
940
|
material.roughnessFilename = asset.roughnessFilename;
|
|
936
|
-
|
|
941
|
+
_o.label = 12;
|
|
937
942
|
case 12:
|
|
938
943
|
if (!asset.displacement) return [3 /*break*/, 14];
|
|
939
944
|
_g = material;
|
|
940
945
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_displacement', asset.displacement, material)];
|
|
941
946
|
case 13:
|
|
942
|
-
_g.displacement =
|
|
947
|
+
_g.displacement = _o.sent();
|
|
943
948
|
material.displacementFilename = asset.displacementFilename;
|
|
944
|
-
|
|
949
|
+
_o.label = 14;
|
|
945
950
|
case 14:
|
|
946
951
|
if (!asset.envMap) return [3 /*break*/, 16];
|
|
947
952
|
_h = material;
|
|
948
953
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_env', asset.envMap, material, true)];
|
|
949
954
|
case 15:
|
|
950
|
-
_h.envMap =
|
|
955
|
+
_h.envMap = _o.sent();
|
|
951
956
|
material.envMapFilename = asset.envMapFilename;
|
|
952
|
-
|
|
957
|
+
_o.label = 16;
|
|
953
958
|
case 16:
|
|
954
959
|
if (!asset.sheenColorMap) return [3 /*break*/, 18];
|
|
955
960
|
_j = material;
|
|
956
961
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_sheen_color', asset.sheenColorMap, material)];
|
|
957
962
|
case 17:
|
|
958
|
-
_j.sheenColorMap =
|
|
963
|
+
_j.sheenColorMap = _o.sent();
|
|
959
964
|
material.sheenColorMapFileName = asset.sheenColorMapFilename;
|
|
960
|
-
|
|
965
|
+
_o.label = 18;
|
|
961
966
|
case 18:
|
|
962
967
|
if (!asset.sheenRoughnessMap) return [3 /*break*/, 20];
|
|
963
968
|
_k = material;
|
|
964
969
|
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_sheen_roughness', asset.sheenRoughnessMap, material)];
|
|
965
970
|
case 19:
|
|
966
|
-
_k.sheenRoughnessMap =
|
|
971
|
+
_k.sheenRoughnessMap = _o.sent();
|
|
967
972
|
material.sheenRoughnessMapFileName = asset.sheenRoughnessMapFilename;
|
|
968
|
-
|
|
973
|
+
_o.label = 20;
|
|
969
974
|
case 20:
|
|
970
|
-
if (!asset.
|
|
975
|
+
if (!asset.transmissionMap) return [3 /*break*/, 22];
|
|
971
976
|
_l = material;
|
|
972
|
-
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '
|
|
977
|
+
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_transmission', asset.transmissionMap, material)];
|
|
973
978
|
case 21:
|
|
974
|
-
_l.
|
|
975
|
-
material.
|
|
976
|
-
|
|
979
|
+
_l.transmissionMap = _o.sent();
|
|
980
|
+
material.transmissionMapFileName = asset.transmissionMapFilename;
|
|
981
|
+
_o.label = 22;
|
|
977
982
|
case 22:
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
983
|
+
if (!asset.emissive) return [3 /*break*/, 24];
|
|
984
|
+
_m = material;
|
|
985
|
+
return [4 /*yield*/, ImageUtils.CreateTextureFromBase64(asset.id + '_emissive', asset.emissive, material)];
|
|
986
|
+
case 23:
|
|
987
|
+
_m.emissive = _o.sent();
|
|
988
|
+
material.emissiveFileName = asset.emissiveFilename;
|
|
989
|
+
_o.label = 24;
|
|
990
|
+
case 24:
|
|
986
991
|
material.sheen = asset.sheen;
|
|
987
992
|
material.emissiveIntensityValue = asset.emissiveIntensity;
|
|
988
993
|
material.emissiveValue = asset.emissiveValue;
|
|
@@ -994,8 +999,10 @@
|
|
|
994
999
|
material.envMapIntensity = asset.envMapIntensity;
|
|
995
1000
|
material.reflectivity = asset.reflectivity;
|
|
996
1001
|
material.displacementValue = asset.displacementValue;
|
|
997
|
-
material.transparency = asset.transparency;
|
|
998
1002
|
material.transmission = asset.transmission;
|
|
1003
|
+
material.ior = asset.ior;
|
|
1004
|
+
material.thickness = asset.thickness;
|
|
1005
|
+
material.specularIntensity = asset.specularIntensity;
|
|
999
1006
|
return [2 /*return*/, material];
|
|
1000
1007
|
}
|
|
1001
1008
|
});
|
|
@@ -1020,6 +1027,14 @@
|
|
|
1020
1027
|
if (!isNaN(repeaty)) {
|
|
1021
1028
|
material.repeatY = repeaty;
|
|
1022
1029
|
}
|
|
1030
|
+
var metalness = parseFloat(settings['metalness']);
|
|
1031
|
+
if (!isNaN(metalness)) {
|
|
1032
|
+
material.metalnessValue = Math.min(1, metalness);
|
|
1033
|
+
}
|
|
1034
|
+
var roughness = parseFloat(settings['roughness']);
|
|
1035
|
+
if (!isNaN(roughness)) {
|
|
1036
|
+
material.roughnessValue = Math.min(1, roughness);
|
|
1037
|
+
}
|
|
1023
1038
|
};
|
|
1024
1039
|
return AssetUtils;
|
|
1025
1040
|
}());
|
|
@@ -1168,31 +1183,31 @@
|
|
|
1168
1183
|
};
|
|
1169
1184
|
VariationUtils.CreateSettingsBasedOnIndex = function (index, variationSettings, zipContent) {
|
|
1170
1185
|
return __awaiter(this, void 0, void 0, function () {
|
|
1171
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1172
|
-
return __generator(this, function (
|
|
1173
|
-
switch (
|
|
1186
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1187
|
+
return __generator(this, function (_o) {
|
|
1188
|
+
switch (_o.label) {
|
|
1174
1189
|
case 0:
|
|
1175
1190
|
if (!index.normalFile) return [3 /*break*/, 2];
|
|
1176
1191
|
_a = variationSettings;
|
|
1177
1192
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.normalFile], index.normalFile)];
|
|
1178
1193
|
case 1:
|
|
1179
|
-
_a.normal =
|
|
1194
|
+
_a.normal = _o.sent();
|
|
1180
1195
|
variationSettings.normalFilename = index.normalFile;
|
|
1181
|
-
|
|
1196
|
+
_o.label = 2;
|
|
1182
1197
|
case 2:
|
|
1183
1198
|
if (!index.diffuseFile) return [3 /*break*/, 4];
|
|
1184
1199
|
_b = variationSettings;
|
|
1185
1200
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.diffuseFile], index.diffuseFile)];
|
|
1186
1201
|
case 3:
|
|
1187
|
-
_b.texture =
|
|
1202
|
+
_b.texture = _o.sent();
|
|
1188
1203
|
variationSettings.textureFilename = index.diffuseFile;
|
|
1189
|
-
|
|
1204
|
+
_o.label = 4;
|
|
1190
1205
|
case 4:
|
|
1191
1206
|
if (!index.ormFile) return [3 /*break*/, 6];
|
|
1192
1207
|
_c = variationSettings;
|
|
1193
1208
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.ormFile], index.ormFile)];
|
|
1194
1209
|
case 5:
|
|
1195
|
-
_c.orm =
|
|
1210
|
+
_c.orm = _o.sent();
|
|
1196
1211
|
variationSettings.ormFilename = index.ormFile;
|
|
1197
1212
|
return [3 /*break*/, 12];
|
|
1198
1213
|
case 6:
|
|
@@ -1200,74 +1215,80 @@
|
|
|
1200
1215
|
_d = variationSettings;
|
|
1201
1216
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.aoFile], index.aoFile)];
|
|
1202
1217
|
case 7:
|
|
1203
|
-
_d.ao =
|
|
1218
|
+
_d.ao = _o.sent();
|
|
1204
1219
|
variationSettings.aoFilename = index.aoFile;
|
|
1205
|
-
|
|
1220
|
+
_o.label = 8;
|
|
1206
1221
|
case 8:
|
|
1207
1222
|
if (!index.metalnessFile) return [3 /*break*/, 10];
|
|
1208
1223
|
_e = variationSettings;
|
|
1209
1224
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.metalnessFile], index.metalnessFile)];
|
|
1210
1225
|
case 9:
|
|
1211
|
-
_e.metalness =
|
|
1226
|
+
_e.metalness = _o.sent();
|
|
1212
1227
|
variationSettings.metalnessFilename = index.metalnessFile;
|
|
1213
|
-
|
|
1228
|
+
_o.label = 10;
|
|
1214
1229
|
case 10:
|
|
1215
1230
|
if (!index.roughnessFile) return [3 /*break*/, 12];
|
|
1216
1231
|
_f = variationSettings;
|
|
1217
1232
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.roughnessFile], index.roughnessFile)];
|
|
1218
1233
|
case 11:
|
|
1219
|
-
_f.roughness =
|
|
1234
|
+
_f.roughness = _o.sent();
|
|
1220
1235
|
variationSettings.roughnessFilename = index.roughnessFile;
|
|
1221
|
-
|
|
1236
|
+
_o.label = 12;
|
|
1222
1237
|
case 12:
|
|
1223
1238
|
if (!index.displacementFile) return [3 /*break*/, 14];
|
|
1224
1239
|
_g = variationSettings;
|
|
1225
1240
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.displacementFile], index.displacementFile)];
|
|
1226
1241
|
case 13:
|
|
1227
|
-
_g.displacement =
|
|
1242
|
+
_g.displacement = _o.sent();
|
|
1228
1243
|
variationSettings.displacementFilename = index.displacementFile;
|
|
1229
|
-
|
|
1244
|
+
_o.label = 14;
|
|
1230
1245
|
case 14:
|
|
1231
1246
|
if (!index.emissiveFile) return [3 /*break*/, 16];
|
|
1232
1247
|
_h = variationSettings;
|
|
1233
1248
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.emissiveFile], index.emissiveFile)];
|
|
1234
1249
|
case 15:
|
|
1235
|
-
_h.emissive =
|
|
1250
|
+
_h.emissive = _o.sent();
|
|
1236
1251
|
variationSettings.emissiveFilename = index.emissiveFile;
|
|
1237
|
-
|
|
1252
|
+
_o.label = 16;
|
|
1238
1253
|
case 16:
|
|
1239
1254
|
if (!index.envMapFile) return [3 /*break*/, 18];
|
|
1240
1255
|
_j = variationSettings;
|
|
1241
1256
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.envMapFile], index.envMapFile)];
|
|
1242
1257
|
case 17:
|
|
1243
|
-
_j.envMap =
|
|
1258
|
+
_j.envMap = _o.sent();
|
|
1244
1259
|
variationSettings.envMapFilename = index.envMapFile;
|
|
1245
|
-
|
|
1260
|
+
_o.label = 18;
|
|
1246
1261
|
case 18:
|
|
1247
1262
|
if (!index.sheenColorMapFile) return [3 /*break*/, 20];
|
|
1248
1263
|
_k = variationSettings;
|
|
1249
1264
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.sheenColorMapFile], index.sheenColorMapFile)];
|
|
1250
1265
|
case 19:
|
|
1251
|
-
_k.sheenColorMap =
|
|
1266
|
+
_k.sheenColorMap = _o.sent();
|
|
1252
1267
|
variationSettings.sheenColorMapFilename = index.sheenColorMapFile;
|
|
1253
|
-
|
|
1268
|
+
_o.label = 20;
|
|
1254
1269
|
case 20:
|
|
1255
1270
|
if (!index.sheenRoughnessMapFile) return [3 /*break*/, 22];
|
|
1256
1271
|
_l = variationSettings;
|
|
1257
1272
|
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.sheenRoughnessMapFile], index.sheenRoughnessMapFile)];
|
|
1258
1273
|
case 21:
|
|
1259
|
-
_l.sheenRoughnessMap =
|
|
1274
|
+
_l.sheenRoughnessMap = _o.sent();
|
|
1260
1275
|
variationSettings.sheenRoughnessMapFilename = index.sheenColorMapFile;
|
|
1261
|
-
|
|
1276
|
+
_o.label = 22;
|
|
1262
1277
|
case 22:
|
|
1278
|
+
if (!index.transmissionMapFile) return [3 /*break*/, 24];
|
|
1279
|
+
_m = variationSettings;
|
|
1280
|
+
return [4 /*yield*/, VariationUtils.LoadFileContentFromZip(zipContent.files[index.transmissionMapFile], index.transmissionMapFile)];
|
|
1281
|
+
case 23:
|
|
1282
|
+
_m.transmissionMap = _o.sent();
|
|
1283
|
+
variationSettings.transmissionMapFilename = index.transmissionMapFile;
|
|
1284
|
+
_o.label = 24;
|
|
1285
|
+
case 24:
|
|
1263
1286
|
if (index.repeat) {
|
|
1264
|
-
variationSettings.settings =
|
|
1265
|
-
|
|
1266
|
-
repeaty: index.repeat.repeaty
|
|
1267
|
-
};
|
|
1287
|
+
variationSettings.settings.repeatx = index.repeat.repeatx;
|
|
1288
|
+
variationSettings.settings.repeaty = index.repeat.repeaty;
|
|
1268
1289
|
}
|
|
1269
|
-
variationSettings.metalness = index.metalness;
|
|
1270
|
-
variationSettings.roughness = index.roughness;
|
|
1290
|
+
variationSettings.settings.metalness = index.metalness;
|
|
1291
|
+
variationSettings.settings.roughness = index.roughness;
|
|
1271
1292
|
if (index.sheen && typeof index.sheen === 'object') {
|
|
1272
1293
|
variationSettings.sheen = 1;
|
|
1273
1294
|
variationSettings.sheenColor = new THREE__namespace.Color(index.sheen.r, index.sheen.g, index.sheen.b);
|
|
@@ -1289,8 +1310,10 @@
|
|
|
1289
1310
|
variationSettings.reflectivity = index.reflectivity;
|
|
1290
1311
|
variationSettings.displacementValue = index.displacementValue;
|
|
1291
1312
|
variationSettings.side = index.side;
|
|
1292
|
-
variationSettings.transparency = index.transparency;
|
|
1293
1313
|
variationSettings.transmission = index.transmission;
|
|
1314
|
+
variationSettings.ior = index.ior;
|
|
1315
|
+
variationSettings.thickness = index.thickness;
|
|
1316
|
+
variationSettings.specularIntensity = index.specularIntensity;
|
|
1294
1317
|
return [2 /*return*/];
|
|
1295
1318
|
}
|
|
1296
1319
|
});
|
|
@@ -1373,6 +1396,12 @@
|
|
|
1373
1396
|
variationSettings.sheenRoughnessMapFilename = fileName;
|
|
1374
1397
|
}));
|
|
1375
1398
|
}
|
|
1399
|
+
else if (file_1.name.toLowerCase().indexOf('transmissionMap') > -1 && this_1.FileIsImage(file_1.name)) {
|
|
1400
|
+
allLoaded.push(zipContent.files[fileName].async('base64').then(function (transmissionMapFile) {
|
|
1401
|
+
variationSettings.transmissionMap = "data:image/" + _this.GetBase64FileType(file_1.name) + ";base64," + transmissionMapFile;
|
|
1402
|
+
variationSettings.transmissionMapFilename = fileName;
|
|
1403
|
+
}));
|
|
1404
|
+
}
|
|
1376
1405
|
else if (file_1.name.indexOf('.jp') > -1) {
|
|
1377
1406
|
allLoaded.push(zipContent.files[fileName].async('base64').then(function (textureFile) {
|
|
1378
1407
|
variationSettings.texture = 'data:image/jpeg;base64,' + textureFile;
|
|
@@ -1808,9 +1837,15 @@
|
|
|
1808
1837
|
if (mesh.material[m].name.toLowerCase().indexOf(materialToSearch) !== -1) {
|
|
1809
1838
|
if (variation.material instanceof THREE__namespace.Material) {
|
|
1810
1839
|
mesh.material[m] = variation.material;
|
|
1840
|
+
if (mesh.material[m].name && (mesh.material[m].name === 'Fixed_Glass' || mesh.material[m].name === 'Default_Glass')) {
|
|
1841
|
+
mesh.castShadow = false;
|
|
1842
|
+
}
|
|
1811
1843
|
}
|
|
1812
1844
|
else {
|
|
1813
1845
|
mesh.material[m] = _this._setMeshMaterialFromVariation(mesh.material[m].name, variation, usePbr);
|
|
1846
|
+
if (mesh.material[m].name && (mesh.material[m].name === 'Fixed_Glass' || mesh.material[m].name === 'Default_Glass')) {
|
|
1847
|
+
mesh.castShadow = false;
|
|
1848
|
+
}
|
|
1814
1849
|
}
|
|
1815
1850
|
}
|
|
1816
1851
|
}
|
|
@@ -1819,9 +1854,15 @@
|
|
|
1819
1854
|
if (mesh.material.name.toLowerCase().indexOf(materialToSearch) !== -1) {
|
|
1820
1855
|
if (variation.material instanceof THREE__namespace.Material) {
|
|
1821
1856
|
mesh.material = variation.material;
|
|
1857
|
+
if (mesh.material.name && (mesh.material.name === 'Fixed_Glass' || mesh.material.name === 'Default_Glass')) {
|
|
1858
|
+
mesh.castShadow = false;
|
|
1859
|
+
}
|
|
1822
1860
|
}
|
|
1823
1861
|
else {
|
|
1824
1862
|
mesh.material = _this._setMeshMaterialFromVariation(mesh.material.name, variation, usePbr);
|
|
1863
|
+
if (mesh.material.name && (mesh.material.name === 'Fixed_Glass' || mesh.material.name === 'Default_Glass')) {
|
|
1864
|
+
mesh.castShadow = false;
|
|
1865
|
+
}
|
|
1825
1866
|
}
|
|
1826
1867
|
}
|
|
1827
1868
|
}
|
|
@@ -1841,22 +1882,21 @@
|
|
|
1841
1882
|
}
|
|
1842
1883
|
if (!usePbr) {
|
|
1843
1884
|
var newMaterial = new THREE__namespace.MeshPhongMaterial({
|
|
1844
|
-
name: name,
|
|
1845
1885
|
shininess: material.shininess,
|
|
1846
1886
|
specular: material.specular,
|
|
1847
1887
|
map: material.texture,
|
|
1848
1888
|
normalMap: material.normal
|
|
1849
1889
|
});
|
|
1890
|
+
newMaterial.name = name;
|
|
1850
1891
|
newMaterial.color.setRGB(0.8, 0.8, 0.8);
|
|
1851
1892
|
newMaterial.needsUpdate = true;
|
|
1852
1893
|
return newMaterial;
|
|
1853
1894
|
}
|
|
1854
|
-
if (material.sheen || material.sheenColor || material.reflectivity) { // TODO: Proper check for all unique physical material properties
|
|
1895
|
+
if (material.sheen || material.sheenColor || material.reflectivity || material.transmission) { // TODO: Proper check for all unique physical material properties
|
|
1855
1896
|
var params = {
|
|
1856
1897
|
// side: material.side ? material.side : FrontSide,
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
metalness: material.metalnessValue ? material.metalnessValue : 0,
|
|
1898
|
+
roughness: material.roughnessValue !== undefined && material.roughnessValue !== null ? material.roughnessValue : 1,
|
|
1899
|
+
metalness: material.metalnessValue !== undefined && material.metalnessValue !== null ? material.metalnessValue : 0,
|
|
1860
1900
|
envMapIntensity: material.envMapIntensity ? material.envMapIntensity : 0.01,
|
|
1861
1901
|
clearcoatMap: material.clearcoatMap ? material.clearcoatMap : null,
|
|
1862
1902
|
clearcoatRoughnessMap: material.clearcoatRoughnessMap ? material.clearcoatRoughnessMap : null,
|
|
@@ -1870,12 +1910,6 @@
|
|
|
1870
1910
|
if (material.opacity) {
|
|
1871
1911
|
params.opacity = material.opacity;
|
|
1872
1912
|
}
|
|
1873
|
-
if (material.transparency) {
|
|
1874
|
-
params.transmission = material.transparency;
|
|
1875
|
-
}
|
|
1876
|
-
if (material.transmission) {
|
|
1877
|
-
params.transmission = material.transmission;
|
|
1878
|
-
}
|
|
1879
1913
|
if (material.transparent) {
|
|
1880
1914
|
params.transparent = material.transparent;
|
|
1881
1915
|
}
|
|
@@ -1923,13 +1957,14 @@
|
|
|
1923
1957
|
material.envMap.magFilter = THREE__namespace.NearestFilter;
|
|
1924
1958
|
}
|
|
1925
1959
|
}
|
|
1926
|
-
if (material.reflectivity) {
|
|
1960
|
+
if (material.reflectivity !== undefined && material.reflectivity !== null) {
|
|
1927
1961
|
params.reflectivity = material.reflectivity;
|
|
1928
1962
|
}
|
|
1929
1963
|
if (material.side) {
|
|
1930
1964
|
params.side = material.side;
|
|
1931
1965
|
}
|
|
1932
1966
|
var newMaterial = new THREE__namespace.MeshPhysicalMaterial(params);
|
|
1967
|
+
newMaterial.name = name;
|
|
1933
1968
|
newMaterial.color.setRGB(1, 1, 1);
|
|
1934
1969
|
if (material.sheen) {
|
|
1935
1970
|
newMaterial.sheen = material.sheen;
|
|
@@ -1951,15 +1986,30 @@
|
|
|
1951
1986
|
if (material.transmission) {
|
|
1952
1987
|
newMaterial.transmission = material.transmission;
|
|
1953
1988
|
}
|
|
1989
|
+
if (material.ior !== undefined && material.ior !== null) {
|
|
1990
|
+
newMaterial.ior = material.ior;
|
|
1991
|
+
}
|
|
1992
|
+
if (material.thickness !== undefined && material.thickness !== null) {
|
|
1993
|
+
newMaterial.thickness = material.thickness;
|
|
1994
|
+
}
|
|
1995
|
+
if (material.specularIntensity !== undefined && material.specularIntensity !== null) {
|
|
1996
|
+
newMaterial.specularIntensity = material.specularIntensity;
|
|
1997
|
+
}
|
|
1998
|
+
if (material.transmissionMap) {
|
|
1999
|
+
newMaterial.transmissionMap = material.transmissionMap;
|
|
2000
|
+
newMaterial.transmissionMap.needsUpdate = true;
|
|
2001
|
+
}
|
|
2002
|
+
if (newMaterial.name && (newMaterial.name === 'Fixed_Glass' || newMaterial.name === 'Default_Glass')) {
|
|
2003
|
+
newMaterial.format = THREE__namespace.RGBAFormat;
|
|
2004
|
+
}
|
|
1954
2005
|
newMaterial.needsUpdate = true;
|
|
1955
2006
|
return newMaterial;
|
|
1956
2007
|
}
|
|
1957
2008
|
else {
|
|
1958
2009
|
var params = {
|
|
1959
2010
|
// side: material.side ? material.side : FrontSide,
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
metalness: material.metalnessValue ? material.metalnessValue : 0,
|
|
2011
|
+
roughness: material.roughnessValue !== undefined && material.roughnessValue !== null ? material.roughnessValue : 1,
|
|
2012
|
+
metalness: material.metalnessValue !== undefined && material.metalnessValue !== null ? material.metalnessValue : 0,
|
|
1963
2013
|
envMapIntensity: material.envMapIntensity ? material.envMapIntensity : 0.01
|
|
1964
2014
|
// wireframe: true,
|
|
1965
2015
|
// opacity: 0.3,
|
|
@@ -1971,12 +2021,6 @@
|
|
|
1971
2021
|
if (material.opacity) {
|
|
1972
2022
|
params.opacity = material.opacity;
|
|
1973
2023
|
}
|
|
1974
|
-
if (material.transparency) {
|
|
1975
|
-
params.opacity = material.transparency;
|
|
1976
|
-
}
|
|
1977
|
-
if (material.transmission) {
|
|
1978
|
-
params.opacity = material.transmission;
|
|
1979
|
-
}
|
|
1980
2024
|
if (material.transparent) {
|
|
1981
2025
|
params.transparent = material.transparent;
|
|
1982
2026
|
}
|
|
@@ -2028,7 +2072,11 @@
|
|
|
2028
2072
|
params.side = material.side;
|
|
2029
2073
|
}
|
|
2030
2074
|
var newMaterial = new THREE__namespace.MeshStandardMaterial(params);
|
|
2075
|
+
newMaterial.name = name;
|
|
2031
2076
|
newMaterial.color.setRGB(1, 1, 1);
|
|
2077
|
+
if (newMaterial.name && (newMaterial.name === 'Fixed_Glass' || newMaterial.name === 'Default_Glass')) {
|
|
2078
|
+
newMaterial.format = THREE__namespace.RGBAFormat;
|
|
2079
|
+
}
|
|
2032
2080
|
newMaterial.needsUpdate = true;
|
|
2033
2081
|
return newMaterial;
|
|
2034
2082
|
}
|
|
@@ -2317,38 +2365,47 @@
|
|
|
2317
2365
|
};
|
|
2318
2366
|
Builder.prototype.buildModelFromData = function (selections, decos, assetUrl, cdnUrl, schema) {
|
|
2319
2367
|
return __awaiter(this, void 0, void 0, function () {
|
|
2320
|
-
var
|
|
2368
|
+
var _this = this;
|
|
2321
2369
|
return __generator(this, function (_a) {
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2370
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
2371
|
+
var build, e_2;
|
|
2372
|
+
return __generator(this, function (_a) {
|
|
2373
|
+
switch (_a.label) {
|
|
2374
|
+
case 0:
|
|
2375
|
+
if (!this._scene) {
|
|
2376
|
+
reject('no scene provided!');
|
|
2377
|
+
}
|
|
2378
|
+
_a.label = 1;
|
|
2379
|
+
case 1:
|
|
2380
|
+
_a.trys.push([1, 6, , 7]);
|
|
2381
|
+
this._log('start build');
|
|
2382
|
+
return [4 /*yield*/, this._downloadAsset(assetUrl, cdnUrl, schema)];
|
|
2383
|
+
case 2:
|
|
2384
|
+
_a.sent();
|
|
2385
|
+
if (!(selections && selections.length > 1 && decos && decos.length > 0 && this._source)) return [3 /*break*/, 4];
|
|
2386
|
+
this._selections = selections;
|
|
2387
|
+
this._decos = decos;
|
|
2388
|
+
this._linkSelectionsAndDecos();
|
|
2389
|
+
this._preloadMaterials();
|
|
2390
|
+
return [4 /*yield*/, this._build()];
|
|
2391
|
+
case 3:
|
|
2392
|
+
build = _a.sent();
|
|
2393
|
+
this._cleanUp();
|
|
2394
|
+
this._log('finish build');
|
|
2395
|
+
resolve(build);
|
|
2396
|
+
return [3 /*break*/, 5];
|
|
2397
|
+
case 4:
|
|
2398
|
+
reject('Unsufficient data provided!');
|
|
2399
|
+
_a.label = 5;
|
|
2400
|
+
case 5: return [3 /*break*/, 7];
|
|
2401
|
+
case 6:
|
|
2402
|
+
e_2 = _a.sent();
|
|
2403
|
+
reject(e_2);
|
|
2404
|
+
return [3 /*break*/, 7];
|
|
2405
|
+
case 7: return [2 /*return*/];
|
|
2406
|
+
}
|
|
2407
|
+
});
|
|
2408
|
+
}); })];
|
|
2352
2409
|
});
|
|
2353
2410
|
});
|
|
2354
2411
|
};
|
|
@@ -2629,6 +2686,7 @@
|
|
|
2629
2686
|
var selectionOfArticle = selections.find(function (s) { return s.nodeType === nodeType_enum.NodeType.Article; });
|
|
2630
2687
|
var adjustableSelections = selections.filter(function (s) { return s.addAdjust === '2'; });
|
|
2631
2688
|
var isArticleWithMaterial = adjustableSelections.length === 0 &&
|
|
2689
|
+
selectionOfArticle &&
|
|
2632
2690
|
selectionOfArticle.gameObject &&
|
|
2633
2691
|
selectionOfArticle.gameObject.length > 0;
|
|
2634
2692
|
for (var i = 0; i < len; i++) {
|