@openheart/tavio-renderer 2.3.24-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) {
|
|
@@ -39322,10 +39325,11 @@ class TavioMesh extends EventEmitter {
|
|
|
39322
39325
|
throw new Error("invalid binary of background");
|
|
39323
39326
|
}
|
|
39324
39327
|
const createJpeg = (buffer, start, length, previewImage = false) => {
|
|
39325
|
-
return new Promise((resolve2) => {
|
|
39328
|
+
return new Promise((resolve2, reject2) => {
|
|
39326
39329
|
const uint = new Uint8Array(buffer, start, length);
|
|
39327
39330
|
const blob2 = new Blob([uint], { type: "image/jpeg" });
|
|
39328
39331
|
const img = new Image();
|
|
39332
|
+
const url2 = URL.createObjectURL(blob2);
|
|
39329
39333
|
img.addEventListener(
|
|
39330
39334
|
"load",
|
|
39331
39335
|
() => {
|
|
@@ -39336,11 +39340,20 @@ class TavioMesh extends EventEmitter {
|
|
|
39336
39340
|
img.style.top = "20px";
|
|
39337
39341
|
document.body.appendChild(img);
|
|
39338
39342
|
}
|
|
39343
|
+
URL.revokeObjectURL(url2);
|
|
39339
39344
|
resolve2(img);
|
|
39340
39345
|
},
|
|
39341
39346
|
false
|
|
39342
39347
|
);
|
|
39343
|
-
img.
|
|
39348
|
+
img.addEventListener(
|
|
39349
|
+
"error",
|
|
39350
|
+
(e) => {
|
|
39351
|
+
URL.revokeObjectURL(url2);
|
|
39352
|
+
reject2(e);
|
|
39353
|
+
},
|
|
39354
|
+
false
|
|
39355
|
+
);
|
|
39356
|
+
img.src = url2;
|
|
39344
39357
|
});
|
|
39345
39358
|
};
|
|
39346
39359
|
const flipImage = (img) => {
|
|
@@ -39368,32 +39381,12 @@ class TavioMesh extends EventEmitter {
|
|
|
39368
39381
|
++currentChunk;
|
|
39369
39382
|
}
|
|
39370
39383
|
}
|
|
39371
|
-
if (progressCallback != null) {
|
|
39372
|
-
setTimeout(() => {
|
|
39373
|
-
if (progressCallback != null) {
|
|
39374
|
-
progressCallback();
|
|
39375
|
-
}
|
|
39376
|
-
progressCallback = null;
|
|
39377
|
-
inProgress = false;
|
|
39378
|
-
}, 0);
|
|
39379
|
-
} else {
|
|
39380
|
-
inProgress = false;
|
|
39381
|
-
}
|
|
39382
39384
|
};
|
|
39383
39385
|
const loader = new StreamLoader();
|
|
39384
39386
|
loader.on("getcontentbytelength", (byte) => {
|
|
39385
39387
|
currentData = new Uint8Array(byte);
|
|
39386
39388
|
this.emit("getcontentbytelength", { byte });
|
|
39387
39389
|
});
|
|
39388
|
-
const runOnRead = async (readLength) => {
|
|
39389
|
-
try {
|
|
39390
|
-
await onRead(readLength);
|
|
39391
|
-
} catch (error2) {
|
|
39392
|
-
inProgress = false;
|
|
39393
|
-
progressCallback = null;
|
|
39394
|
-
reject(error2);
|
|
39395
|
-
}
|
|
39396
|
-
};
|
|
39397
39390
|
loader.on("read", async (data) => {
|
|
39398
39391
|
if (currentLength === 0) {
|
|
39399
39392
|
onFirstRead(data);
|
|
@@ -39402,25 +39395,33 @@ class TavioMesh extends EventEmitter {
|
|
|
39402
39395
|
currentLength += data.length;
|
|
39403
39396
|
this.emit("read", { length: currentLength });
|
|
39404
39397
|
if (inProgress === true) {
|
|
39405
|
-
|
|
39406
|
-
|
|
39407
|
-
|
|
39408
|
-
|
|
39409
|
-
|
|
39410
|
-
|
|
39411
|
-
|
|
39412
|
-
|
|
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);
|
|
39413
39414
|
}
|
|
39414
39415
|
});
|
|
39415
39416
|
loader.on("load", (data) => {
|
|
39416
39417
|
this.emit("load", currentLength, data);
|
|
39417
39418
|
});
|
|
39418
|
-
await loader.load(url);
|
|
39419
39419
|
const listener = () => {
|
|
39420
39420
|
this.sourceProperty[index].ready = true;
|
|
39421
39421
|
resolve();
|
|
39422
39422
|
};
|
|
39423
39423
|
this.once("finallyupdate", listener);
|
|
39424
|
+
await loader.load(url);
|
|
39424
39425
|
});
|
|
39425
39426
|
}
|
|
39426
39427
|
/**
|
|
@@ -41250,8 +41251,12 @@ class TavioMesh extends EventEmitter {
|
|
|
41250
41251
|
return;
|
|
41251
41252
|
}
|
|
41252
41253
|
const att = this.gaussianIndexMap.get(name);
|
|
41253
|
-
this.
|
|
41254
|
-
|
|
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
|
+
}
|
|
41255
41260
|
}
|
|
41256
41261
|
/**
|
|
41257
41262
|
* インデックスを指定して座標変換を設定する
|
|
@@ -41456,6 +41461,7 @@ class TavioMesh extends EventEmitter {
|
|
|
41456
41461
|
if (this.gaussianIndexMap.has(renderView.name) !== true) {
|
|
41457
41462
|
const indexBuffer = new Uint32Array(this.currentVertexCount);
|
|
41458
41463
|
this.gaussianIndexMap.set(renderView.name, indexBuffer);
|
|
41464
|
+
this.latestIndexMap.set(renderView.name, null);
|
|
41459
41465
|
}
|
|
41460
41466
|
const index = this.gaussianIndexMap.get(renderView.name);
|
|
41461
41467
|
const activeCount = this.wasmSortInstance.sort(
|
|
@@ -41496,6 +41502,7 @@ class TavioMesh extends EventEmitter {
|
|
|
41496
41502
|
this.gaussianTransformData = null;
|
|
41497
41503
|
this.sphericalHarmonicsData = null;
|
|
41498
41504
|
this.gaussianIndexMap = null;
|
|
41505
|
+
this.latestIndexMap = null;
|
|
41499
41506
|
this.sortMap = null;
|
|
41500
41507
|
this.wasmSortInstance = null;
|
|
41501
41508
|
this.worker.postMessage({
|