@openheart/tavio-renderer 2.3.23-with-wasm → 2.3.25-with-wasm
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/build/esm/index.js
CHANGED
|
@@ -38616,6 +38616,8 @@ class TavioMesh extends EventEmitter {
|
|
|
38616
38616
|
// 現在のパース済み 3DGS のデータ
|
|
38617
38617
|
gaussianIndexMap;
|
|
38618
38618
|
// 3DGS のソート後のインデックス
|
|
38619
|
+
latestIndexMap;
|
|
38620
|
+
// 重複更新を避けるため直前の設定内容を保持
|
|
38619
38621
|
sortMap;
|
|
38620
38622
|
// ソート処理中かどうかのフラグ
|
|
38621
38623
|
defaultRenderViewSymbol;
|
|
@@ -38788,6 +38790,7 @@ class TavioMesh extends EventEmitter {
|
|
|
38788
38790
|
this.maxDistance = 0;
|
|
38789
38791
|
this.mainProperties = null;
|
|
38790
38792
|
this.gaussianIndexMap = /* @__PURE__ */ new Map();
|
|
38793
|
+
this.latestIndexMap = /* @__PURE__ */ new Map();
|
|
38791
38794
|
this.sortMap = /* @__PURE__ */ new Map();
|
|
38792
38795
|
const defineValue = material?.defines[SPHERICAL_HARMONICS_DEGREES_DEFINE];
|
|
38793
38796
|
this.currentDegrees = defineValue ?? 3;
|
|
@@ -38854,7 +38857,7 @@ class TavioMesh extends EventEmitter {
|
|
|
38854
38857
|
let currentProperty = 0;
|
|
38855
38858
|
let chunkHeader = [];
|
|
38856
38859
|
let inProgress = false;
|
|
38857
|
-
let
|
|
38860
|
+
let hasPending = false;
|
|
38858
38861
|
const index = this.sourceProperty.length;
|
|
38859
38862
|
const isFirst = index === 0;
|
|
38860
38863
|
if (isFirst !== true) {
|
|
@@ -39300,12 +39303,11 @@ class TavioMesh extends EventEmitter {
|
|
|
39300
39303
|
break;
|
|
39301
39304
|
}
|
|
39302
39305
|
++currentProperty;
|
|
39303
|
-
if (currentProperty === chunkHeader[currentChunk].propertyCount
|
|
39306
|
+
if (currentProperty === chunkHeader[currentChunk].propertyCount) {
|
|
39307
|
+
++currentChunk;
|
|
39304
39308
|
this.worker.postMessage({
|
|
39305
39309
|
properties: mainProperties
|
|
39306
39310
|
});
|
|
39307
|
-
} else if (currentProperty === chunkHeader[currentChunk].propertyCount) {
|
|
39308
|
-
++currentChunk;
|
|
39309
39311
|
this.worker.postMessage({
|
|
39310
39312
|
shProperty: mainProperties.shN
|
|
39311
39313
|
});
|
|
@@ -39323,10 +39325,11 @@ class TavioMesh extends EventEmitter {
|
|
|
39323
39325
|
throw new Error("invalid binary of background");
|
|
39324
39326
|
}
|
|
39325
39327
|
const createJpeg = (buffer, start, length, previewImage = false) => {
|
|
39326
|
-
return new Promise((resolve2) => {
|
|
39328
|
+
return new Promise((resolve2, reject2) => {
|
|
39327
39329
|
const uint = new Uint8Array(buffer, start, length);
|
|
39328
39330
|
const blob2 = new Blob([uint], { type: "image/jpeg" });
|
|
39329
39331
|
const img = new Image();
|
|
39332
|
+
const url2 = URL.createObjectURL(blob2);
|
|
39330
39333
|
img.addEventListener(
|
|
39331
39334
|
"load",
|
|
39332
39335
|
() => {
|
|
@@ -39337,11 +39340,20 @@ class TavioMesh extends EventEmitter {
|
|
|
39337
39340
|
img.style.top = "20px";
|
|
39338
39341
|
document.body.appendChild(img);
|
|
39339
39342
|
}
|
|
39343
|
+
URL.revokeObjectURL(url2);
|
|
39340
39344
|
resolve2(img);
|
|
39341
39345
|
},
|
|
39342
39346
|
false
|
|
39343
39347
|
);
|
|
39344
|
-
img.
|
|
39348
|
+
img.addEventListener(
|
|
39349
|
+
"error",
|
|
39350
|
+
(e) => {
|
|
39351
|
+
URL.revokeObjectURL(url2);
|
|
39352
|
+
reject2(e);
|
|
39353
|
+
},
|
|
39354
|
+
false
|
|
39355
|
+
);
|
|
39356
|
+
img.src = url2;
|
|
39345
39357
|
});
|
|
39346
39358
|
};
|
|
39347
39359
|
const flipImage = (img) => {
|
|
@@ -39369,17 +39381,6 @@ class TavioMesh extends EventEmitter {
|
|
|
39369
39381
|
++currentChunk;
|
|
39370
39382
|
}
|
|
39371
39383
|
}
|
|
39372
|
-
if (progressCallback != null) {
|
|
39373
|
-
setTimeout(() => {
|
|
39374
|
-
if (progressCallback != null) {
|
|
39375
|
-
progressCallback();
|
|
39376
|
-
}
|
|
39377
|
-
progressCallback = null;
|
|
39378
|
-
inProgress = false;
|
|
39379
|
-
}, 0);
|
|
39380
|
-
} else {
|
|
39381
|
-
inProgress = false;
|
|
39382
|
-
}
|
|
39383
39384
|
};
|
|
39384
39385
|
const loader = new StreamLoader();
|
|
39385
39386
|
loader.on("getcontentbytelength", (byte) => {
|
|
@@ -39394,25 +39395,33 @@ class TavioMesh extends EventEmitter {
|
|
|
39394
39395
|
currentLength += data.length;
|
|
39395
39396
|
this.emit("read", { length: currentLength });
|
|
39396
39397
|
if (inProgress === true) {
|
|
39397
|
-
|
|
39398
|
-
|
|
39399
|
-
|
|
39400
|
-
|
|
39401
|
-
|
|
39402
|
-
|
|
39403
|
-
|
|
39404
|
-
|
|
39398
|
+
hasPending = true;
|
|
39399
|
+
return;
|
|
39400
|
+
}
|
|
39401
|
+
inProgress = true;
|
|
39402
|
+
try {
|
|
39403
|
+
while (true) {
|
|
39404
|
+
hasPending = false;
|
|
39405
|
+
await onRead(currentLength);
|
|
39406
|
+
if (hasPending === false) {
|
|
39407
|
+
break;
|
|
39408
|
+
}
|
|
39409
|
+
}
|
|
39410
|
+
inProgress = false;
|
|
39411
|
+
} catch (e) {
|
|
39412
|
+
inProgress = false;
|
|
39413
|
+
reject(e);
|
|
39405
39414
|
}
|
|
39406
39415
|
});
|
|
39407
39416
|
loader.on("load", (data) => {
|
|
39408
39417
|
this.emit("load", currentLength, data);
|
|
39409
39418
|
});
|
|
39410
|
-
await loader.load(url);
|
|
39411
39419
|
const listener = () => {
|
|
39412
39420
|
this.sourceProperty[index].ready = true;
|
|
39413
39421
|
resolve();
|
|
39414
39422
|
};
|
|
39415
39423
|
this.once("finallyupdate", listener);
|
|
39424
|
+
await loader.load(url);
|
|
39416
39425
|
});
|
|
39417
39426
|
}
|
|
39418
39427
|
/**
|
|
@@ -41242,8 +41251,12 @@ class TavioMesh extends EventEmitter {
|
|
|
41242
41251
|
return;
|
|
41243
41252
|
}
|
|
41244
41253
|
const att = this.gaussianIndexMap.get(name);
|
|
41245
|
-
this.
|
|
41246
|
-
|
|
41254
|
+
const latest = this.latestIndexMap.get(name);
|
|
41255
|
+
if (att !== latest) {
|
|
41256
|
+
this.indexAttribute.set(att);
|
|
41257
|
+
this.indexAttribute.needsUpdate = true;
|
|
41258
|
+
this.latestIndexMap.set(name, att);
|
|
41259
|
+
}
|
|
41247
41260
|
}
|
|
41248
41261
|
/**
|
|
41249
41262
|
* インデックスを指定して座標変換を設定する
|
|
@@ -41448,6 +41461,7 @@ class TavioMesh extends EventEmitter {
|
|
|
41448
41461
|
if (this.gaussianIndexMap.has(renderView.name) !== true) {
|
|
41449
41462
|
const indexBuffer = new Uint32Array(this.currentVertexCount);
|
|
41450
41463
|
this.gaussianIndexMap.set(renderView.name, indexBuffer);
|
|
41464
|
+
this.latestIndexMap.set(renderView.name, null);
|
|
41451
41465
|
}
|
|
41452
41466
|
const index = this.gaussianIndexMap.get(renderView.name);
|
|
41453
41467
|
const activeCount = this.wasmSortInstance.sort(
|
|
@@ -41488,6 +41502,7 @@ class TavioMesh extends EventEmitter {
|
|
|
41488
41502
|
this.gaussianTransformData = null;
|
|
41489
41503
|
this.sphericalHarmonicsData = null;
|
|
41490
41504
|
this.gaussianIndexMap = null;
|
|
41505
|
+
this.latestIndexMap = null;
|
|
41491
41506
|
this.sortMap = null;
|
|
41492
41507
|
this.wasmSortInstance = null;
|
|
41493
41508
|
this.worker.postMessage({
|