@rings-webgpu/core 1.0.21 → 1.0.23

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.
@@ -25059,7 +25059,7 @@ struct InstanceData {
25059
25059
  console.warn("genGSplatBounds: No position data available");
25060
25060
  return bound;
25061
25061
  }
25062
- const matrix = obj.transform.worldMatrix;
25062
+ const matrix = gsplatRenderer.object3D.transform.worldMatrix;
25063
25063
  const point = new Vector3();
25064
25064
  for (let i = 0; i < count; i++) {
25065
25065
  const idx = i * 3;
@@ -41260,7 +41260,7 @@ else if (typeof exports === 'object')
41260
41260
  }
41261
41261
  }
41262
41262
 
41263
- const version = "1.0.20";
41263
+ const version = "1.0.22";
41264
41264
 
41265
41265
  class Engine3D {
41266
41266
  /**
@@ -61589,6 +61589,9 @@ fn frag(){
61589
61589
  _type;
61590
61590
  _data;
61591
61591
  _box;
61592
+ get box() {
61593
+ return this._box;
61594
+ }
61592
61595
  _sphere;
61593
61596
  _matrix;
61594
61597
  constructor(data) {
@@ -62268,17 +62271,33 @@ fn frag(){
62268
62271
  }
62269
62272
  }
62270
62273
  if (!parentTile) {
62271
- const tmpMat = new Matrix4();
62272
- tmpMat.copyFrom(transform);
62273
- tmpMat.rawData[12] = 0;
62274
- tmpMat.rawData[13] = 0;
62275
- tmpMat.rawData[14] = 0;
62274
+ transform.copyFrom(this._upRotationMatrix);
62276
62275
  const position = new Vector3();
62277
62276
  position.copyFrom(boundCenter);
62278
- position.applyMatrix4(tmpMat);
62277
+ position.applyMatrix4(transform);
62278
+ const box = tileObj.cached.boundingVolume.box;
62279
+ const boundCorners = [
62280
+ new Vector3(box.min.x, box.min.y, box.min.z),
62281
+ new Vector3(box.max.x, box.min.y, box.min.z),
62282
+ new Vector3(box.min.x, box.max.y, box.min.z),
62283
+ new Vector3(box.max.x, box.max.y, box.min.z),
62284
+ new Vector3(box.min.x, box.min.y, box.max.z),
62285
+ new Vector3(box.max.x, box.min.y, box.max.z),
62286
+ new Vector3(box.min.x, box.max.y, box.max.z),
62287
+ new Vector3(box.max.x, box.max.y, box.max.z)
62288
+ ];
62289
+ for (const corner of boundCorners) {
62290
+ corner.applyMatrix4(transform);
62291
+ }
62292
+ const newBox = new BoundingBox();
62293
+ boundCorners.forEach((corner) => {
62294
+ newBox.expandByPoint(corner);
62295
+ });
62279
62296
  transform.rawData[12] = -position.x;
62280
62297
  transform.rawData[13] = -position.y;
62281
62298
  transform.rawData[14] = -position.z;
62299
+ const min = newBox.min;
62300
+ transform.rawData[13] -= min.y;
62282
62301
  }
62283
62302
  const worldTransform = new Matrix4();
62284
62303
  worldTransform.copyFrom(transform);
@@ -62391,7 +62410,6 @@ fn frag(){
62391
62410
  const extension = getUrlExtension(uri);
62392
62411
  const fullUrl = url;
62393
62412
  let scene = null;
62394
- const adjustmentTransform = this._upRotationMatrix;
62395
62413
  switch (extension.toLowerCase()) {
62396
62414
  case "b3dm":
62397
62415
  const loader = new FileLoader();
@@ -62400,7 +62418,7 @@ fn frag(){
62400
62418
  },
62401
62419
  onComplete: (e) => {
62402
62420
  }
62403
- }, adjustmentTransform);
62421
+ });
62404
62422
  scene = parser.data;
62405
62423
  break;
62406
62424
  case "i3dm":
@@ -62411,8 +62429,7 @@ fn frag(){
62411
62429
  },
62412
62430
  onComplete: (e) => {
62413
62431
  }
62414
- },
62415
- adjustmentTransform
62432
+ }
62416
62433
  );
62417
62434
  break;
62418
62435
  case "glb":
@@ -62586,10 +62603,10 @@ fn frag(){
62586
62603
  adjustmentTransform.makeRotationAxis(Vector3.Y_AXIS, -Math.PI / 2);
62587
62604
  break;
62588
62605
  case "y":
62589
- adjustmentTransform.makeRotationAxis(Vector3.X_AXIS, Math.PI / 2);
62606
+ adjustmentTransform.identity();
62590
62607
  break;
62591
62608
  case "z":
62592
- adjustmentTransform.identity();
62609
+ adjustmentTransform.makeRotationAxis(Vector3.X_AXIS, -Math.PI / 2);
62593
62610
  break;
62594
62611
  default:
62595
62612
  console.warn(`Unknown gltfUpAxis: ${gltfUpAxis}, using default`);
@@ -62597,10 +62614,6 @@ fn frag(){
62597
62614
  break;
62598
62615
  }
62599
62616
  this._upRotationMatrix = adjustmentTransform;
62600
- const invertMatrix = new Matrix4();
62601
- invertMatrix.copyFrom(adjustmentTransform);
62602
- invertMatrix.invert();
62603
- this._applyLocalTransform(this.group.transform, invertMatrix);
62604
62617
  }
62605
62618
  /**
62606
62619
  * Apply local transform matrix to Transform
@@ -10,6 +10,7 @@ export declare class BoundingVolume {
10
10
  private _type;
11
11
  private _data;
12
12
  private _box?;
13
+ get box(): BoundingBox;
13
14
  private _sphere?;
14
15
  private _matrix?;
15
16
  constructor(data: BoundingVolumeData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rings-webgpu/core",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "Rings webgpu Engine",
5
5
  "main": "index.js",
6
6
  "exports": {