@rings-webgpu/core 1.0.37 → 1.0.38
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/dist/rings.es.js +27 -27
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +57 -49
- package/dist/rings.umd.js +36 -36
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +57 -49
- package/dist/types/components/renderer/GSplatStreamRenderer.d.ts +2 -2
- package/package.json +1 -1
package/dist/rings.es.max.js
CHANGED
|
@@ -54360,7 +54360,41 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54360
54360
|
// Splat count and texture dimensions
|
|
54361
54361
|
totalCount = 0;
|
|
54362
54362
|
size = new Vector2();
|
|
54363
|
-
|
|
54363
|
+
localBoundBox = new BoundingBox();
|
|
54364
|
+
// public worldBoundBox: BoundingBox = new BoundingBox();
|
|
54365
|
+
get worldBoundBox() {
|
|
54366
|
+
const boundBox = new BoundingBox();
|
|
54367
|
+
boundBox.makeEmpty();
|
|
54368
|
+
const worldMatrix = this.object3D.transform.worldMatrix;
|
|
54369
|
+
const m = worldMatrix.rawData;
|
|
54370
|
+
const localMin = this.localBoundBox.min;
|
|
54371
|
+
const localMax = this.localBoundBox.max;
|
|
54372
|
+
const corners = [
|
|
54373
|
+
[localMin.x, localMin.y, localMin.z],
|
|
54374
|
+
// 0: min, min, min
|
|
54375
|
+
[localMax.x, localMin.y, localMin.z],
|
|
54376
|
+
// 1: max, min, min
|
|
54377
|
+
[localMin.x, localMax.y, localMin.z],
|
|
54378
|
+
// 2: min, max, min
|
|
54379
|
+
[localMax.x, localMax.y, localMin.z],
|
|
54380
|
+
// 3: max, max, min
|
|
54381
|
+
[localMin.x, localMin.y, localMax.z],
|
|
54382
|
+
// 4: min, min, max
|
|
54383
|
+
[localMax.x, localMin.y, localMax.z],
|
|
54384
|
+
// 5: max, min, max
|
|
54385
|
+
[localMin.x, localMax.y, localMax.z],
|
|
54386
|
+
// 6: min, max, max
|
|
54387
|
+
[localMax.x, localMax.y, localMax.z]
|
|
54388
|
+
// 7: max, max, max
|
|
54389
|
+
];
|
|
54390
|
+
for (const [x, y, z] of corners) {
|
|
54391
|
+
const wx = m[0] * x + m[4] * y + m[8] * z + m[12];
|
|
54392
|
+
const wy = m[1] * x + m[5] * y + m[9] * z + m[13];
|
|
54393
|
+
const wz = m[2] * x + m[6] * y + m[10] * z + m[14];
|
|
54394
|
+
boundBox.expandByPoint(new Vector3(wx, wy, wz));
|
|
54395
|
+
}
|
|
54396
|
+
return boundBox;
|
|
54397
|
+
}
|
|
54364
54398
|
// GPU textures for splat data
|
|
54365
54399
|
splatColor;
|
|
54366
54400
|
transformA;
|
|
@@ -54381,8 +54415,7 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54381
54415
|
// R32U: size.x * size.y
|
|
54382
54416
|
_positions;
|
|
54383
54417
|
// xyz per splat (local space)
|
|
54384
|
-
_worldPositions;
|
|
54385
|
-
// xyz per splat (world space, cached)
|
|
54418
|
+
// private _worldPositions: Float32Array; // xyz per splat (world space, cached)
|
|
54386
54419
|
// Tracking which splats have been set
|
|
54387
54420
|
_splatSetFlags;
|
|
54388
54421
|
// Track which indices have data
|
|
@@ -54442,8 +54475,7 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54442
54475
|
}
|
|
54443
54476
|
this._positions = new Float32Array(totalCount * 3);
|
|
54444
54477
|
this._positions.fill(0);
|
|
54445
|
-
this.
|
|
54446
|
-
this._worldPositions.fill(0);
|
|
54478
|
+
this.localBoundBox.makeEmpty();
|
|
54447
54479
|
this._splatSetFlags = new Array(totalCount).fill(false);
|
|
54448
54480
|
this._validCount = 0;
|
|
54449
54481
|
this.texParams = new Float32Array([this._validCount, this.size.x, 0, 1]);
|
|
@@ -54492,6 +54524,7 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54492
54524
|
this._positions[index * 3 + 0] = data.position[0];
|
|
54493
54525
|
this._positions[index * 3 + 1] = data.position[1];
|
|
54494
54526
|
this._positions[index * 3 + 2] = data.position[2];
|
|
54527
|
+
this.localBoundBox.expandByPoint(new Vector3(data.position[0], data.position[1], data.position[2]));
|
|
54495
54528
|
const SH_C0 = 0.28209479177387814;
|
|
54496
54529
|
let r = 0.5, g = 0.5, b = 0.5;
|
|
54497
54530
|
if (data.sh && data.sh.coeffs && data.sh.coeffs.length >= 3) {
|
|
@@ -54510,7 +54543,6 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54510
54543
|
this._splatSetFlags[index] = true;
|
|
54511
54544
|
this._validCount++;
|
|
54512
54545
|
this.texParams[2] = this._validCount;
|
|
54513
|
-
this._centersSent = false;
|
|
54514
54546
|
}
|
|
54515
54547
|
this._pendingUpdates.add(index);
|
|
54516
54548
|
}
|
|
@@ -54643,43 +54675,10 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54643
54675
|
*/
|
|
54644
54676
|
updateWorldPositions() {
|
|
54645
54677
|
if (!this._positions || this._validCount === 0) return;
|
|
54646
|
-
const worldMatrix = this.object3D.transform.worldMatrix;
|
|
54647
|
-
const localPos = this._positions;
|
|
54648
|
-
const count = this._validCount;
|
|
54649
|
-
const m = worldMatrix.rawData;
|
|
54650
|
-
this.worldBoundBox.makeEmpty();
|
|
54651
|
-
for (let i = 0; i < count; i++) {
|
|
54652
|
-
if (!this._splatSetFlags[i]) continue;
|
|
54653
|
-
const idx = i * 3;
|
|
54654
|
-
const x = localPos[idx + 0];
|
|
54655
|
-
const y = localPos[idx + 1];
|
|
54656
|
-
const z = localPos[idx + 2];
|
|
54657
|
-
this._worldPositions[idx + 0] = m[0] * x + m[4] * y + m[8] * z + m[12];
|
|
54658
|
-
this._worldPositions[idx + 1] = m[1] * x + m[5] * y + m[9] * z + m[13];
|
|
54659
|
-
this._worldPositions[idx + 2] = m[2] * x + m[6] * y + m[10] * z + m[14];
|
|
54660
|
-
this.worldBoundBox.expandByPoint(new Vector3(this._worldPositions[idx + 0], this._worldPositions[idx + 1], this._worldPositions[idx + 2]));
|
|
54661
|
-
}
|
|
54662
54678
|
this._centersSent = false;
|
|
54663
54679
|
}
|
|
54664
54680
|
updatePendingWorldPositions() {
|
|
54665
54681
|
if (!this._positions || this._validCount === 0) return;
|
|
54666
|
-
const worldMatrix = this.object3D.transform.worldMatrix;
|
|
54667
|
-
const localPos = this._positions;
|
|
54668
|
-
this._validCount;
|
|
54669
|
-
const m = worldMatrix.rawData;
|
|
54670
|
-
const pendingUpdates = Array.from(this._pendingUpdates.values());
|
|
54671
|
-
for (let i = 0; i < pendingUpdates.length; i++) {
|
|
54672
|
-
const ii = pendingUpdates[i];
|
|
54673
|
-
if (!this._splatSetFlags[ii]) continue;
|
|
54674
|
-
const idx = ii * 3;
|
|
54675
|
-
const x = localPos[idx + 0];
|
|
54676
|
-
const y = localPos[idx + 1];
|
|
54677
|
-
const z = localPos[idx + 2];
|
|
54678
|
-
this._worldPositions[idx + 0] = m[0] * x + m[4] * y + m[8] * z + m[12];
|
|
54679
|
-
this._worldPositions[idx + 1] = m[1] * x + m[5] * y + m[9] * z + m[13];
|
|
54680
|
-
this._worldPositions[idx + 2] = m[2] * x + m[6] * y + m[10] * z + m[14];
|
|
54681
|
-
this.worldBoundBox.expandByPoint(new Vector3(this._worldPositions[idx + 0], this._worldPositions[idx + 1], this._worldPositions[idx + 2]));
|
|
54682
|
-
}
|
|
54683
54682
|
this._centersSent = false;
|
|
54684
54683
|
}
|
|
54685
54684
|
/**
|
|
@@ -54689,7 +54688,7 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54689
54688
|
scheduleOrder(viewMatrix) {
|
|
54690
54689
|
if (this._validCount === 0) return;
|
|
54691
54690
|
const transformChanged = this.object3D.transform.localChange;
|
|
54692
|
-
if (transformChanged
|
|
54691
|
+
if (transformChanged) {
|
|
54693
54692
|
this.updateWorldPositions();
|
|
54694
54693
|
}
|
|
54695
54694
|
const r = viewMatrix.rawData;
|
|
@@ -54751,14 +54750,19 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54751
54750
|
this.instanceCount = newInstanceCount;
|
|
54752
54751
|
};
|
|
54753
54752
|
const centers = new Float32Array(this._validCount * 3);
|
|
54754
|
-
const worldPos = this._worldPositions || this._positions;
|
|
54755
54753
|
let centerIdx = 0;
|
|
54754
|
+
const worldMatrix = this.object3D.transform.worldMatrix;
|
|
54755
|
+
const localPos = this._positions;
|
|
54756
|
+
const m = worldMatrix.rawData;
|
|
54756
54757
|
for (let i = 0; i < this._validCount; i++) {
|
|
54757
54758
|
if (this._splatSetFlags[i]) {
|
|
54758
54759
|
const srcIdx = i * 3;
|
|
54759
|
-
|
|
54760
|
-
|
|
54761
|
-
|
|
54760
|
+
const x = localPos[srcIdx + 0];
|
|
54761
|
+
const y = localPos[srcIdx + 1];
|
|
54762
|
+
const z = localPos[srcIdx + 2];
|
|
54763
|
+
centers[centerIdx * 3 + 0] = m[0] * x + m[4] * y + m[8] * z + m[12];
|
|
54764
|
+
centers[centerIdx * 3 + 1] = m[1] * x + m[5] * y + m[9] * z + m[13];
|
|
54765
|
+
centers[centerIdx * 3 + 2] = m[2] * x + m[6] * y + m[10] * z + m[14];
|
|
54762
54766
|
centerIdx++;
|
|
54763
54767
|
}
|
|
54764
54768
|
}
|
|
@@ -54774,14 +54778,19 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
54774
54778
|
}
|
|
54775
54779
|
if (!this._centersSent && this._sortWorker) {
|
|
54776
54780
|
const centers = new Float32Array(this._validCount * 3);
|
|
54777
|
-
const worldPos = this._worldPositions || this._positions;
|
|
54778
54781
|
let centerIdx = 0;
|
|
54782
|
+
const worldMatrix = this.object3D.transform.worldMatrix;
|
|
54783
|
+
const localPos = this._positions;
|
|
54784
|
+
const m = worldMatrix.rawData;
|
|
54779
54785
|
for (let i = 0; i < this._validCount; i++) {
|
|
54780
54786
|
if (this._splatSetFlags[i]) {
|
|
54781
54787
|
const srcIdx = i * 3;
|
|
54782
|
-
|
|
54783
|
-
|
|
54784
|
-
|
|
54788
|
+
const x = localPos[srcIdx + 0];
|
|
54789
|
+
const y = localPos[srcIdx + 1];
|
|
54790
|
+
const z = localPos[srcIdx + 2];
|
|
54791
|
+
centers[centerIdx * 3 + 0] = m[0] * x + m[4] * y + m[8] * z + m[12];
|
|
54792
|
+
centers[centerIdx * 3 + 1] = m[1] * x + m[5] * y + m[9] * z + m[13];
|
|
54793
|
+
centers[centerIdx * 3 + 2] = m[2] * x + m[6] * y + m[10] * z + m[14];
|
|
54785
54794
|
centerIdx++;
|
|
54786
54795
|
}
|
|
54787
54796
|
}
|
|
@@ -55094,7 +55103,6 @@ let GSplatStreamRenderer = class extends RenderNode {
|
|
|
55094
55103
|
this.splatOrder = null;
|
|
55095
55104
|
}
|
|
55096
55105
|
this._positions = null;
|
|
55097
|
-
this._worldPositions = null;
|
|
55098
55106
|
this._orderData = null;
|
|
55099
55107
|
this._colorData = null;
|
|
55100
55108
|
this._transformAData = null;
|