@rings-webgpu/core 1.0.23 → 1.0.25

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.
@@ -32705,9 +32705,32 @@ fn CsMain( @builtin(workgroup_id) workgroup_id : vec3<u32> , @builtin(global_inv
32705
32705
  return url.substring(0, s_pos);
32706
32706
  }
32707
32707
  static normalizePath(url) {
32708
- var tmp = url.replaceAll(`//`, `/`);
32709
- tmp = tmp.replaceAll(`\\`, `/`);
32710
- return tmp;
32708
+ if (!url) {
32709
+ return url;
32710
+ }
32711
+ let normalized = url.replace(/\\/g, "/");
32712
+ const preserveLeadingDoubleSlash = normalized.startsWith("//");
32713
+ const protectedTokens = [];
32714
+ let tokenIndex = 0;
32715
+ normalized = normalized.replace(
32716
+ /([a-zA-Z][a-zA-Z0-9+\-.]*):\/{2}/g,
32717
+ (match, scheme, offset) => {
32718
+ if (scheme.length === 1 && offset === 0) {
32719
+ return match;
32720
+ }
32721
+ const token = `__SCHEME_SLASH_${tokenIndex++}__`;
32722
+ protectedTokens.push(token);
32723
+ return `${scheme}:${token}`;
32724
+ }
32725
+ );
32726
+ normalized = normalized.replace(/\/{2,}/g, "/");
32727
+ protectedTokens.forEach((token) => {
32728
+ normalized = normalized.replace(token, "//");
32729
+ });
32730
+ if (preserveLeadingDoubleSlash) {
32731
+ normalized = `//${normalized.replace(/^\/+/, "")}`;
32732
+ }
32733
+ return normalized;
32711
32734
  }
32712
32735
  static getStringList(str, char = ";") {
32713
32736
  return str.split(char);
@@ -37085,6 +37108,7 @@ else if (typeof exports === 'object')
37085
37108
  }
37086
37109
  }
37087
37110
  }
37111
+ const promiseList = [];
37088
37112
  for (const key in this.matLibs) {
37089
37113
  const mat2 = this.matLibs[key];
37090
37114
  if (mat2.textures && mat2.textures.length > 0) {
@@ -37092,10 +37116,16 @@ else if (typeof exports === 'object')
37092
37116
  const texUrl = StringUtil.normalizePath(
37093
37117
  this.baseUrl + mat2.textures[i]
37094
37118
  );
37095
- await Engine3D.res.loadTexture(texUrl);
37119
+ promiseList.push(Engine3D.res.loadTexture(texUrl).catch(
37120
+ (error) => {
37121
+ console.error(`Failed to load texture: ${texUrl}`, error);
37122
+ return null;
37123
+ }
37124
+ ));
37096
37125
  }
37097
37126
  }
37098
37127
  }
37128
+ await Promise.all(promiseList);
37099
37129
  sourceData = null;
37100
37130
  return true;
37101
37131
  }
@@ -40960,7 +40990,12 @@ else if (typeof exports === 'object')
40960
40990
  }
40961
40991
  let texture = new BitmapTexture2D();
40962
40992
  texture.flipY = flipY;
40963
- await texture.load(url, loaderFunctions);
40993
+ try {
40994
+ await texture.load(url, loaderFunctions);
40995
+ } catch (error) {
40996
+ console.error(`Failed to load texture: ${url}`, error);
40997
+ return null;
40998
+ }
40964
40999
  this._texturePool.set(url, texture);
40965
41000
  return texture;
40966
41001
  }
@@ -41260,7 +41295,7 @@ else if (typeof exports === 'object')
41260
41295
  }
41261
41296
  }
41262
41297
 
41263
- const version = "1.0.22";
41298
+ const version = "1.0.24";
41264
41299
 
41265
41300
  class Engine3D {
41266
41301
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rings-webgpu/core",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Rings webgpu Engine",
5
5
  "main": "index.js",
6
6
  "exports": {