@rings-webgpu/core 1.0.22 → 1.0.24

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.
@@ -37078,6 +37078,7 @@ class OBJParser extends ParserBase {
37078
37078
  }
37079
37079
  }
37080
37080
  }
37081
+ const promiseList = [];
37081
37082
  for (const key in this.matLibs) {
37082
37083
  const mat2 = this.matLibs[key];
37083
37084
  if (mat2.textures && mat2.textures.length > 0) {
@@ -37085,10 +37086,16 @@ class OBJParser extends ParserBase {
37085
37086
  const texUrl = StringUtil.normalizePath(
37086
37087
  this.baseUrl + mat2.textures[i]
37087
37088
  );
37088
- await Engine3D.res.loadTexture(texUrl);
37089
+ promiseList.push(Engine3D.res.loadTexture(texUrl).catch(
37090
+ (error) => {
37091
+ console.error(`Failed to load texture: ${texUrl}`, error);
37092
+ return null;
37093
+ }
37094
+ ));
37089
37095
  }
37090
37096
  }
37091
37097
  }
37098
+ await Promise.all(promiseList);
37092
37099
  sourceData = null;
37093
37100
  return true;
37094
37101
  }
@@ -40953,7 +40960,12 @@ class Res {
40953
40960
  }
40954
40961
  let texture = new BitmapTexture2D();
40955
40962
  texture.flipY = flipY;
40956
- await texture.load(url, loaderFunctions);
40963
+ try {
40964
+ await texture.load(url, loaderFunctions);
40965
+ } catch (error) {
40966
+ console.error(`Failed to load texture: ${url}`, error);
40967
+ return null;
40968
+ }
40957
40969
  this._texturePool.set(url, texture);
40958
40970
  return texture;
40959
40971
  }
@@ -41253,7 +41265,7 @@ class PostProcessingComponent extends ComponentBase {
41253
41265
  }
41254
41266
  }
41255
41267
 
41256
- const version = "1.0.21";
41268
+ const version = "1.0.23";
41257
41269
 
41258
41270
  class Engine3D {
41259
41271
  /**
@@ -61582,6 +61594,9 @@ class BoundingVolume {
61582
61594
  _type;
61583
61595
  _data;
61584
61596
  _box;
61597
+ get box() {
61598
+ return this._box;
61599
+ }
61585
61600
  _sphere;
61586
61601
  _matrix;
61587
61602
  constructor(data) {
@@ -62261,17 +62276,33 @@ class TilesRenderer {
62261
62276
  }
62262
62277
  }
62263
62278
  if (!parentTile) {
62264
- const tmpMat = new Matrix4();
62265
- tmpMat.copyFrom(transform);
62266
- tmpMat.rawData[12] = 0;
62267
- tmpMat.rawData[13] = 0;
62268
- tmpMat.rawData[14] = 0;
62279
+ transform.copyFrom(this._upRotationMatrix);
62269
62280
  const position = new Vector3();
62270
62281
  position.copyFrom(boundCenter);
62271
- position.applyMatrix4(tmpMat);
62282
+ position.applyMatrix4(transform);
62283
+ const box = tileObj.cached.boundingVolume.box;
62284
+ const boundCorners = [
62285
+ new Vector3(box.min.x, box.min.y, box.min.z),
62286
+ new Vector3(box.max.x, box.min.y, box.min.z),
62287
+ new Vector3(box.min.x, box.max.y, box.min.z),
62288
+ new Vector3(box.max.x, box.max.y, box.min.z),
62289
+ new Vector3(box.min.x, box.min.y, box.max.z),
62290
+ new Vector3(box.max.x, box.min.y, box.max.z),
62291
+ new Vector3(box.min.x, box.max.y, box.max.z),
62292
+ new Vector3(box.max.x, box.max.y, box.max.z)
62293
+ ];
62294
+ for (const corner of boundCorners) {
62295
+ corner.applyMatrix4(transform);
62296
+ }
62297
+ const newBox = new BoundingBox();
62298
+ boundCorners.forEach((corner) => {
62299
+ newBox.expandByPoint(corner);
62300
+ });
62272
62301
  transform.rawData[12] = -position.x;
62273
62302
  transform.rawData[13] = -position.y;
62274
62303
  transform.rawData[14] = -position.z;
62304
+ const min = newBox.min;
62305
+ transform.rawData[13] -= min.y;
62275
62306
  }
62276
62307
  const worldTransform = new Matrix4();
62277
62308
  worldTransform.copyFrom(transform);
@@ -62384,7 +62415,6 @@ class TilesRenderer {
62384
62415
  const extension = getUrlExtension(uri);
62385
62416
  const fullUrl = url;
62386
62417
  let scene = null;
62387
- const adjustmentTransform = this._upRotationMatrix;
62388
62418
  switch (extension.toLowerCase()) {
62389
62419
  case "b3dm":
62390
62420
  const loader = new FileLoader();
@@ -62393,7 +62423,7 @@ class TilesRenderer {
62393
62423
  },
62394
62424
  onComplete: (e) => {
62395
62425
  }
62396
- }, adjustmentTransform);
62426
+ });
62397
62427
  scene = parser.data;
62398
62428
  break;
62399
62429
  case "i3dm":
@@ -62404,8 +62434,7 @@ class TilesRenderer {
62404
62434
  },
62405
62435
  onComplete: (e) => {
62406
62436
  }
62407
- },
62408
- adjustmentTransform
62437
+ }
62409
62438
  );
62410
62439
  break;
62411
62440
  case "glb":
@@ -62579,10 +62608,10 @@ class TilesRenderer {
62579
62608
  adjustmentTransform.makeRotationAxis(Vector3.Y_AXIS, -Math.PI / 2);
62580
62609
  break;
62581
62610
  case "y":
62582
- adjustmentTransform.makeRotationAxis(Vector3.X_AXIS, Math.PI / 2);
62611
+ adjustmentTransform.identity();
62583
62612
  break;
62584
62613
  case "z":
62585
- adjustmentTransform.identity();
62614
+ adjustmentTransform.makeRotationAxis(Vector3.X_AXIS, -Math.PI / 2);
62586
62615
  break;
62587
62616
  default:
62588
62617
  console.warn(`Unknown gltfUpAxis: ${gltfUpAxis}, using default`);
@@ -62590,10 +62619,6 @@ class TilesRenderer {
62590
62619
  break;
62591
62620
  }
62592
62621
  this._upRotationMatrix = adjustmentTransform;
62593
- const invertMatrix = new Matrix4();
62594
- invertMatrix.copyFrom(adjustmentTransform);
62595
- invertMatrix.invert();
62596
- this._applyLocalTransform(this.group.transform, invertMatrix);
62597
62622
  }
62598
62623
  /**
62599
62624
  * Apply local transform matrix to Transform