@rings-webgpu/core 1.0.49 → 1.0.51
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 +189 -189
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +619 -108
- package/dist/rings.umd.js +127 -127
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +618 -107
- package/dist/types/components/renderer/PointCloudRenderer.d.ts +0 -2
- package/dist/types/components/renderer/PointCloudStreamRenderer.d.ts +126 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/textures/Float32ArrayTexture.d.ts +15 -0
- package/package.json +1 -1
package/dist/rings.umd.max.js
CHANGED
|
@@ -2148,13 +2148,13 @@
|
|
|
2148
2148
|
return null;
|
|
2149
2149
|
}
|
|
2150
2150
|
|
|
2151
|
-
var __defProp$
|
|
2152
|
-
var __decorateClass$
|
|
2151
|
+
var __defProp$4 = Object.defineProperty;
|
|
2152
|
+
var __decorateClass$q = (decorators, target, key, kind) => {
|
|
2153
2153
|
var result = void 0 ;
|
|
2154
2154
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2155
2155
|
if (decorator = decorators[i])
|
|
2156
2156
|
result = (decorator(target, key, result) ) || result;
|
|
2157
|
-
if (result) __defProp$
|
|
2157
|
+
if (result) __defProp$4(target, key, result);
|
|
2158
2158
|
return result;
|
|
2159
2159
|
};
|
|
2160
2160
|
const _Struct = class _Struct {
|
|
@@ -2252,10 +2252,10 @@
|
|
|
2252
2252
|
return struct.__size;
|
|
2253
2253
|
}
|
|
2254
2254
|
};
|
|
2255
|
-
__decorateClass$
|
|
2255
|
+
__decorateClass$q([
|
|
2256
2256
|
NonSerialize
|
|
2257
2257
|
], _Struct.prototype, "__refection");
|
|
2258
|
-
__decorateClass$
|
|
2258
|
+
__decorateClass$q([
|
|
2259
2259
|
NonSerialize
|
|
2260
2260
|
], _Struct.prototype, "__size");
|
|
2261
2261
|
let Struct = _Struct;
|
|
@@ -22000,14 +22000,14 @@ struct InstanceData {
|
|
|
22000
22000
|
}
|
|
22001
22001
|
}
|
|
22002
22002
|
|
|
22003
|
-
var __defProp$
|
|
22004
|
-
var __getOwnPropDesc$
|
|
22005
|
-
var __decorateClass$
|
|
22006
|
-
var result = __getOwnPropDesc$
|
|
22003
|
+
var __defProp$3 = Object.defineProperty;
|
|
22004
|
+
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
22005
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
22006
|
+
var result = __getOwnPropDesc$p(target, key) ;
|
|
22007
22007
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22008
22008
|
if (decorator = decorators[i])
|
|
22009
22009
|
result = (decorator(target, key, result) ) || result;
|
|
22010
|
-
if (result) __defProp$
|
|
22010
|
+
if (result) __defProp$3(target, key, result);
|
|
22011
22011
|
return result;
|
|
22012
22012
|
};
|
|
22013
22013
|
class RenderNode extends ComponentBase {
|
|
@@ -22601,13 +22601,13 @@ struct InstanceData {
|
|
|
22601
22601
|
this._combineShaderRefection = void 0;
|
|
22602
22602
|
}
|
|
22603
22603
|
}
|
|
22604
|
-
__decorateClass$
|
|
22604
|
+
__decorateClass$p([
|
|
22605
22605
|
EditorInspector
|
|
22606
22606
|
], RenderNode.prototype, "materials");
|
|
22607
|
-
__decorateClass$
|
|
22607
|
+
__decorateClass$p([
|
|
22608
22608
|
EditorInspector
|
|
22609
22609
|
], RenderNode.prototype, "castShadow");
|
|
22610
|
-
__decorateClass$
|
|
22610
|
+
__decorateClass$p([
|
|
22611
22611
|
EditorInspector
|
|
22612
22612
|
], RenderNode.prototype, "castGI");
|
|
22613
22613
|
|
|
@@ -23306,9 +23306,9 @@ struct InstanceData {
|
|
|
23306
23306
|
}
|
|
23307
23307
|
}
|
|
23308
23308
|
|
|
23309
|
-
var __getOwnPropDesc$
|
|
23310
|
-
var __decorateClass$
|
|
23311
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
23309
|
+
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
23310
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
23311
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
23312
23312
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
23313
23313
|
if (decorator = decorators[i])
|
|
23314
23314
|
result = (decorator(result)) || result;
|
|
@@ -23341,7 +23341,7 @@ struct InstanceData {
|
|
|
23341
23341
|
pass.setUniform("pixelCull", new Float32Array([2, 0, 0, 0]));
|
|
23342
23342
|
}
|
|
23343
23343
|
};
|
|
23344
|
-
exports.GSplatShader = __decorateClass$
|
|
23344
|
+
exports.GSplatShader = __decorateClass$o([
|
|
23345
23345
|
RegisterShader(exports.GSplatShader, "GSplatShader")
|
|
23346
23346
|
], exports.GSplatShader);
|
|
23347
23347
|
|
|
@@ -24454,9 +24454,9 @@ struct InstanceData {
|
|
|
24454
24454
|
return bits;
|
|
24455
24455
|
};
|
|
24456
24456
|
|
|
24457
|
-
var __getOwnPropDesc$
|
|
24458
|
-
var __decorateClass$
|
|
24459
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
24457
|
+
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
24458
|
+
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
24459
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
|
|
24460
24460
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
24461
24461
|
if (decorator = decorators[i])
|
|
24462
24462
|
result = (decorator(result)) || result;
|
|
@@ -25256,7 +25256,7 @@ struct InstanceData {
|
|
|
25256
25256
|
super.destroy(force);
|
|
25257
25257
|
}
|
|
25258
25258
|
};
|
|
25259
|
-
exports.GSplatRenderer = __decorateClass$
|
|
25259
|
+
exports.GSplatRenderer = __decorateClass$n([
|
|
25260
25260
|
RegisterComponent(exports.GSplatRenderer, "GSplatRenderer")
|
|
25261
25261
|
], exports.GSplatRenderer);
|
|
25262
25262
|
|
|
@@ -25394,9 +25394,9 @@ struct InstanceData {
|
|
|
25394
25394
|
`
|
|
25395
25395
|
);
|
|
25396
25396
|
|
|
25397
|
-
var __getOwnPropDesc$
|
|
25398
|
-
var __decorateClass$
|
|
25399
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
25397
|
+
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
25398
|
+
var __decorateClass$m = (decorators, target, key, kind) => {
|
|
25399
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
25400
25400
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
25401
25401
|
if (decorator = decorators[i])
|
|
25402
25402
|
result = (decorator(result)) || result;
|
|
@@ -25428,7 +25428,7 @@ struct InstanceData {
|
|
|
25428
25428
|
pass.setUniformArray("pointParams", new Float32Array([0, 0, 0, 128]));
|
|
25429
25429
|
}
|
|
25430
25430
|
};
|
|
25431
|
-
exports.PointCloudShader = __decorateClass$
|
|
25431
|
+
exports.PointCloudShader = __decorateClass$m([
|
|
25432
25432
|
RegisterShader(exports.PointCloudShader, "PointCloudShader")
|
|
25433
25433
|
], exports.PointCloudShader);
|
|
25434
25434
|
|
|
@@ -25558,21 +25558,32 @@ struct InstanceData {
|
|
|
25558
25558
|
}
|
|
25559
25559
|
|
|
25560
25560
|
class Float32ArrayTexture extends Texture {
|
|
25561
|
+
_dataBuffer;
|
|
25561
25562
|
create(width, height, data, filtering = true) {
|
|
25562
25563
|
let device = webGPUContext.device;
|
|
25563
25564
|
const bytesPerRow = width * 4 * 4;
|
|
25564
25565
|
this.format = GPUTextureFormat.rgba32float;
|
|
25565
25566
|
let mipmapCount = 1;
|
|
25566
25567
|
this.createTextureDescriptor(width, height, mipmapCount, this.format);
|
|
25567
|
-
const
|
|
25568
|
-
|
|
25569
|
-
|
|
25570
|
-
|
|
25571
|
-
|
|
25568
|
+
const neededSize = data.byteLength;
|
|
25569
|
+
if (!this._dataBuffer || this._dataBuffer.size < neededSize) {
|
|
25570
|
+
this._dataBuffer && this._dataBuffer.destroy();
|
|
25571
|
+
this._dataBuffer = device.createBuffer({
|
|
25572
|
+
size: neededSize,
|
|
25573
|
+
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC
|
|
25574
|
+
});
|
|
25575
|
+
}
|
|
25576
|
+
device.queue.writeBuffer(
|
|
25577
|
+
this._dataBuffer,
|
|
25578
|
+
0,
|
|
25579
|
+
data.buffer,
|
|
25580
|
+
data.byteOffset,
|
|
25581
|
+
data.byteLength
|
|
25582
|
+
);
|
|
25572
25583
|
const commandEncoder = GPUContext.beginCommandEncoder();
|
|
25573
25584
|
commandEncoder.copyBufferToTexture(
|
|
25574
25585
|
{
|
|
25575
|
-
buffer:
|
|
25586
|
+
buffer: this._dataBuffer,
|
|
25576
25587
|
bytesPerRow
|
|
25577
25588
|
},
|
|
25578
25589
|
{
|
|
@@ -25619,11 +25630,116 @@ struct InstanceData {
|
|
|
25619
25630
|
this.gpuSampler = device.createSampler({});
|
|
25620
25631
|
return this;
|
|
25621
25632
|
}
|
|
25633
|
+
/**
|
|
25634
|
+
* Clean up resources
|
|
25635
|
+
*/
|
|
25636
|
+
destroy(force) {
|
|
25637
|
+
if (this._dataBuffer) {
|
|
25638
|
+
this._dataBuffer.destroy();
|
|
25639
|
+
this._dataBuffer = null;
|
|
25640
|
+
}
|
|
25641
|
+
super.destroy(force);
|
|
25642
|
+
}
|
|
25643
|
+
/**
|
|
25644
|
+
* Update texture content
|
|
25645
|
+
* @param width Texture width
|
|
25646
|
+
* @param height Texture height
|
|
25647
|
+
* @param data Float32Array data (RGBA format: width * height * 4)
|
|
25648
|
+
* @param filtering Whether to use filtering (default: true)
|
|
25649
|
+
* @param startRow Start row for partial update (optional)
|
|
25650
|
+
* @param rowCount Number of rows to update for partial update (optional)
|
|
25651
|
+
*/
|
|
25652
|
+
updateTexture(width, height, data, filtering = true, startRow, rowCount) {
|
|
25653
|
+
let device = webGPUContext.device;
|
|
25654
|
+
const bytesPerRow = width * 4 * 4;
|
|
25655
|
+
this.format = GPUTextureFormat.rgba32float;
|
|
25656
|
+
if (startRow !== void 0 && rowCount !== void 0 && rowCount < height) {
|
|
25657
|
+
const updateHeight = rowCount;
|
|
25658
|
+
const updateOffset = startRow * width * 4;
|
|
25659
|
+
const updateLength = updateHeight * width * 4;
|
|
25660
|
+
const updateData = data.subarray(updateOffset, updateOffset + updateLength);
|
|
25661
|
+
const neededSize2 = updateData.byteLength;
|
|
25662
|
+
if (!this._dataBuffer || this._dataBuffer.size < neededSize2) {
|
|
25663
|
+
this._dataBuffer && this._dataBuffer.destroy();
|
|
25664
|
+
this._dataBuffer = device.createBuffer({
|
|
25665
|
+
size: neededSize2,
|
|
25666
|
+
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC
|
|
25667
|
+
});
|
|
25668
|
+
}
|
|
25669
|
+
device.queue.writeBuffer(
|
|
25670
|
+
this._dataBuffer,
|
|
25671
|
+
0,
|
|
25672
|
+
updateData.buffer,
|
|
25673
|
+
updateData.byteOffset,
|
|
25674
|
+
updateData.byteLength
|
|
25675
|
+
);
|
|
25676
|
+
const commandEncoder2 = GPUContext.beginCommandEncoder();
|
|
25677
|
+
commandEncoder2.copyBufferToTexture(
|
|
25678
|
+
{
|
|
25679
|
+
buffer: this._dataBuffer,
|
|
25680
|
+
bytesPerRow,
|
|
25681
|
+
offset: 0
|
|
25682
|
+
},
|
|
25683
|
+
{
|
|
25684
|
+
texture: this.getGPUTexture(),
|
|
25685
|
+
origin: [0, startRow, 0]
|
|
25686
|
+
// Start at row startRow
|
|
25687
|
+
},
|
|
25688
|
+
{
|
|
25689
|
+
width,
|
|
25690
|
+
height: updateHeight,
|
|
25691
|
+
depthOrArrayLayers: 1
|
|
25692
|
+
}
|
|
25693
|
+
);
|
|
25694
|
+
GPUContext.endCommandEncoder(commandEncoder2);
|
|
25695
|
+
if (filtering) {
|
|
25696
|
+
this.samplerBindingLayout.type = `non-filtering`;
|
|
25697
|
+
this.textureBindingLayout.sampleType = `unfilterable-float`;
|
|
25698
|
+
}
|
|
25699
|
+
return;
|
|
25700
|
+
}
|
|
25701
|
+
const neededSize = data.byteLength;
|
|
25702
|
+
if (!this._dataBuffer || this._dataBuffer.size < neededSize) {
|
|
25703
|
+
this._dataBuffer && this._dataBuffer.destroy();
|
|
25704
|
+
this._dataBuffer = device.createBuffer({
|
|
25705
|
+
size: neededSize,
|
|
25706
|
+
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC
|
|
25707
|
+
});
|
|
25708
|
+
}
|
|
25709
|
+
device.queue.writeBuffer(
|
|
25710
|
+
this._dataBuffer,
|
|
25711
|
+
0,
|
|
25712
|
+
data.buffer,
|
|
25713
|
+
data.byteOffset,
|
|
25714
|
+
data.byteLength
|
|
25715
|
+
);
|
|
25716
|
+
const commandEncoder = GPUContext.beginCommandEncoder();
|
|
25717
|
+
commandEncoder.copyBufferToTexture(
|
|
25718
|
+
{
|
|
25719
|
+
buffer: this._dataBuffer,
|
|
25720
|
+
bytesPerRow
|
|
25721
|
+
},
|
|
25722
|
+
{
|
|
25723
|
+
texture: this.getGPUTexture()
|
|
25724
|
+
},
|
|
25725
|
+
{
|
|
25726
|
+
width,
|
|
25727
|
+
height,
|
|
25728
|
+
depthOrArrayLayers: 1
|
|
25729
|
+
}
|
|
25730
|
+
);
|
|
25731
|
+
GPUContext.endCommandEncoder(commandEncoder);
|
|
25732
|
+
if (filtering) {
|
|
25733
|
+
this.samplerBindingLayout.type = `non-filtering`;
|
|
25734
|
+
this.textureBindingLayout.sampleType = `unfilterable-float`;
|
|
25735
|
+
}
|
|
25736
|
+
this.gpuSampler = device.createSampler({});
|
|
25737
|
+
}
|
|
25622
25738
|
}
|
|
25623
25739
|
|
|
25624
|
-
var __getOwnPropDesc$
|
|
25625
|
-
var __decorateClass$
|
|
25626
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
25740
|
+
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
25741
|
+
var __decorateClass$l = (decorators, target, key, kind) => {
|
|
25742
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
|
|
25627
25743
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
25628
25744
|
if (decorator = decorators[i])
|
|
25629
25745
|
result = (decorator(result)) || result;
|
|
@@ -25644,10 +25760,6 @@ struct InstanceData {
|
|
|
25644
25760
|
}
|
|
25645
25761
|
_colors;
|
|
25646
25762
|
_orderData;
|
|
25647
|
-
_fullCount = 0;
|
|
25648
|
-
get fullCount() {
|
|
25649
|
-
return this._fullCount;
|
|
25650
|
-
}
|
|
25651
25763
|
_batchSize = 128;
|
|
25652
25764
|
instanceCount = 0;
|
|
25653
25765
|
_texturesInitialized = false;
|
|
@@ -25679,7 +25791,6 @@ struct InstanceData {
|
|
|
25679
25791
|
return;
|
|
25680
25792
|
}
|
|
25681
25793
|
this.count = count;
|
|
25682
|
-
this._fullCount = count;
|
|
25683
25794
|
this.size = this.evalTextureSize(count);
|
|
25684
25795
|
this._positions = positions;
|
|
25685
25796
|
this._colors = colors;
|
|
@@ -25934,7 +26045,7 @@ struct InstanceData {
|
|
|
25934
26045
|
super.destroy(force);
|
|
25935
26046
|
}
|
|
25936
26047
|
};
|
|
25937
|
-
exports.PointCloudRenderer = __decorateClass$
|
|
26048
|
+
exports.PointCloudRenderer = __decorateClass$l([
|
|
25938
26049
|
RegisterComponent(exports.PointCloudRenderer, "PointCloudRenderer")
|
|
25939
26050
|
], exports.PointCloudRenderer);
|
|
25940
26051
|
|
|
@@ -25967,7 +26078,7 @@ struct InstanceData {
|
|
|
25967
26078
|
}
|
|
25968
26079
|
for (const pointCloudRenderer of pointCloudRenderers) {
|
|
25969
26080
|
const positions = pointCloudRenderer.positions;
|
|
25970
|
-
const count = pointCloudRenderer.
|
|
26081
|
+
const count = pointCloudRenderer.count;
|
|
25971
26082
|
if (!positions || count === 0) {
|
|
25972
26083
|
console.warn("genPointCloudBounds: No position data available");
|
|
25973
26084
|
continue;
|
|
@@ -26289,9 +26400,9 @@ struct InstanceData {
|
|
|
26289
26400
|
}
|
|
26290
26401
|
}
|
|
26291
26402
|
|
|
26292
|
-
var __getOwnPropDesc$
|
|
26293
|
-
var __decorateClass$
|
|
26294
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
26403
|
+
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
26404
|
+
var __decorateClass$k = (decorators, target, key, kind) => {
|
|
26405
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
|
|
26295
26406
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
26296
26407
|
if (decorator = decorators[i])
|
|
26297
26408
|
result = (decorator(result)) || result;
|
|
@@ -26566,7 +26677,7 @@ struct InstanceData {
|
|
|
26566
26677
|
super.destroy(force);
|
|
26567
26678
|
}
|
|
26568
26679
|
};
|
|
26569
|
-
exports.Object3D = __decorateClass$
|
|
26680
|
+
exports.Object3D = __decorateClass$k([
|
|
26570
26681
|
DecorateObject3D
|
|
26571
26682
|
], exports.Object3D);
|
|
26572
26683
|
function DecorateObject3D(ctor, _) {
|
|
@@ -27952,14 +28063,14 @@ struct InstanceData {
|
|
|
27952
28063
|
}
|
|
27953
28064
|
}
|
|
27954
28065
|
|
|
27955
|
-
var __defProp$
|
|
27956
|
-
var __getOwnPropDesc$
|
|
27957
|
-
var __decorateClass$
|
|
27958
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
28066
|
+
var __defProp$2 = Object.defineProperty;
|
|
28067
|
+
var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
|
|
28068
|
+
var __decorateClass$j = (decorators, target, key, kind) => {
|
|
28069
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
|
|
27959
28070
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
27960
28071
|
if (decorator = decorators[i])
|
|
27961
28072
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
27962
|
-
if (kind && result) __defProp$
|
|
28073
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
27963
28074
|
return result;
|
|
27964
28075
|
};
|
|
27965
28076
|
exports.MeshRenderer = class MeshRenderer extends RenderNode {
|
|
@@ -28068,13 +28179,13 @@ struct InstanceData {
|
|
|
28068
28179
|
super.destroy(force);
|
|
28069
28180
|
}
|
|
28070
28181
|
};
|
|
28071
|
-
__decorateClass$
|
|
28182
|
+
__decorateClass$j([
|
|
28072
28183
|
EditorInspector
|
|
28073
28184
|
], exports.MeshRenderer.prototype, "geometry", 1);
|
|
28074
|
-
__decorateClass$
|
|
28185
|
+
__decorateClass$j([
|
|
28075
28186
|
EditorInspector
|
|
28076
28187
|
], exports.MeshRenderer.prototype, "material", 1);
|
|
28077
|
-
exports.MeshRenderer = __decorateClass$
|
|
28188
|
+
exports.MeshRenderer = __decorateClass$j([
|
|
28078
28189
|
RegisterComponent(exports.MeshRenderer, "MeshRenderer")
|
|
28079
28190
|
], exports.MeshRenderer);
|
|
28080
28191
|
|
|
@@ -28680,9 +28791,9 @@ struct InstanceData {
|
|
|
28680
28791
|
}
|
|
28681
28792
|
}
|
|
28682
28793
|
|
|
28683
|
-
var __getOwnPropDesc$
|
|
28684
|
-
var __decorateClass$
|
|
28685
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
28794
|
+
var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
|
|
28795
|
+
var __decorateClass$i = (decorators, target, key, kind) => {
|
|
28796
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
|
|
28686
28797
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
28687
28798
|
if (decorator = decorators[i])
|
|
28688
28799
|
result = (decorator(result)) || result;
|
|
@@ -28706,7 +28817,7 @@ struct InstanceData {
|
|
|
28706
28817
|
this.setUniformFloat(`height`, 100);
|
|
28707
28818
|
}
|
|
28708
28819
|
};
|
|
28709
|
-
exports.QuadShader = __decorateClass$
|
|
28820
|
+
exports.QuadShader = __decorateClass$i([
|
|
28710
28821
|
RegisterShader(exports.QuadShader, "QuadShader")
|
|
28711
28822
|
], exports.QuadShader);
|
|
28712
28823
|
|
|
@@ -36069,9 +36180,9 @@ else if (typeof exports === 'object')
|
|
|
36069
36180
|
}
|
|
36070
36181
|
}
|
|
36071
36182
|
|
|
36072
|
-
var __getOwnPropDesc$
|
|
36073
|
-
var __decorateClass$
|
|
36074
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
36183
|
+
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
36184
|
+
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
36185
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
|
|
36075
36186
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
36076
36187
|
if (decorator = decorators[i])
|
|
36077
36188
|
result = (decorator(result)) || result;
|
|
@@ -36113,13 +36224,13 @@ else if (typeof exports === 'object')
|
|
|
36113
36224
|
debug() {
|
|
36114
36225
|
}
|
|
36115
36226
|
};
|
|
36116
|
-
exports.DirectLight = __decorateClass$
|
|
36227
|
+
exports.DirectLight = __decorateClass$h([
|
|
36117
36228
|
RegisterComponent(exports.DirectLight, "DirectLight")
|
|
36118
36229
|
], exports.DirectLight);
|
|
36119
36230
|
|
|
36120
|
-
var __getOwnPropDesc$
|
|
36121
|
-
var __decorateClass$
|
|
36122
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
36231
|
+
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
36232
|
+
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
36233
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
36123
36234
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
36124
36235
|
if (decorator = decorators[i])
|
|
36125
36236
|
result = (decorator(result)) || result;
|
|
@@ -36177,13 +36288,13 @@ else if (typeof exports === 'object')
|
|
|
36177
36288
|
debugDraw(show) {
|
|
36178
36289
|
}
|
|
36179
36290
|
};
|
|
36180
|
-
exports.PointLight = __decorateClass$
|
|
36291
|
+
exports.PointLight = __decorateClass$g([
|
|
36181
36292
|
RegisterComponent(exports.PointLight, "PointLight")
|
|
36182
36293
|
], exports.PointLight);
|
|
36183
36294
|
|
|
36184
|
-
var __getOwnPropDesc$
|
|
36185
|
-
var __decorateClass$
|
|
36186
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
36295
|
+
var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
|
|
36296
|
+
var __decorateClass$f = (decorators, target, key, kind) => {
|
|
36297
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
|
|
36187
36298
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
36188
36299
|
if (decorator = decorators[i])
|
|
36189
36300
|
result = (decorator(result)) || result;
|
|
@@ -36248,7 +36359,7 @@ else if (typeof exports === 'object')
|
|
|
36248
36359
|
debugDraw(show) {
|
|
36249
36360
|
}
|
|
36250
36361
|
};
|
|
36251
|
-
exports.SpotLight = __decorateClass$
|
|
36362
|
+
exports.SpotLight = __decorateClass$f([
|
|
36252
36363
|
RegisterComponent(exports.SpotLight, "SpotLight")
|
|
36253
36364
|
], exports.SpotLight);
|
|
36254
36365
|
|
|
@@ -42333,7 +42444,7 @@ else if (typeof exports === 'object')
|
|
|
42333
42444
|
}
|
|
42334
42445
|
}
|
|
42335
42446
|
|
|
42336
|
-
const version = "1.0.
|
|
42447
|
+
const version = "1.0.51";
|
|
42337
42448
|
|
|
42338
42449
|
class Engine3D {
|
|
42339
42450
|
/**
|
|
@@ -46846,9 +46957,9 @@ fn frag(){
|
|
|
46846
46957
|
}
|
|
46847
46958
|
}
|
|
46848
46959
|
|
|
46849
|
-
var __getOwnPropDesc$
|
|
46850
|
-
var __decorateClass$
|
|
46851
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
46960
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
46961
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
46962
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
46852
46963
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
46853
46964
|
if (decorator = decorators[i])
|
|
46854
46965
|
result = (decorator(result)) || result;
|
|
@@ -46872,7 +46983,7 @@ fn frag(){
|
|
|
46872
46983
|
shaderState.depthCompare = GPUCompareFunction.less;
|
|
46873
46984
|
}
|
|
46874
46985
|
};
|
|
46875
|
-
exports.SkyShader = __decorateClass$
|
|
46986
|
+
exports.SkyShader = __decorateClass$e([
|
|
46876
46987
|
RegisterShader(exports.SkyShader, "SkyShader")
|
|
46877
46988
|
], exports.SkyShader);
|
|
46878
46989
|
|
|
@@ -47670,9 +47781,9 @@ fn frag(){
|
|
|
47670
47781
|
}
|
|
47671
47782
|
}
|
|
47672
47783
|
|
|
47673
|
-
var __getOwnPropDesc$
|
|
47674
|
-
var __decorateClass$
|
|
47675
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
47784
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
47785
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
47786
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
47676
47787
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
47677
47788
|
if (decorator = decorators[i])
|
|
47678
47789
|
result = (decorator(result)) || result;
|
|
@@ -47876,7 +47987,7 @@ fn frag(){
|
|
|
47876
47987
|
this._currentClipState.weight = 1;
|
|
47877
47988
|
}
|
|
47878
47989
|
};
|
|
47879
|
-
exports.SkeletonAnimationComponent = __decorateClass$
|
|
47990
|
+
exports.SkeletonAnimationComponent = __decorateClass$d([
|
|
47880
47991
|
RegisterComponent(exports.SkeletonAnimationComponent, "SkeletonAnimationComponent")
|
|
47881
47992
|
], exports.SkeletonAnimationComponent);
|
|
47882
47993
|
class SkeletonAnimationCrossFadeState {
|
|
@@ -47912,9 +48023,9 @@ fn frag(){
|
|
|
47912
48023
|
}
|
|
47913
48024
|
}
|
|
47914
48025
|
|
|
47915
|
-
var __getOwnPropDesc$
|
|
47916
|
-
var __decorateClass$
|
|
47917
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
48026
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
48027
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
48028
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
47918
48029
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
47919
48030
|
if (decorator = decorators[i])
|
|
47920
48031
|
result = (decorator(result)) || result;
|
|
@@ -48325,7 +48436,7 @@ fn frag(){
|
|
|
48325
48436
|
return dst;
|
|
48326
48437
|
}
|
|
48327
48438
|
};
|
|
48328
|
-
exports.AnimatorComponent = __decorateClass$
|
|
48439
|
+
exports.AnimatorComponent = __decorateClass$c([
|
|
48329
48440
|
RegisterComponent(exports.AnimatorComponent, "AnimatorComponent")
|
|
48330
48441
|
], exports.AnimatorComponent);
|
|
48331
48442
|
class PropertyAnimationClipState {
|
|
@@ -49082,9 +49193,9 @@ fn frag(){
|
|
|
49082
49193
|
}
|
|
49083
49194
|
}
|
|
49084
49195
|
|
|
49085
|
-
var __getOwnPropDesc$
|
|
49086
|
-
var __decorateClass$
|
|
49087
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
49196
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
49197
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
49198
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
49088
49199
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
49089
49200
|
if (decorator = decorators[i])
|
|
49090
49201
|
result = (decorator(result)) || result;
|
|
@@ -49233,7 +49344,7 @@ fn frag(){
|
|
|
49233
49344
|
super.nodeUpdate(view, passType, renderPassState, clusterLightingBuffer);
|
|
49234
49345
|
}
|
|
49235
49346
|
};
|
|
49236
|
-
exports.SkinnedMeshRenderer2 = __decorateClass$
|
|
49347
|
+
exports.SkinnedMeshRenderer2 = __decorateClass$b([
|
|
49237
49348
|
RegisterComponent(exports.SkinnedMeshRenderer2, "SkinnedMeshRenderer2")
|
|
49238
49349
|
], exports.SkinnedMeshRenderer2);
|
|
49239
49350
|
|
|
@@ -54366,9 +54477,9 @@ fn frag(){
|
|
|
54366
54477
|
}
|
|
54367
54478
|
}
|
|
54368
54479
|
|
|
54369
|
-
var __getOwnPropDesc$
|
|
54370
|
-
var __decorateClass$
|
|
54371
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
54480
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
54481
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
54482
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
54372
54483
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
54373
54484
|
if (decorator = decorators[i])
|
|
54374
54485
|
result = (decorator(result)) || result;
|
|
@@ -54445,13 +54556,13 @@ fn frag(){
|
|
|
54445
54556
|
debugDraw(show) {
|
|
54446
54557
|
}
|
|
54447
54558
|
};
|
|
54448
|
-
exports.Light = __decorateClass$
|
|
54559
|
+
exports.Light = __decorateClass$a([
|
|
54449
54560
|
RegisterComponent(exports.Light, "Light")
|
|
54450
54561
|
], exports.Light);
|
|
54451
54562
|
|
|
54452
|
-
var __getOwnPropDesc$
|
|
54453
|
-
var __decorateClass$
|
|
54454
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
54563
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
54564
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
54565
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
54455
54566
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
54456
54567
|
if (decorator = decorators[i])
|
|
54457
54568
|
result = (decorator(result)) || result;
|
|
@@ -54526,21 +54637,21 @@ fn frag(){
|
|
|
54526
54637
|
super.destroy(force);
|
|
54527
54638
|
}
|
|
54528
54639
|
};
|
|
54529
|
-
exports.FatLineRenderer = __decorateClass$
|
|
54640
|
+
exports.FatLineRenderer = __decorateClass$9([
|
|
54530
54641
|
RegisterComponent(exports.FatLineRenderer, "FatLineRenderer")
|
|
54531
54642
|
], exports.FatLineRenderer);
|
|
54532
54643
|
|
|
54533
|
-
var __defProp = Object.defineProperty;
|
|
54534
|
-
var __getOwnPropDesc$
|
|
54535
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
54536
|
-
var __decorateClass$
|
|
54537
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
54644
|
+
var __defProp$1 = Object.defineProperty;
|
|
54645
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
54646
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
54647
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
54648
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
54538
54649
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
54539
54650
|
if (decorator = decorators[i])
|
|
54540
54651
|
result = (decorator(result)) || result;
|
|
54541
54652
|
return result;
|
|
54542
54653
|
};
|
|
54543
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
54654
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
|
|
54544
54655
|
exports.GSplatStreamRenderer = class GSplatStreamRenderer extends RenderNode {
|
|
54545
54656
|
// Splat count and texture dimensions
|
|
54546
54657
|
totalCount = 0;
|
|
@@ -55327,8 +55438,8 @@ fn frag(){
|
|
|
55327
55438
|
super.destroy(force);
|
|
55328
55439
|
}
|
|
55329
55440
|
};
|
|
55330
|
-
__publicField(exports.GSplatStreamRenderer, "flushFrameLimit", 60);
|
|
55331
|
-
exports.GSplatStreamRenderer = __decorateClass$
|
|
55441
|
+
__publicField$1(exports.GSplatStreamRenderer, "flushFrameLimit", 60);
|
|
55442
|
+
exports.GSplatStreamRenderer = __decorateClass$8([
|
|
55332
55443
|
RegisterComponent(exports.GSplatStreamRenderer, "GSplatStreamRenderer")
|
|
55333
55444
|
], exports.GSplatStreamRenderer);
|
|
55334
55445
|
|
|
@@ -55630,9 +55741,9 @@ fn frag(){
|
|
|
55630
55741
|
}
|
|
55631
55742
|
}
|
|
55632
55743
|
|
|
55633
|
-
var __getOwnPropDesc$
|
|
55634
|
-
var __decorateClass$
|
|
55635
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
55744
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
55745
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
55746
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
55636
55747
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
55637
55748
|
if (decorator = decorators[i])
|
|
55638
55749
|
result = (decorator(result)) || result;
|
|
@@ -55658,10 +55769,410 @@ fn frag(){
|
|
|
55658
55769
|
}
|
|
55659
55770
|
}
|
|
55660
55771
|
};
|
|
55661
|
-
exports.MeshFilter = __decorateClass$
|
|
55772
|
+
exports.MeshFilter = __decorateClass$7([
|
|
55662
55773
|
RegisterComponent(exports.MeshFilter, "MeshFilter")
|
|
55663
55774
|
], exports.MeshFilter);
|
|
55664
55775
|
|
|
55776
|
+
var __defProp = Object.defineProperty;
|
|
55777
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
55778
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
55779
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
55780
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
55781
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
55782
|
+
if (decorator = decorators[i])
|
|
55783
|
+
result = (decorator(result)) || result;
|
|
55784
|
+
return result;
|
|
55785
|
+
};
|
|
55786
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
55787
|
+
exports.PointCloudStreamRenderer = class PointCloudStreamRenderer extends RenderNode {
|
|
55788
|
+
totalCount = 0;
|
|
55789
|
+
size = new Vector2();
|
|
55790
|
+
pointColor;
|
|
55791
|
+
pointPosition;
|
|
55792
|
+
pointOrder;
|
|
55793
|
+
texParams;
|
|
55794
|
+
// [numPoints, texWidth, validCount, pointSize]
|
|
55795
|
+
_texParamDirty = true;
|
|
55796
|
+
pointCloudMaterial;
|
|
55797
|
+
_colorData;
|
|
55798
|
+
// RGBA8: size.x * size.y * 4
|
|
55799
|
+
_positionData;
|
|
55800
|
+
// RGBA32Float: size.x * size.y * 4 (XYZ in RGB, A unused)
|
|
55801
|
+
_orderData;
|
|
55802
|
+
// R32U: size.x * size.y
|
|
55803
|
+
_pointSetFlags;
|
|
55804
|
+
// Track which indices have data
|
|
55805
|
+
_validCount = 0;
|
|
55806
|
+
// Number of points with valid data
|
|
55807
|
+
_batchSize = 128;
|
|
55808
|
+
instanceCount = 0;
|
|
55809
|
+
_pendingUpdates = /* @__PURE__ */ new Set();
|
|
55810
|
+
// Indices pending GPU update
|
|
55811
|
+
_autoFlushThreshold = 100;
|
|
55812
|
+
// Auto-flush when this many updates pending
|
|
55813
|
+
_frameCount = 0;
|
|
55814
|
+
_centerOffset = new Vector3();
|
|
55815
|
+
get centerOffset() {
|
|
55816
|
+
return this._centerOffset;
|
|
55817
|
+
}
|
|
55818
|
+
_texturesInitialized = false;
|
|
55819
|
+
_debugFullScreen = false;
|
|
55820
|
+
constructor() {
|
|
55821
|
+
super();
|
|
55822
|
+
}
|
|
55823
|
+
/**
|
|
55824
|
+
* Initialize renderer with total point count
|
|
55825
|
+
* Pre-allocates all GPU resources with zero-initialized data
|
|
55826
|
+
* @param totalCount Total number of points that will be streamed
|
|
55827
|
+
* @param batchSize Points per draw call (default: 128)
|
|
55828
|
+
*/
|
|
55829
|
+
initCount(totalCount, batchSize = 128) {
|
|
55830
|
+
if (totalCount <= 0) {
|
|
55831
|
+
throw new Error("Total count must be greater than 0");
|
|
55832
|
+
}
|
|
55833
|
+
this.totalCount = totalCount;
|
|
55834
|
+
this._batchSize = batchSize;
|
|
55835
|
+
this.size = this.evalTextureSize(totalCount);
|
|
55836
|
+
const w = this.size.x | 0;
|
|
55837
|
+
const h = this.size.y | 0;
|
|
55838
|
+
const total = w * h;
|
|
55839
|
+
this._colorData = new Uint8Array(total * 4);
|
|
55840
|
+
for (let i = 0; i < total; i++) {
|
|
55841
|
+
const idx = i * 4;
|
|
55842
|
+
this._colorData[idx + 0] = 255;
|
|
55843
|
+
this._colorData[idx + 1] = 255;
|
|
55844
|
+
this._colorData[idx + 2] = 255;
|
|
55845
|
+
this._colorData[idx + 3] = 255;
|
|
55846
|
+
}
|
|
55847
|
+
this._positionData = new Float32Array(total * 4);
|
|
55848
|
+
this._positionData.fill(0);
|
|
55849
|
+
this._orderData = new Uint32Array(total);
|
|
55850
|
+
for (let i = 0; i < total; i++) {
|
|
55851
|
+
this._orderData[i] = i < totalCount ? i : totalCount > 0 ? totalCount - 1 : 0;
|
|
55852
|
+
}
|
|
55853
|
+
this._pointSetFlags = new Array(totalCount).fill(false);
|
|
55854
|
+
this._validCount = 0;
|
|
55855
|
+
this.texParams = new Float32Array([
|
|
55856
|
+
this._validCount,
|
|
55857
|
+
this.size.x,
|
|
55858
|
+
this._validCount,
|
|
55859
|
+
4
|
|
55860
|
+
]);
|
|
55861
|
+
this.pointColor = new Uint8ArrayTexture().create(w, h, this._colorData, false);
|
|
55862
|
+
this.pointColor.name = "pointColor";
|
|
55863
|
+
this.pointColor.minFilter = "nearest";
|
|
55864
|
+
this.pointColor.magFilter = "nearest";
|
|
55865
|
+
this.pointColor.mipmapFilter = "nearest";
|
|
55866
|
+
this.pointColor.addressModeU = "clamp-to-edge";
|
|
55867
|
+
this.pointColor.addressModeV = "clamp-to-edge";
|
|
55868
|
+
this.pointPosition = new Float32ArrayTexture().create(w, h, this._positionData);
|
|
55869
|
+
this.pointPosition.name = "pointPosition";
|
|
55870
|
+
this.pointPosition.minFilter = "nearest";
|
|
55871
|
+
this.pointPosition.magFilter = "nearest";
|
|
55872
|
+
this.pointPosition.addressModeU = "clamp-to-edge";
|
|
55873
|
+
this.pointPosition.addressModeV = "clamp-to-edge";
|
|
55874
|
+
this.pointOrder = new R32UintTexture().create(w, h, this._orderData);
|
|
55875
|
+
this.pointOrder.name = "pointOrder";
|
|
55876
|
+
this.pointOrder.minFilter = "nearest";
|
|
55877
|
+
this.pointOrder.magFilter = "nearest";
|
|
55878
|
+
this.pointOrder.addressModeU = "clamp-to-edge";
|
|
55879
|
+
this.pointOrder.addressModeV = "clamp-to-edge";
|
|
55880
|
+
this.pointCloudMaterial = new PointCloudMaterial();
|
|
55881
|
+
this.geometry = new PointCloudGeometry(this._batchSize);
|
|
55882
|
+
this.materials = [this.pointCloudMaterial];
|
|
55883
|
+
this.instanceCount = 0;
|
|
55884
|
+
this._centerOffset.set(0, 0, 0);
|
|
55885
|
+
}
|
|
55886
|
+
/**
|
|
55887
|
+
* Set data for a single point at the given index
|
|
55888
|
+
* Updates CPU buffers and marks for GPU update
|
|
55889
|
+
* @param index Point index (0 to count-1)
|
|
55890
|
+
* @param data Point data (position is required, color optional)
|
|
55891
|
+
*/
|
|
55892
|
+
setPointCloudData(index, data) {
|
|
55893
|
+
if (index < 0 || index >= this.totalCount) {
|
|
55894
|
+
throw new Error(`Index ${index} out of range [0, ${this.totalCount})`);
|
|
55895
|
+
}
|
|
55896
|
+
const wasSet = this._pointSetFlags[index];
|
|
55897
|
+
const posIdx = index * 4;
|
|
55898
|
+
this._positionData[posIdx + 0] = data.position[0];
|
|
55899
|
+
this._positionData[posIdx + 1] = data.position[1];
|
|
55900
|
+
this._positionData[posIdx + 2] = data.position[2];
|
|
55901
|
+
this._positionData[posIdx + 3] = 0;
|
|
55902
|
+
const colorIdx = index * 4;
|
|
55903
|
+
if (data.color) {
|
|
55904
|
+
this._colorData[colorIdx + 0] = Math.max(0, Math.min(255, data.color[0]));
|
|
55905
|
+
this._colorData[colorIdx + 1] = Math.max(0, Math.min(255, data.color[1]));
|
|
55906
|
+
this._colorData[colorIdx + 2] = Math.max(0, Math.min(255, data.color[2]));
|
|
55907
|
+
this._colorData[colorIdx + 3] = Math.max(0, Math.min(255, data.color[3] !== void 0 ? data.color[3] : 255));
|
|
55908
|
+
} else {
|
|
55909
|
+
this._colorData[colorIdx + 0] = 255;
|
|
55910
|
+
this._colorData[colorIdx + 1] = 255;
|
|
55911
|
+
this._colorData[colorIdx + 2] = 255;
|
|
55912
|
+
this._colorData[colorIdx + 3] = 255;
|
|
55913
|
+
}
|
|
55914
|
+
if (!wasSet) {
|
|
55915
|
+
this._pointSetFlags[index] = true;
|
|
55916
|
+
this._validCount++;
|
|
55917
|
+
}
|
|
55918
|
+
this._pendingUpdates.add(index);
|
|
55919
|
+
}
|
|
55920
|
+
/**
|
|
55921
|
+
* Update center offset for precision (called when new points are added)
|
|
55922
|
+
*/
|
|
55923
|
+
_updateCenterOffset() {
|
|
55924
|
+
if (this._validCount === 0) return;
|
|
55925
|
+
let sumX = 0, sumY = 0, sumZ = 0;
|
|
55926
|
+
let count = 0;
|
|
55927
|
+
for (let i = 0; i < this.totalCount; i++) {
|
|
55928
|
+
if (this._pointSetFlags[i]) {
|
|
55929
|
+
const idx = i * 4;
|
|
55930
|
+
sumX += this._positionData[idx + 0];
|
|
55931
|
+
sumY += this._positionData[idx + 1];
|
|
55932
|
+
sumZ += this._positionData[idx + 2];
|
|
55933
|
+
count++;
|
|
55934
|
+
}
|
|
55935
|
+
}
|
|
55936
|
+
if (count > 0) {
|
|
55937
|
+
const centerX = sumX / count;
|
|
55938
|
+
const centerY = sumY / count;
|
|
55939
|
+
const centerZ = sumZ / count;
|
|
55940
|
+
this._centerOffset.set(centerX, centerY, centerZ);
|
|
55941
|
+
this.object3D.localPosition = this._centerOffset;
|
|
55942
|
+
}
|
|
55943
|
+
}
|
|
55944
|
+
/**
|
|
55945
|
+
* Flush pending updates to GPU
|
|
55946
|
+
* Updates GPU textures with all pending changes
|
|
55947
|
+
* Uses partial updates when possible for better performance
|
|
55948
|
+
*/
|
|
55949
|
+
flushUpdates() {
|
|
55950
|
+
if (this._pendingUpdates.size === 0) return;
|
|
55951
|
+
const w = this.size.x | 0;
|
|
55952
|
+
const h = this.size.y | 0;
|
|
55953
|
+
const pendingIndices = Array.from(this._pendingUpdates);
|
|
55954
|
+
if (pendingIndices.length === 0) return;
|
|
55955
|
+
let minRow = h;
|
|
55956
|
+
let maxRow = 0;
|
|
55957
|
+
for (const index of pendingIndices) {
|
|
55958
|
+
const row = Math.floor(index / w);
|
|
55959
|
+
if (row < minRow) minRow = row;
|
|
55960
|
+
if (row > maxRow) maxRow = row;
|
|
55961
|
+
}
|
|
55962
|
+
const rowCount = maxRow - minRow + 1;
|
|
55963
|
+
const updateRatio = rowCount / h;
|
|
55964
|
+
const total = w * h;
|
|
55965
|
+
if (this.totalCount < total) {
|
|
55966
|
+
const lastIdx = (this.totalCount - 1) * 4;
|
|
55967
|
+
for (let i = this.totalCount; i < total; i++) {
|
|
55968
|
+
const idx = i * 4;
|
|
55969
|
+
this._positionData[idx + 0] = this._positionData[lastIdx + 0];
|
|
55970
|
+
this._positionData[idx + 1] = this._positionData[lastIdx + 1];
|
|
55971
|
+
this._positionData[idx + 2] = this._positionData[lastIdx + 2];
|
|
55972
|
+
this._positionData[idx + 3] = 0;
|
|
55973
|
+
}
|
|
55974
|
+
}
|
|
55975
|
+
if (updateRatio < 0.5 && rowCount < h) {
|
|
55976
|
+
const rowStartIdx = minRow * w;
|
|
55977
|
+
const rowEndIdx = (maxRow + 1) * w;
|
|
55978
|
+
const partialPositionData = this._positionData.subarray(
|
|
55979
|
+
rowStartIdx * 4,
|
|
55980
|
+
rowEndIdx * 4
|
|
55981
|
+
);
|
|
55982
|
+
this.pointColor.updateTexture(w, h, this._colorData, minRow, rowCount);
|
|
55983
|
+
this.pointPosition.updateTexture(w, h, partialPositionData, false, minRow, rowCount);
|
|
55984
|
+
} else {
|
|
55985
|
+
this.pointColor.updateTexture(w, h, this._colorData);
|
|
55986
|
+
this.pointPosition.updateTexture(w, h, this._positionData, false);
|
|
55987
|
+
}
|
|
55988
|
+
const renderCount = this._validCount;
|
|
55989
|
+
this.instanceCount = Math.ceil(renderCount / this._batchSize);
|
|
55990
|
+
this.texParams[0] = renderCount;
|
|
55991
|
+
this.texParams[2] = renderCount;
|
|
55992
|
+
this._texParamDirty = true;
|
|
55993
|
+
this._pendingUpdates.clear();
|
|
55994
|
+
}
|
|
55995
|
+
/**
|
|
55996
|
+
* Set auto-flush threshold
|
|
55997
|
+
* @param threshold Number of pending updates before auto-flush (default: 100)
|
|
55998
|
+
*/
|
|
55999
|
+
setAutoFlushThreshold(threshold) {
|
|
56000
|
+
this._autoFlushThreshold = Math.max(1, threshold);
|
|
56001
|
+
}
|
|
56002
|
+
/**
|
|
56003
|
+
* Get current streaming statistics
|
|
56004
|
+
*/
|
|
56005
|
+
getStreamingStats() {
|
|
56006
|
+
return {
|
|
56007
|
+
totalCount: this.totalCount,
|
|
56008
|
+
validCount: this._validCount,
|
|
56009
|
+
pendingUpdates: this._pendingUpdates.size,
|
|
56010
|
+
progress: this.totalCount > 0 ? this._validCount / this.totalCount * 100 : 0
|
|
56011
|
+
};
|
|
56012
|
+
}
|
|
56013
|
+
/**
|
|
56014
|
+
* Calculate texture size for given point count
|
|
56015
|
+
* @param count Number of points
|
|
56016
|
+
* @returns Texture dimensions (width, height)
|
|
56017
|
+
*/
|
|
56018
|
+
evalTextureSize(count) {
|
|
56019
|
+
let w = Math.ceil(Math.sqrt(count));
|
|
56020
|
+
const align = 64;
|
|
56021
|
+
w = Math.ceil(w / align) * align;
|
|
56022
|
+
const h = Math.ceil(count / w);
|
|
56023
|
+
return new Vector2(w, h);
|
|
56024
|
+
}
|
|
56025
|
+
/**
|
|
56026
|
+
* Update node before rendering
|
|
56027
|
+
*/
|
|
56028
|
+
nodeUpdate(view, passType, renderPassState, clusterLightingBuffer) {
|
|
56029
|
+
if (this._pendingUpdates.size > 0 && this._frameCount >= exports.PointCloudStreamRenderer.flushFrameLimit) {
|
|
56030
|
+
this.flushUpdates();
|
|
56031
|
+
}
|
|
56032
|
+
if (this._frameCount >= exports.PointCloudStreamRenderer.flushFrameLimit && this._pendingUpdates.size === 0) {
|
|
56033
|
+
this._frameCount = 0;
|
|
56034
|
+
}
|
|
56035
|
+
this._frameCount++;
|
|
56036
|
+
const worldMatrix = this.object3D.transform.worldMatrix;
|
|
56037
|
+
this.pointCloudMaterial.setTransformMatrix(worldMatrix);
|
|
56038
|
+
if (!this._texturesInitialized) {
|
|
56039
|
+
this.pointCloudMaterial.setPointTextures(
|
|
56040
|
+
this.pointPosition,
|
|
56041
|
+
this.pointColor,
|
|
56042
|
+
this.texParams,
|
|
56043
|
+
this.pointOrder
|
|
56044
|
+
);
|
|
56045
|
+
this.pointCloudMaterial.setBatchSize(this._batchSize);
|
|
56046
|
+
this.pointCloudMaterial.setPointSize(this.texParams[3]);
|
|
56047
|
+
this.pointCloudMaterial.enableDebugFullScreen(this._debugFullScreen);
|
|
56048
|
+
this._texturesInitialized = true;
|
|
56049
|
+
}
|
|
56050
|
+
if (this._texParamDirty) {
|
|
56051
|
+
this.pointCloudMaterial.setPointTextures(
|
|
56052
|
+
this.pointPosition,
|
|
56053
|
+
this.pointColor,
|
|
56054
|
+
this.texParams,
|
|
56055
|
+
this.pointOrder
|
|
56056
|
+
);
|
|
56057
|
+
this._texParamDirty = false;
|
|
56058
|
+
}
|
|
56059
|
+
super.nodeUpdate(view, passType, renderPassState, clusterLightingBuffer);
|
|
56060
|
+
}
|
|
56061
|
+
/**
|
|
56062
|
+
* Render pass
|
|
56063
|
+
*/
|
|
56064
|
+
renderPass(view, passType, renderContext) {
|
|
56065
|
+
const encoder = renderContext.encoder;
|
|
56066
|
+
for (let mat of this.materials) {
|
|
56067
|
+
const passes = mat.getPass(passType);
|
|
56068
|
+
if (!passes || passes.length === 0) continue;
|
|
56069
|
+
for (const pass of passes) {
|
|
56070
|
+
if (!pass.pipeline) continue;
|
|
56071
|
+
pass.apply(this.geometry, renderContext.rendererPassState || renderContext);
|
|
56072
|
+
GPUContext.bindPipeline(encoder, pass);
|
|
56073
|
+
GPUContext.bindGeometryBuffer(encoder, this.geometry);
|
|
56074
|
+
const subGeometry = this.geometry.subGeometries[0];
|
|
56075
|
+
const lodInfo = subGeometry.lodLevels[0];
|
|
56076
|
+
if (this.instanceCount > 0) {
|
|
56077
|
+
GPUContext.drawIndexed(
|
|
56078
|
+
encoder,
|
|
56079
|
+
lodInfo.indexCount,
|
|
56080
|
+
this.instanceCount,
|
|
56081
|
+
lodInfo.indexStart,
|
|
56082
|
+
0,
|
|
56083
|
+
0
|
|
56084
|
+
);
|
|
56085
|
+
} else {
|
|
56086
|
+
GPUContext.drawIndexed(
|
|
56087
|
+
encoder,
|
|
56088
|
+
lodInfo.indexCount,
|
|
56089
|
+
1,
|
|
56090
|
+
lodInfo.indexStart,
|
|
56091
|
+
0,
|
|
56092
|
+
0
|
|
56093
|
+
);
|
|
56094
|
+
}
|
|
56095
|
+
}
|
|
56096
|
+
}
|
|
56097
|
+
}
|
|
56098
|
+
/**
|
|
56099
|
+
* Set point size in pixels
|
|
56100
|
+
* @param size Point size in pixels
|
|
56101
|
+
*/
|
|
56102
|
+
setPointSize(size) {
|
|
56103
|
+
this.texParams[3] = Math.max(0.1, size);
|
|
56104
|
+
if (this.pointCloudMaterial) {
|
|
56105
|
+
this.pointCloudMaterial.setPointSize(size);
|
|
56106
|
+
}
|
|
56107
|
+
}
|
|
56108
|
+
/**
|
|
56109
|
+
* Set point shape
|
|
56110
|
+
* @param shape 'square' or 'circle'
|
|
56111
|
+
*/
|
|
56112
|
+
setPointShape(shape) {
|
|
56113
|
+
if (this.pointCloudMaterial) {
|
|
56114
|
+
this.pointCloudMaterial.setPointShape(shape);
|
|
56115
|
+
}
|
|
56116
|
+
}
|
|
56117
|
+
/**
|
|
56118
|
+
* Enable a fullscreen debug quad to validate the render pipeline.
|
|
56119
|
+
*/
|
|
56120
|
+
enableDebugFullScreen(enabled) {
|
|
56121
|
+
this._debugFullScreen = enabled;
|
|
56122
|
+
if (this.pointCloudMaterial) {
|
|
56123
|
+
this.pointCloudMaterial.enableDebugFullScreen(enabled);
|
|
56124
|
+
}
|
|
56125
|
+
}
|
|
56126
|
+
/**
|
|
56127
|
+
* Set batch size for instanced rendering
|
|
56128
|
+
* @param batchSize Number of points per draw call
|
|
56129
|
+
*/
|
|
56130
|
+
setBatchSize(batchSize) {
|
|
56131
|
+
this._batchSize = Math.max(1, batchSize | 0);
|
|
56132
|
+
if (this.geometry) {
|
|
56133
|
+
const oldGeometry = this.geometry;
|
|
56134
|
+
Reference.getInstance().detached(oldGeometry, this);
|
|
56135
|
+
if (!Reference.getInstance().hasReference(oldGeometry)) {
|
|
56136
|
+
oldGeometry.destroy();
|
|
56137
|
+
}
|
|
56138
|
+
this.geometry = new PointCloudGeometry(this._batchSize);
|
|
56139
|
+
}
|
|
56140
|
+
if (this.pointCloudMaterial) {
|
|
56141
|
+
this.pointCloudMaterial.setBatchSize(this._batchSize);
|
|
56142
|
+
this.pointCloudMaterial.enableDebugFullScreen(this._debugFullScreen);
|
|
56143
|
+
}
|
|
56144
|
+
this.instanceCount = Math.ceil(this._validCount / this._batchSize);
|
|
56145
|
+
}
|
|
56146
|
+
/**
|
|
56147
|
+
* Clean up resources
|
|
56148
|
+
*/
|
|
56149
|
+
destroy(force) {
|
|
56150
|
+
if (this.pointColor) {
|
|
56151
|
+
this.pointColor.destroy(force);
|
|
56152
|
+
this.pointColor = null;
|
|
56153
|
+
}
|
|
56154
|
+
if (this.pointPosition) {
|
|
56155
|
+
this.pointPosition.destroy(force);
|
|
56156
|
+
this.pointPosition = null;
|
|
56157
|
+
}
|
|
56158
|
+
if (this.pointOrder) {
|
|
56159
|
+
this.pointOrder.destroy(force);
|
|
56160
|
+
this.pointOrder = null;
|
|
56161
|
+
}
|
|
56162
|
+
this._positionData = null;
|
|
56163
|
+
this._colorData = null;
|
|
56164
|
+
this._orderData = null;
|
|
56165
|
+
this.texParams = null;
|
|
56166
|
+
this._pointSetFlags = null;
|
|
56167
|
+
this._pendingUpdates.clear();
|
|
56168
|
+
super.destroy(force);
|
|
56169
|
+
}
|
|
56170
|
+
};
|
|
56171
|
+
__publicField(exports.PointCloudStreamRenderer, "flushFrameLimit", 60);
|
|
56172
|
+
exports.PointCloudStreamRenderer = __decorateClass$6([
|
|
56173
|
+
RegisterComponent(exports.PointCloudStreamRenderer, "PointCloudStreamRenderer")
|
|
56174
|
+
], exports.PointCloudStreamRenderer);
|
|
56175
|
+
|
|
55665
56176
|
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
55666
56177
|
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
55667
56178
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
@@ -62562,7 +63073,7 @@ fn frag(){
|
|
|
62562
63073
|
_streamParser = null;
|
|
62563
63074
|
_streamingRenderer = null;
|
|
62564
63075
|
_rendererObject = null;
|
|
62565
|
-
_chunksPerBatch =
|
|
63076
|
+
_chunksPerBatch = 1e4;
|
|
62566
63077
|
// Number of splats to process per batch
|
|
62567
63078
|
_headerParsed = false;
|
|
62568
63079
|
_onHeaderParsed = null;
|