@d5techs/3dgs-lib 1.4.23 → 1.4.24
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/3dgs-lib.cjs +12 -12
- package/dist/3dgs-lib.cjs.map +1 -1
- package/dist/3dgs-lib.js +12 -12
- package/dist/3dgs-lib.js.map +1 -1
- package/dist/gs/SOGEncoder.d.ts +13 -1
- package/package.json +1 -1
package/dist/3dgs-lib.cjs
CHANGED
|
@@ -6631,7 +6631,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6631
6631
|
const { count, colors, opacities } = data;
|
|
6632
6632
|
let { positions, scales, rotations } = data;
|
|
6633
6633
|
let shCoeffs = data.shCoeffs ? new Float32Array(data.shCoeffs) : void 0;
|
|
6634
|
-
onProgress == null ? void 0 : onProgress("
|
|
6634
|
+
onProgress == null ? void 0 : onProgress("coord_transform", 0);
|
|
6635
6635
|
if (coordinateSystem === "blender") {
|
|
6636
6636
|
positions = new Float32Array(positions);
|
|
6637
6637
|
scales = new Float32Array(scales);
|
|
@@ -6654,7 +6654,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6654
6654
|
}
|
|
6655
6655
|
}
|
|
6656
6656
|
}
|
|
6657
|
-
onProgress == null ? void 0 : onProgress("
|
|
6657
|
+
onProgress == null ? void 0 : onProgress("morton_sort", 0.05);
|
|
6658
6658
|
const sortOrder = mortonSort(positions, count);
|
|
6659
6659
|
const sPos = new Float32Array(count * 3);
|
|
6660
6660
|
const sSca = new Float32Array(count * 3);
|
|
@@ -6687,7 +6687,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6687
6687
|
}
|
|
6688
6688
|
const { width, height } = calcImageDimensions(count);
|
|
6689
6689
|
const totalPixels = width * height;
|
|
6690
|
-
onProgress == null ? void 0 : onProgress("
|
|
6690
|
+
onProgress == null ? void 0 : onProgress("encode_position", 0.1);
|
|
6691
6691
|
const logPos = new Float32Array(count * 3);
|
|
6692
6692
|
for (let i = 0; i < count * 3; i++) logPos[i] = symLog(sPos[i]);
|
|
6693
6693
|
const mins = [Infinity, Infinity, Infinity];
|
|
@@ -6715,7 +6715,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6715
6715
|
meansLData[off + 3] = 255;
|
|
6716
6716
|
meansUData[off + 3] = 255;
|
|
6717
6717
|
}
|
|
6718
|
-
onProgress == null ? void 0 : onProgress("
|
|
6718
|
+
onProgress == null ? void 0 : onProgress("encode_scale", 0.2);
|
|
6719
6719
|
const logScales = new Float32Array(count * 3);
|
|
6720
6720
|
for (let i = 0; i < count * 3; i++) logScales[i] = Math.log(Math.max(1e-8, sSca[i]));
|
|
6721
6721
|
const scaleCodebook = buildCodebook(logScales, 256);
|
|
@@ -6728,7 +6728,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6728
6728
|
scalesData[off + 2] = findNearest(scaleCodebook, logScales[i * 3 + 2]);
|
|
6729
6729
|
scalesData[off + 3] = 255;
|
|
6730
6730
|
}
|
|
6731
|
-
onProgress == null ? void 0 : onProgress("
|
|
6731
|
+
onProgress == null ? void 0 : onProgress("encode_quaternion", 0.3);
|
|
6732
6732
|
const quatsData = new Uint8ClampedArray(totalPixels * 4);
|
|
6733
6733
|
quatsData.fill(255);
|
|
6734
6734
|
const SQRT2 = Math.SQRT2;
|
|
@@ -6781,7 +6781,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6781
6781
|
quatsData[off + 2] = Math.round(Math.max(0, Math.min(255, (r2 / SQRT2 + 0.5) * 255)));
|
|
6782
6782
|
quatsData[off + 3] = largest + 252;
|
|
6783
6783
|
}
|
|
6784
|
-
onProgress == null ? void 0 : onProgress("
|
|
6784
|
+
onProgress == null ? void 0 : onProgress("encode_color", 0.4);
|
|
6785
6785
|
const dcValues = new Float32Array(count * 3);
|
|
6786
6786
|
for (let i = 0; i < count; i++) {
|
|
6787
6787
|
dcValues[i * 3] = (sCol[i * 3] - 0.5) / SH_C0;
|
|
@@ -6810,7 +6810,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6810
6810
|
encodeWebP(width, height, sh0Data)
|
|
6811
6811
|
];
|
|
6812
6812
|
if (actualBands > 0 && sSH) {
|
|
6813
|
-
onProgress == null ? void 0 : onProgress("
|
|
6813
|
+
onProgress == null ? void 0 : onProgress("sh_compress", 0.5);
|
|
6814
6814
|
const pointsFlat = new Float32Array(count * shDim);
|
|
6815
6815
|
for (let i = 0; i < count; i++) {
|
|
6816
6816
|
const b = i * 45;
|
|
@@ -6825,10 +6825,10 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6825
6825
|
iterations,
|
|
6826
6826
|
(iter, total) => {
|
|
6827
6827
|
const p = 0.5 + 0.35 * (iter / total);
|
|
6828
|
-
onProgress == null ? void 0 : onProgress(
|
|
6828
|
+
onProgress == null ? void 0 : onProgress("sh_cluster", p, { iter, total });
|
|
6829
6829
|
}
|
|
6830
6830
|
);
|
|
6831
|
-
onProgress == null ? void 0 : onProgress("
|
|
6831
|
+
onProgress == null ? void 0 : onProgress("sh_quantize", 0.88);
|
|
6832
6832
|
const allCoeffValues = new Float32Array(effectivePaletteSize * shDim);
|
|
6833
6833
|
for (let c = 0; c < effectivePaletteSize; c++) {
|
|
6834
6834
|
for (let d = 0; d < shDim; d++) allCoeffValues[c * shDim + d] = centroids[c * shDim + d];
|
|
@@ -6870,7 +6870,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6870
6870
|
files: ["sh_centroids.webp", "sh_labels.webp"]
|
|
6871
6871
|
};
|
|
6872
6872
|
}
|
|
6873
|
-
onProgress == null ? void 0 : onProgress("
|
|
6873
|
+
onProgress == null ? void 0 : onProgress("encode_webp", 0.92);
|
|
6874
6874
|
const webps = await Promise.all(webpPromises);
|
|
6875
6875
|
const [meansLWebP, meansUWebP, scalesWebP, quatsWebP, sh0WebP] = webps;
|
|
6876
6876
|
const meta = {
|
|
@@ -6896,9 +6896,9 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6896
6896
|
zipEntries["sh_centroids.webp"] = webps[5];
|
|
6897
6897
|
zipEntries["sh_labels.webp"] = webps[6];
|
|
6898
6898
|
}
|
|
6899
|
-
onProgress == null ? void 0 : onProgress("
|
|
6899
|
+
onProgress == null ? void 0 : onProgress("pack_zip", 0.98);
|
|
6900
6900
|
const zipData = zipSync(zipEntries, { level: 0 });
|
|
6901
|
-
onProgress == null ? void 0 : onProgress("
|
|
6901
|
+
onProgress == null ? void 0 : onProgress("done", 1);
|
|
6902
6902
|
return zipData.buffer;
|
|
6903
6903
|
}
|
|
6904
6904
|
const WORKGROUP_SIZE$1 = 256;
|