@rings-webgpu/core 1.0.47 → 1.0.49
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 +160 -160
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +72 -8
- package/dist/rings.umd.js +164 -164
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +72 -8
- package/dist/types/loader/parser/ply/PlyStreamParser.d.ts +13 -0
- package/package.json +1 -1
package/dist/rings.umd.max.js
CHANGED
|
@@ -42333,7 +42333,7 @@ else if (typeof exports === 'object')
|
|
|
42333
42333
|
}
|
|
42334
42334
|
}
|
|
42335
42335
|
|
|
42336
|
-
const version = "1.0.
|
|
42336
|
+
const version = "1.0.49";
|
|
42337
42337
|
|
|
42338
42338
|
class Engine3D {
|
|
42339
42339
|
/**
|
|
@@ -62167,6 +62167,13 @@ fn frag(){
|
|
|
62167
62167
|
_onSplatParsed = null;
|
|
62168
62168
|
_batchSize = 1e3;
|
|
62169
62169
|
_cancelled = false;
|
|
62170
|
+
// Async processing state
|
|
62171
|
+
_parseTimeoutId = null;
|
|
62172
|
+
static sVerticesPerChunk = 1e7;
|
|
62173
|
+
// Number of vertices to process per chunk
|
|
62174
|
+
static sMaxProcessingTime = 5;
|
|
62175
|
+
// Maximum processing time per chunk (ms) to avoid blocking
|
|
62176
|
+
_useIdleCallback = typeof requestIdleCallback !== "undefined";
|
|
62170
62177
|
constructor(onHeaderParsed, onSplatParsed, batchSize = 1e3) {
|
|
62171
62178
|
this._onHeaderParsed = onHeaderParsed;
|
|
62172
62179
|
this._onSplatParsed = onSplatParsed;
|
|
@@ -62189,6 +62196,14 @@ fn frag(){
|
|
|
62189
62196
|
*/
|
|
62190
62197
|
cancel() {
|
|
62191
62198
|
this._cancelled = true;
|
|
62199
|
+
if (this._parseTimeoutId !== null) {
|
|
62200
|
+
if (this._useIdleCallback) {
|
|
62201
|
+
cancelIdleCallback(this._parseTimeoutId);
|
|
62202
|
+
} else {
|
|
62203
|
+
clearTimeout(this._parseTimeoutId);
|
|
62204
|
+
}
|
|
62205
|
+
this._parseTimeoutId = null;
|
|
62206
|
+
}
|
|
62192
62207
|
}
|
|
62193
62208
|
/**
|
|
62194
62209
|
* Check if parsing is cancelled
|
|
@@ -62357,21 +62372,35 @@ fn frag(){
|
|
|
62357
62372
|
}
|
|
62358
62373
|
/**
|
|
62359
62374
|
* Parse vertices from current data buffer
|
|
62375
|
+
* Entry point - checks if async processing is already scheduled
|
|
62360
62376
|
*/
|
|
62361
62377
|
_parseVertices() {
|
|
62362
62378
|
if (!this._header || !this._dataBuffer) return;
|
|
62379
|
+
if (this._parseTimeoutId !== null) {
|
|
62380
|
+
return;
|
|
62381
|
+
}
|
|
62382
|
+
this._parseVerticesChunk();
|
|
62383
|
+
}
|
|
62384
|
+
/**
|
|
62385
|
+
* Parse a chunk of vertices with time and count limits
|
|
62386
|
+
*/
|
|
62387
|
+
_parseVerticesChunk() {
|
|
62388
|
+
if (!this._header || !this._dataBuffer || this._cancelled) {
|
|
62389
|
+
this._parseTimeoutId = null;
|
|
62390
|
+
return;
|
|
62391
|
+
}
|
|
62363
62392
|
const payload = new DataView(this._dataBuffer.buffer, this._dataBuffer.byteOffset, this._dataBuffer.byteLength);
|
|
62364
62393
|
const vertexCount = this._header.vertexCount;
|
|
62365
62394
|
const has = (n) => this._properties.find((p) => p.name === n) != null;
|
|
62366
62395
|
const propIndex = (n) => this._properties.findIndex((p) => p.name === n);
|
|
62396
|
+
const startTime = performance.now();
|
|
62397
|
+
let processedInThisChunk = 0;
|
|
62367
62398
|
while (this._processedVertices < vertexCount && !this._cancelled) {
|
|
62368
62399
|
const v = this._processedVertices;
|
|
62369
62400
|
const vOffset = v * this._vertexStride;
|
|
62370
62401
|
if (vOffset + this._vertexStride > this._dataOffset) {
|
|
62371
|
-
|
|
62372
|
-
|
|
62373
|
-
if (this._cancelled) {
|
|
62374
|
-
break;
|
|
62402
|
+
this._parseTimeoutId = null;
|
|
62403
|
+
return;
|
|
62375
62404
|
}
|
|
62376
62405
|
const ix = propIndex("x");
|
|
62377
62406
|
const iy = propIndex("y");
|
|
@@ -62437,12 +62466,47 @@ fn frag(){
|
|
|
62437
62466
|
this._onSplatParsed(splatData, v);
|
|
62438
62467
|
}
|
|
62439
62468
|
this._processedVertices++;
|
|
62469
|
+
processedInThisChunk++;
|
|
62440
62470
|
if (this._processedVertices % this._batchSize === 0) {
|
|
62441
|
-
|
|
62442
|
-
this._parseVertices();
|
|
62443
|
-
}, 0);
|
|
62471
|
+
this._scheduleNextChunk();
|
|
62444
62472
|
return;
|
|
62445
62473
|
}
|
|
62474
|
+
if (processedInThisChunk >= PlyStreamParser.sVerticesPerChunk) {
|
|
62475
|
+
const elapsed = performance.now() - startTime;
|
|
62476
|
+
if (elapsed > PlyStreamParser.sMaxProcessingTime) {
|
|
62477
|
+
this._scheduleNextChunk();
|
|
62478
|
+
return;
|
|
62479
|
+
}
|
|
62480
|
+
processedInThisChunk = 0;
|
|
62481
|
+
}
|
|
62482
|
+
}
|
|
62483
|
+
this._parseTimeoutId = null;
|
|
62484
|
+
}
|
|
62485
|
+
/**
|
|
62486
|
+
* Schedule next chunk of vertex processing
|
|
62487
|
+
*/
|
|
62488
|
+
_scheduleNextChunk() {
|
|
62489
|
+
if (this._cancelled) {
|
|
62490
|
+
this._parseTimeoutId = null;
|
|
62491
|
+
return;
|
|
62492
|
+
}
|
|
62493
|
+
if (this._useIdleCallback) {
|
|
62494
|
+
this._parseTimeoutId = requestIdleCallback((deadline) => {
|
|
62495
|
+
this._parseTimeoutId = null;
|
|
62496
|
+
if (!this._cancelled && deadline.timeRemaining() > 0) {
|
|
62497
|
+
this._parseVerticesChunk();
|
|
62498
|
+
} else if (!this._cancelled) {
|
|
62499
|
+
this._parseTimeoutId = setTimeout(() => {
|
|
62500
|
+
this._parseTimeoutId = null;
|
|
62501
|
+
this._parseVerticesChunk();
|
|
62502
|
+
}, 0);
|
|
62503
|
+
}
|
|
62504
|
+
}, { timeout: 100 });
|
|
62505
|
+
} else {
|
|
62506
|
+
this._parseTimeoutId = setTimeout(() => {
|
|
62507
|
+
this._parseTimeoutId = null;
|
|
62508
|
+
this._parseVerticesChunk();
|
|
62509
|
+
}, 0);
|
|
62446
62510
|
}
|
|
62447
62511
|
}
|
|
62448
62512
|
/**
|
|
@@ -21,6 +21,10 @@ export declare class PlyStreamParser {
|
|
|
21
21
|
private _onSplatParsed;
|
|
22
22
|
private _batchSize;
|
|
23
23
|
private _cancelled;
|
|
24
|
+
private _parseTimeoutId;
|
|
25
|
+
static sVerticesPerChunk: number;
|
|
26
|
+
static sMaxProcessingTime: number;
|
|
27
|
+
private _useIdleCallback;
|
|
24
28
|
constructor(onHeaderParsed: (header: PlyHeader) => void, onSplatParsed: (splatData: SplatData, index: number) => void, batchSize?: number);
|
|
25
29
|
/**
|
|
26
30
|
* Process incoming data chunk
|
|
@@ -53,8 +57,17 @@ export declare class PlyStreamParser {
|
|
|
53
57
|
private _processDataChunk;
|
|
54
58
|
/**
|
|
55
59
|
* Parse vertices from current data buffer
|
|
60
|
+
* Entry point - checks if async processing is already scheduled
|
|
56
61
|
*/
|
|
57
62
|
private _parseVertices;
|
|
63
|
+
/**
|
|
64
|
+
* Parse a chunk of vertices with time and count limits
|
|
65
|
+
*/
|
|
66
|
+
private _parseVerticesChunk;
|
|
67
|
+
/**
|
|
68
|
+
* Schedule next chunk of vertex processing
|
|
69
|
+
*/
|
|
70
|
+
private _scheduleNextChunk;
|
|
58
71
|
/**
|
|
59
72
|
* Get current parsing progress
|
|
60
73
|
*/
|