@babylonjs/core 8.45.4 → 8.45.5
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/AudioV2/webAudio/components/webAudioParameterComponent.js +5 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.loadFile.d.ts +11 -0
- package/Engines/AbstractEngine/abstractEngine.loadFile.js +12 -0
- package/Engines/AbstractEngine/abstractEngine.loadFile.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.d.ts +1 -0
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.js +4 -0
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.js.map +1 -0
- package/Engines/AbstractEngine/index.d.ts +2 -0
- package/Engines/AbstractEngine/index.js +2 -0
- package/Engines/AbstractEngine/index.js.map +1 -1
- package/Engines/Native/Extensions/index.d.ts +1 -0
- package/Engines/Native/Extensions/index.js +2 -0
- package/Engines/Native/Extensions/index.js.map +1 -0
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.d.ts +27 -0
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.js +96 -0
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.js.map +1 -0
- package/Engines/Native/nativePipelineContext.d.ts +2 -2
- package/Engines/Native/nativePipelineContext.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +3 -3
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Native/validatedNativeDataStream.js +2 -2
- package/Engines/Native/validatedNativeDataStream.js.map +1 -1
- package/Engines/abstractEngine.d.ts +9 -0
- package/Engines/abstractEngine.js +13 -4
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +2 -6
- package/Engines/engine.js +2 -13
- package/Engines/engine.js.map +1 -1
- package/Engines/index.d.ts +1 -0
- package/Engines/index.js +1 -0
- package/Engines/index.js.map +1 -1
- package/Engines/nativeEngine.d.ts +19 -536
- package/Engines/nativeEngine.js +27 -2127
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -0
- package/Engines/nullEngine.js +2 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinNativeEngine.d.ts +537 -0
- package/Engines/thinNativeEngine.js +2033 -0
- package/Engines/thinNativeEngine.js.map +1 -0
- package/Engines/webgpuEngine.d.ts +2 -0
- package/Engines/webgpuEngine.js +2 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Misc/tools.d.ts +3 -1
- package/Misc/tools.js +76 -59
- package/Misc/tools.js.map +1 -1
- package/Particles/Node/Blocks/index.d.ts +2 -0
- package/Particles/Node/Blocks/index.js +2 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleClampBlock.d.ts +42 -0
- package/Particles/Node/Blocks/particleClampBlock.js +114 -0
- package/Particles/Node/Blocks/particleClampBlock.js.map +1 -0
- package/XR/native/nativeXRFrame.js +1 -1
- package/XR/native/nativeXRFrame.js.map +1 -1
- package/package.json +1 -1
package/Misc/tools.d.ts
CHANGED
|
@@ -276,6 +276,8 @@ export declare class Tools {
|
|
|
276
276
|
* @returns a promise request object
|
|
277
277
|
*/
|
|
278
278
|
static LoadBabylonScriptAsync(scriptUrl: string): Promise<void>;
|
|
279
|
+
private static _LoadScriptNative;
|
|
280
|
+
private static _LoadScriptWeb;
|
|
279
281
|
/**
|
|
280
282
|
* This function is used internally by babylon components to load a script (identified by an url). When the url returns, the
|
|
281
283
|
* content of this file is added into a new script element, attached to the DOM (body element)
|
|
@@ -285,7 +287,7 @@ export declare class Tools {
|
|
|
285
287
|
* @param scriptId defines the id of the script element
|
|
286
288
|
* @param useModule defines if we should use the module strategy to load the script
|
|
287
289
|
*/
|
|
288
|
-
static LoadScript(scriptUrl: string, onSuccess?: () => void, onError?: (message?: string, exception?: any) => void, scriptId?: string, useModule?: boolean)
|
|
290
|
+
static LoadScript: (scriptUrl: string, onSuccess?: () => void, onError?: (message?: string, exception?: any) => void, scriptId?: string, useModule?: boolean) => void;
|
|
289
291
|
/**
|
|
290
292
|
* Load an asynchronous script (identified by an url). When the url returns, the
|
|
291
293
|
* content of this file is added into a new script element, attached to the DOM (body element)
|
package/Misc/tools.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { Observable } from "./observable.js";
|
|
2
3
|
import { GetDOMTextContent, IsNavigatorAvailable, IsWindowObjectExist } from "./domManagement.js";
|
|
3
4
|
import { Logger } from "./logger.js";
|
|
@@ -86,8 +87,8 @@ export class Tools {
|
|
|
86
87
|
*/
|
|
87
88
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
88
89
|
static set CDNBaseUrl(value) {
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
_a.ScriptBaseUrl = value;
|
|
91
|
+
_a.AssetBaseUrl = value;
|
|
91
92
|
}
|
|
92
93
|
/**
|
|
93
94
|
* Sets a preprocessing function to run on a source URL before importing it
|
|
@@ -369,10 +370,10 @@ export class Tools {
|
|
|
369
370
|
if (!url) {
|
|
370
371
|
return "";
|
|
371
372
|
}
|
|
372
|
-
if (
|
|
373
|
+
if (_a.AssetBaseUrl && url.startsWith(_a._DefaultAssetsUrl)) {
|
|
373
374
|
// normalize the baseUrl
|
|
374
|
-
const baseUrl =
|
|
375
|
-
return url.replace(
|
|
375
|
+
const baseUrl = _a.AssetBaseUrl[_a.AssetBaseUrl.length - 1] === "/" ? _a.AssetBaseUrl.substring(0, _a.AssetBaseUrl.length - 1) : _a.AssetBaseUrl;
|
|
376
|
+
return url.replace(_a._DefaultAssetsUrl, baseUrl);
|
|
376
377
|
}
|
|
377
378
|
return url;
|
|
378
379
|
}
|
|
@@ -387,16 +388,16 @@ export class Tools {
|
|
|
387
388
|
return "";
|
|
388
389
|
}
|
|
389
390
|
// if the base URL was set, and the script Url is an absolute path change the default path
|
|
390
|
-
if (
|
|
391
|
+
if (_a.ScriptBaseUrl && scriptUrl.startsWith(_a._DefaultCdnUrl)) {
|
|
391
392
|
// change the default host, which is https://cdn.babylonjs.com with the one defined
|
|
392
393
|
// make sure no trailing slash is present
|
|
393
|
-
const baseUrl =
|
|
394
|
-
scriptUrl = scriptUrl.replace(
|
|
394
|
+
const baseUrl = _a.ScriptBaseUrl[_a.ScriptBaseUrl.length - 1] === "/" ? _a.ScriptBaseUrl.substring(0, _a.ScriptBaseUrl.length - 1) : _a.ScriptBaseUrl;
|
|
395
|
+
scriptUrl = scriptUrl.replace(_a._DefaultCdnUrl, baseUrl);
|
|
395
396
|
}
|
|
396
397
|
// run the preprocessor
|
|
397
|
-
scriptUrl =
|
|
398
|
-
if (forceAbsoluteUrl && !
|
|
399
|
-
scriptUrl =
|
|
398
|
+
scriptUrl = _a.ScriptPreprocessUrl(scriptUrl);
|
|
399
|
+
if (forceAbsoluteUrl && !_a.IsAbsoluteUrl(scriptUrl)) {
|
|
400
|
+
scriptUrl = _a.GetAbsoluteUrl(scriptUrl);
|
|
400
401
|
}
|
|
401
402
|
return scriptUrl;
|
|
402
403
|
}
|
|
@@ -409,8 +410,8 @@ export class Tools {
|
|
|
409
410
|
* @param scriptId defines the id of the script element
|
|
410
411
|
*/
|
|
411
412
|
static LoadBabylonScript(scriptUrl, onSuccess, onError, scriptId) {
|
|
412
|
-
scriptUrl =
|
|
413
|
-
|
|
413
|
+
scriptUrl = _a.GetBabylonScriptURL(scriptUrl);
|
|
414
|
+
_a.LoadScript(scriptUrl, onSuccess, onError);
|
|
414
415
|
}
|
|
415
416
|
/**
|
|
416
417
|
* Load an asynchronous script (identified by an url). When the url returns, the
|
|
@@ -419,19 +420,24 @@ export class Tools {
|
|
|
419
420
|
* @returns a promise request object
|
|
420
421
|
*/
|
|
421
422
|
static async LoadBabylonScriptAsync(scriptUrl) {
|
|
422
|
-
scriptUrl =
|
|
423
|
-
return await
|
|
423
|
+
scriptUrl = _a.GetBabylonScriptURL(scriptUrl);
|
|
424
|
+
return await _a.LoadScriptAsync(scriptUrl);
|
|
424
425
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
426
|
+
static _LoadScriptNative(scriptUrl, onSuccess, onError) {
|
|
427
|
+
if (_native) {
|
|
428
|
+
_a.LoadFile(scriptUrl, (data) => {
|
|
429
|
+
Function(data).apply(null);
|
|
430
|
+
if (onSuccess) {
|
|
431
|
+
onSuccess();
|
|
432
|
+
}
|
|
433
|
+
}, undefined, undefined, false, (_request, exception) => {
|
|
434
|
+
if (onError) {
|
|
435
|
+
onError("LoadScript Error", exception);
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
static _LoadScriptWeb(scriptUrl, onSuccess, onError, scriptId, useModule = false) {
|
|
435
441
|
if (typeof importScripts === "function") {
|
|
436
442
|
try {
|
|
437
443
|
importScripts(scriptUrl);
|
|
@@ -668,7 +674,7 @@ export class Tools {
|
|
|
668
674
|
*/
|
|
669
675
|
static ToBlob(canvas, successCallback, mimeType = "image/png", quality) {
|
|
670
676
|
// We need HTMLCanvasElement.toBlob for HD screenshots
|
|
671
|
-
if (!
|
|
677
|
+
if (!_a._IsOffScreenCanvas(canvas) && !canvas.toBlob) {
|
|
672
678
|
// low performance polyfill based on toDataURL (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)
|
|
673
679
|
canvas.toBlob = function (callback, type, quality) {
|
|
674
680
|
setTimeout(() => {
|
|
@@ -680,7 +686,7 @@ export class Tools {
|
|
|
680
686
|
});
|
|
681
687
|
};
|
|
682
688
|
}
|
|
683
|
-
if (
|
|
689
|
+
if (_a._IsOffScreenCanvas(canvas)) {
|
|
684
690
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
685
691
|
canvas
|
|
686
692
|
.convertToBlob({
|
|
@@ -709,7 +715,7 @@ export class Tools {
|
|
|
709
715
|
const stringDate = (date.getFullYear() + "-" + (date.getMonth() + 1)).slice(2) + "-" + date.getDate() + "_" + date.getHours() + "-" + ("0" + date.getMinutes()).slice(-2);
|
|
710
716
|
fileName = "screenshot_" + stringDate + ".png";
|
|
711
717
|
}
|
|
712
|
-
|
|
718
|
+
_a.Download(blob, fileName);
|
|
713
719
|
}
|
|
714
720
|
else {
|
|
715
721
|
if (blob && typeof URL !== "undefined") {
|
|
@@ -740,7 +746,7 @@ export class Tools {
|
|
|
740
746
|
if (typeof fileName === "string" || !successCallback) {
|
|
741
747
|
this.ToBlob(canvas, function (blob) {
|
|
742
748
|
if (blob) {
|
|
743
|
-
|
|
749
|
+
_a.DownloadBlob(blob, fileName);
|
|
744
750
|
}
|
|
745
751
|
if (successCallback) {
|
|
746
752
|
successCallback("");
|
|
@@ -748,7 +754,7 @@ export class Tools {
|
|
|
748
754
|
}, mimeType, quality);
|
|
749
755
|
}
|
|
750
756
|
else if (successCallback) {
|
|
751
|
-
if (
|
|
757
|
+
if (_a._IsOffScreenCanvas(canvas)) {
|
|
752
758
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
753
759
|
canvas
|
|
754
760
|
.convertToBlob({
|
|
@@ -987,32 +993,32 @@ export class Tools {
|
|
|
987
993
|
* Sets the current performance log level
|
|
988
994
|
*/
|
|
989
995
|
static set PerformanceLogLevel(level) {
|
|
990
|
-
if ((level &
|
|
996
|
+
if ((level & _a.PerformanceUserMarkLogLevel) === _a.PerformanceUserMarkLogLevel) {
|
|
991
997
|
if (_native?.enablePerformanceLogging) {
|
|
992
998
|
_native.enablePerformanceLogging(1 /* NativeTraceLevel.Mark */);
|
|
993
|
-
|
|
994
|
-
|
|
999
|
+
_a.StartPerformanceCounter = _a._StartMarkNative;
|
|
1000
|
+
_a.EndPerformanceCounter = _a._EndMarkNative;
|
|
995
1001
|
}
|
|
996
1002
|
else {
|
|
997
|
-
|
|
998
|
-
|
|
1003
|
+
_a.StartPerformanceCounter = _a._StartUserMark;
|
|
1004
|
+
_a.EndPerformanceCounter = _a._EndUserMark;
|
|
999
1005
|
}
|
|
1000
1006
|
return;
|
|
1001
1007
|
}
|
|
1002
|
-
if ((level &
|
|
1008
|
+
if ((level & _a.PerformanceConsoleLogLevel) === _a.PerformanceConsoleLogLevel) {
|
|
1003
1009
|
if (_native?.enablePerformanceLogging) {
|
|
1004
1010
|
_native.enablePerformanceLogging(2 /* NativeTraceLevel.Log */);
|
|
1005
|
-
|
|
1006
|
-
|
|
1011
|
+
_a.StartPerformanceCounter = _a._StartMarkNative;
|
|
1012
|
+
_a.EndPerformanceCounter = _a._EndMarkNative;
|
|
1007
1013
|
}
|
|
1008
1014
|
else {
|
|
1009
|
-
|
|
1010
|
-
|
|
1015
|
+
_a.StartPerformanceCounter = _a._StartPerformanceConsole;
|
|
1016
|
+
_a.EndPerformanceCounter = _a._EndPerformanceConsole;
|
|
1011
1017
|
}
|
|
1012
1018
|
return;
|
|
1013
1019
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1020
|
+
_a.StartPerformanceCounter = _a._StartPerformanceCounterDisabled;
|
|
1021
|
+
_a.EndPerformanceCounter = _a._EndPerformanceCounterDisabled;
|
|
1016
1022
|
_native?.disablePerformanceLogging?.();
|
|
1017
1023
|
}
|
|
1018
1024
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -1020,29 +1026,29 @@ export class Tools {
|
|
|
1020
1026
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1021
1027
|
static _EndPerformanceCounterDisabled(counterName, condition) { }
|
|
1022
1028
|
static _StartUserMark(counterName, condition = true) {
|
|
1023
|
-
if (!
|
|
1029
|
+
if (!_a._Performance) {
|
|
1024
1030
|
if (!IsWindowObjectExist()) {
|
|
1025
1031
|
return;
|
|
1026
1032
|
}
|
|
1027
|
-
|
|
1033
|
+
_a._Performance = window.performance;
|
|
1028
1034
|
}
|
|
1029
|
-
if (!condition || !
|
|
1035
|
+
if (!condition || !_a._Performance.mark) {
|
|
1030
1036
|
return;
|
|
1031
1037
|
}
|
|
1032
|
-
|
|
1038
|
+
_a._Performance.mark(counterName + "-Begin");
|
|
1033
1039
|
}
|
|
1034
1040
|
static _EndUserMark(counterName, condition = true) {
|
|
1035
|
-
if (!condition || !
|
|
1041
|
+
if (!condition || !_a._Performance.mark) {
|
|
1036
1042
|
return;
|
|
1037
1043
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1044
|
+
_a._Performance.mark(counterName + "-End");
|
|
1045
|
+
_a._Performance.measure(counterName, counterName + "-Begin", counterName + "-End");
|
|
1040
1046
|
}
|
|
1041
1047
|
static _StartPerformanceConsole(counterName, condition = true) {
|
|
1042
1048
|
if (!condition) {
|
|
1043
1049
|
return;
|
|
1044
1050
|
}
|
|
1045
|
-
|
|
1051
|
+
_a._StartUserMark(counterName, condition);
|
|
1046
1052
|
if (console.time) {
|
|
1047
1053
|
console.time(counterName);
|
|
1048
1054
|
}
|
|
@@ -1051,29 +1057,29 @@ export class Tools {
|
|
|
1051
1057
|
if (!condition) {
|
|
1052
1058
|
return;
|
|
1053
1059
|
}
|
|
1054
|
-
|
|
1060
|
+
_a._EndUserMark(counterName, condition);
|
|
1055
1061
|
console.timeEnd(counterName);
|
|
1056
1062
|
}
|
|
1057
1063
|
static _StartMarkNative(counterName, condition = true) {
|
|
1058
1064
|
if (condition && _native?.startPerformanceCounter) {
|
|
1059
|
-
if (
|
|
1060
|
-
|
|
1065
|
+
if (_a._NativePerformanceCounterHandles.has(counterName)) {
|
|
1066
|
+
_a.Warn(`Performance counter with name ${counterName} is already started.`);
|
|
1061
1067
|
}
|
|
1062
1068
|
else {
|
|
1063
1069
|
const handle = _native.startPerformanceCounter(counterName);
|
|
1064
|
-
|
|
1070
|
+
_a._NativePerformanceCounterHandles.set(counterName, handle);
|
|
1065
1071
|
}
|
|
1066
1072
|
}
|
|
1067
1073
|
}
|
|
1068
1074
|
static _EndMarkNative(counterName, condition = true) {
|
|
1069
1075
|
if (condition && _native?.endPerformanceCounter) {
|
|
1070
|
-
const handle =
|
|
1076
|
+
const handle = _a._NativePerformanceCounterHandles.get(counterName);
|
|
1071
1077
|
if (handle) {
|
|
1072
1078
|
_native.endPerformanceCounter(handle);
|
|
1073
|
-
|
|
1079
|
+
_a._NativePerformanceCounterHandles.delete(counterName);
|
|
1074
1080
|
}
|
|
1075
1081
|
else {
|
|
1076
|
-
|
|
1082
|
+
_a.Warn(`Performance counter with name ${counterName} was not started.`);
|
|
1077
1083
|
}
|
|
1078
1084
|
}
|
|
1079
1085
|
}
|
|
@@ -1173,6 +1179,7 @@ export class Tools {
|
|
|
1173
1179
|
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1174
1180
|
}
|
|
1175
1181
|
}
|
|
1182
|
+
_a = Tools;
|
|
1176
1183
|
/**
|
|
1177
1184
|
* The base URL to use to load assets. If empty the default base url is used.
|
|
1178
1185
|
*/
|
|
@@ -1201,6 +1208,16 @@ Tools._DefaultCdnUrl = "https://cdn.babylonjs.com";
|
|
|
1201
1208
|
* @internal
|
|
1202
1209
|
*/
|
|
1203
1210
|
Tools._DefaultAssetsUrl = "https://assets.babylonjs.com/core";
|
|
1211
|
+
/**
|
|
1212
|
+
* This function is used internally by babylon components to load a script (identified by an url). When the url returns, the
|
|
1213
|
+
* content of this file is added into a new script element, attached to the DOM (body element)
|
|
1214
|
+
* @param scriptUrl defines the url of the script to load
|
|
1215
|
+
* @param onSuccess defines the callback called when the script is loaded
|
|
1216
|
+
* @param onError defines the callback to call if an error occurs
|
|
1217
|
+
* @param scriptId defines the id of the script element
|
|
1218
|
+
* @param useModule defines if we should use the module strategy to load the script
|
|
1219
|
+
*/
|
|
1220
|
+
Tools.LoadScript = typeof _native === "undefined" ? _a._LoadScriptWeb : _a._LoadScriptNative;
|
|
1204
1221
|
// eslint-disable-next-line jsdoc/require-returns-check, jsdoc/require-param
|
|
1205
1222
|
/**
|
|
1206
1223
|
* @returns the absolute URL of a given (relative) url
|
|
@@ -1259,11 +1276,11 @@ Tools._NativePerformanceCounterHandles = new Map();
|
|
|
1259
1276
|
/**
|
|
1260
1277
|
* Starts a performance counter
|
|
1261
1278
|
*/
|
|
1262
|
-
Tools.StartPerformanceCounter =
|
|
1279
|
+
Tools.StartPerformanceCounter = _a._StartPerformanceCounterDisabled;
|
|
1263
1280
|
/**
|
|
1264
1281
|
* Ends a specific performance counter
|
|
1265
1282
|
*/
|
|
1266
|
-
Tools.EndPerformanceCounter =
|
|
1283
|
+
Tools.EndPerformanceCounter = _a._EndPerformanceCounterDisabled;
|
|
1267
1284
|
/**
|
|
1268
1285
|
* Use this className as a decorator on a given class definition to add it a name and optionally its module.
|
|
1269
1286
|
* You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.
|