@crystaldesign/real-time-viewer 25.7.0-beta.13 → 25.7.0-beta.15
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/build/esm/index.js
CHANGED
|
@@ -2841,12 +2841,10 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2841
2841
|
var setDataRow,
|
|
2842
2842
|
sceneStore,
|
|
2843
2843
|
url,
|
|
2844
|
+
doReCtrTex,
|
|
2844
2845
|
_mat,
|
|
2845
2846
|
res,
|
|
2846
2847
|
parsedMat,
|
|
2847
|
-
baseTexture,
|
|
2848
|
-
mRTexture,
|
|
2849
|
-
nTexture,
|
|
2850
2848
|
found,
|
|
2851
2849
|
mat,
|
|
2852
2850
|
_args = arguments;
|
|
@@ -2863,27 +2861,34 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2863
2861
|
url.searchParams.append('debug', JSON.stringify(!!sceneStore.apiConfig.useDebugUrl));
|
|
2864
2862
|
if (_customMat.tiling) url.searchParams.append('tiling', JSON.stringify(_customMat.tiling));
|
|
2865
2863
|
_context.prev = 9;
|
|
2866
|
-
|
|
2864
|
+
// need to re construct the textures, due to data loss(tiling, mimetype, etc.) on glbasync export after parse/serialize of a mat
|
|
2865
|
+
// just triggers the right things for that to work, texture itself is cached so no real perf impact
|
|
2866
|
+
doReCtrTex = function doReCtrTex(texture) {
|
|
2867
|
+
if (!texture) return texture;
|
|
2868
|
+
var reCtrTex = new Texture(texture.url, _customMat.scene);
|
|
2869
|
+
reCtrTex.uScale = texture.uScale;
|
|
2870
|
+
reCtrTex.vScale = texture.vScale;
|
|
2871
|
+
reCtrTex._mimeType = texture.url.endsWith('.jpg') ? 'image/jpeg' : 'image/png';
|
|
2872
|
+
return reCtrTex;
|
|
2873
|
+
};
|
|
2874
|
+
_context.next = 13;
|
|
2867
2875
|
return fetch(url.toString(), {
|
|
2868
2876
|
method: 'GET',
|
|
2869
2877
|
headers: {
|
|
2870
2878
|
Authorization: "Bearer ".concat(sceneStore.jwt)
|
|
2871
2879
|
}
|
|
2872
2880
|
});
|
|
2873
|
-
case
|
|
2881
|
+
case 13:
|
|
2874
2882
|
_mat = _context.sent;
|
|
2875
|
-
_context.next =
|
|
2883
|
+
_context.next = 16;
|
|
2876
2884
|
return _mat.json();
|
|
2877
|
-
case
|
|
2885
|
+
case 16:
|
|
2878
2886
|
res = _context.sent;
|
|
2879
2887
|
parsedMat = PBRMetallicRoughnessMaterial.Parse(res, _customMat.scene, '');
|
|
2880
2888
|
parsedMat.name = _customMat.name;
|
|
2881
|
-
baseTexture = parsedMat.baseTexture;
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
if (baseTexture) baseTexture._mimeType = baseTexture.url.endsWith('.jpg') ? 'image/jpeg' : 'image/png';
|
|
2885
|
-
if (mRTexture) mRTexture._mimeType = mRTexture.url.endsWith('.jpg') ? 'image/jpeg' : 'image/png';
|
|
2886
|
-
if (nTexture) nTexture._mimeType = nTexture.url.endsWith('.jpg') ? 'image/jpeg' : 'image/png';
|
|
2889
|
+
parsedMat.baseTexture = doReCtrTex(parsedMat.baseTexture);
|
|
2890
|
+
parsedMat.metallicRoughnessTexture = doReCtrTex(parsedMat.metallicRoughnessTexture);
|
|
2891
|
+
parsedMat.normalTexture = doReCtrTex(parsedMat.normalTexture);
|
|
2887
2892
|
found = !!parsedMat.baseTexture;
|
|
2888
2893
|
if (!found) LOG$1.warn('MISSING_MATERIAL: could not get material ' + _customMat.name + ' for iln ' + _customMat.blob);
|
|
2889
2894
|
if (setDataRow) useUtilStoreContext().setAnalyzeDataRow({
|
|
@@ -2898,8 +2903,8 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2898
2903
|
mat: parsedMat,
|
|
2899
2904
|
found: true
|
|
2900
2905
|
});
|
|
2901
|
-
case
|
|
2902
|
-
_context.prev =
|
|
2906
|
+
case 28:
|
|
2907
|
+
_context.prev = 28;
|
|
2903
2908
|
_context.t0 = _context["catch"](9);
|
|
2904
2909
|
if (setDataRow) useUtilStoreContext().setAnalyzeDataRow({
|
|
2905
2910
|
type: 'MAT',
|
|
@@ -2909,17 +2914,17 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2909
2914
|
path: _customMat.blob,
|
|
2910
2915
|
sizeMb: 0
|
|
2911
2916
|
});
|
|
2912
|
-
case
|
|
2917
|
+
case 31:
|
|
2913
2918
|
mat = new PBRMetallicRoughnessMaterial(_customMat.name, _customMat.scene);
|
|
2914
2919
|
return _context.abrupt("return", {
|
|
2915
2920
|
mat: mat,
|
|
2916
2921
|
found: true
|
|
2917
2922
|
});
|
|
2918
|
-
case
|
|
2923
|
+
case 33:
|
|
2919
2924
|
case "end":
|
|
2920
2925
|
return _context.stop();
|
|
2921
2926
|
}
|
|
2922
|
-
}, _callee, null, [[9,
|
|
2927
|
+
}, _callee, null, [[9, 28]]);
|
|
2923
2928
|
}));
|
|
2924
2929
|
return function customMat(_x) {
|
|
2925
2930
|
return _ref.apply(this, arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/CustomMaterial/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/CustomMaterial/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAC;AAK1G,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AAGD,QAAA,MAAM,SAAS,cAAqB,cAAc,eAAc,OAAO,KAAU,OAAO,CAAC;IAAE,GAAG,EAAE,4BAA4B,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAiD7I,CAAC;AAEF,eAAe,SAAS,CAAC"}
|