@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.js
CHANGED
|
@@ -6629,7 +6629,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6629
6629
|
const { count, colors, opacities } = data;
|
|
6630
6630
|
let { positions, scales, rotations } = data;
|
|
6631
6631
|
let shCoeffs = data.shCoeffs ? new Float32Array(data.shCoeffs) : void 0;
|
|
6632
|
-
onProgress == null ? void 0 : onProgress("
|
|
6632
|
+
onProgress == null ? void 0 : onProgress("coord_transform", 0);
|
|
6633
6633
|
if (coordinateSystem === "blender") {
|
|
6634
6634
|
positions = new Float32Array(positions);
|
|
6635
6635
|
scales = new Float32Array(scales);
|
|
@@ -6652,7 +6652,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6652
6652
|
}
|
|
6653
6653
|
}
|
|
6654
6654
|
}
|
|
6655
|
-
onProgress == null ? void 0 : onProgress("
|
|
6655
|
+
onProgress == null ? void 0 : onProgress("morton_sort", 0.05);
|
|
6656
6656
|
const sortOrder = mortonSort(positions, count);
|
|
6657
6657
|
const sPos = new Float32Array(count * 3);
|
|
6658
6658
|
const sSca = new Float32Array(count * 3);
|
|
@@ -6685,7 +6685,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6685
6685
|
}
|
|
6686
6686
|
const { width, height } = calcImageDimensions(count);
|
|
6687
6687
|
const totalPixels = width * height;
|
|
6688
|
-
onProgress == null ? void 0 : onProgress("
|
|
6688
|
+
onProgress == null ? void 0 : onProgress("encode_position", 0.1);
|
|
6689
6689
|
const logPos = new Float32Array(count * 3);
|
|
6690
6690
|
for (let i = 0; i < count * 3; i++) logPos[i] = symLog(sPos[i]);
|
|
6691
6691
|
const mins = [Infinity, Infinity, Infinity];
|
|
@@ -6713,7 +6713,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6713
6713
|
meansLData[off + 3] = 255;
|
|
6714
6714
|
meansUData[off + 3] = 255;
|
|
6715
6715
|
}
|
|
6716
|
-
onProgress == null ? void 0 : onProgress("
|
|
6716
|
+
onProgress == null ? void 0 : onProgress("encode_scale", 0.2);
|
|
6717
6717
|
const logScales = new Float32Array(count * 3);
|
|
6718
6718
|
for (let i = 0; i < count * 3; i++) logScales[i] = Math.log(Math.max(1e-8, sSca[i]));
|
|
6719
6719
|
const scaleCodebook = buildCodebook(logScales, 256);
|
|
@@ -6726,7 +6726,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6726
6726
|
scalesData[off + 2] = findNearest(scaleCodebook, logScales[i * 3 + 2]);
|
|
6727
6727
|
scalesData[off + 3] = 255;
|
|
6728
6728
|
}
|
|
6729
|
-
onProgress == null ? void 0 : onProgress("
|
|
6729
|
+
onProgress == null ? void 0 : onProgress("encode_quaternion", 0.3);
|
|
6730
6730
|
const quatsData = new Uint8ClampedArray(totalPixels * 4);
|
|
6731
6731
|
quatsData.fill(255);
|
|
6732
6732
|
const SQRT2 = Math.SQRT2;
|
|
@@ -6779,7 +6779,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6779
6779
|
quatsData[off + 2] = Math.round(Math.max(0, Math.min(255, (r2 / SQRT2 + 0.5) * 255)));
|
|
6780
6780
|
quatsData[off + 3] = largest + 252;
|
|
6781
6781
|
}
|
|
6782
|
-
onProgress == null ? void 0 : onProgress("
|
|
6782
|
+
onProgress == null ? void 0 : onProgress("encode_color", 0.4);
|
|
6783
6783
|
const dcValues = new Float32Array(count * 3);
|
|
6784
6784
|
for (let i = 0; i < count; i++) {
|
|
6785
6785
|
dcValues[i * 3] = (sCol[i * 3] - 0.5) / SH_C0;
|
|
@@ -6808,7 +6808,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6808
6808
|
encodeWebP(width, height, sh0Data)
|
|
6809
6809
|
];
|
|
6810
6810
|
if (actualBands > 0 && sSH) {
|
|
6811
|
-
onProgress == null ? void 0 : onProgress("
|
|
6811
|
+
onProgress == null ? void 0 : onProgress("sh_compress", 0.5);
|
|
6812
6812
|
const pointsFlat = new Float32Array(count * shDim);
|
|
6813
6813
|
for (let i = 0; i < count; i++) {
|
|
6814
6814
|
const b = i * 45;
|
|
@@ -6823,10 +6823,10 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6823
6823
|
iterations,
|
|
6824
6824
|
(iter, total) => {
|
|
6825
6825
|
const p = 0.5 + 0.35 * (iter / total);
|
|
6826
|
-
onProgress == null ? void 0 : onProgress(
|
|
6826
|
+
onProgress == null ? void 0 : onProgress("sh_cluster", p, { iter, total });
|
|
6827
6827
|
}
|
|
6828
6828
|
);
|
|
6829
|
-
onProgress == null ? void 0 : onProgress("
|
|
6829
|
+
onProgress == null ? void 0 : onProgress("sh_quantize", 0.88);
|
|
6830
6830
|
const allCoeffValues = new Float32Array(effectivePaletteSize * shDim);
|
|
6831
6831
|
for (let c = 0; c < effectivePaletteSize; c++) {
|
|
6832
6832
|
for (let d = 0; d < shDim; d++) allCoeffValues[c * shDim + d] = centroids[c * shDim + d];
|
|
@@ -6868,7 +6868,7 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6868
6868
|
files: ["sh_centroids.webp", "sh_labels.webp"]
|
|
6869
6869
|
};
|
|
6870
6870
|
}
|
|
6871
|
-
onProgress == null ? void 0 : onProgress("
|
|
6871
|
+
onProgress == null ? void 0 : onProgress("encode_webp", 0.92);
|
|
6872
6872
|
const webps = await Promise.all(webpPromises);
|
|
6873
6873
|
const [meansLWebP, meansUWebP, scalesWebP, quatsWebP, sh0WebP] = webps;
|
|
6874
6874
|
const meta = {
|
|
@@ -6894,9 +6894,9 @@ async function serializeSOG(data, coordinateSystem = "blender", options = {}, on
|
|
|
6894
6894
|
zipEntries["sh_centroids.webp"] = webps[5];
|
|
6895
6895
|
zipEntries["sh_labels.webp"] = webps[6];
|
|
6896
6896
|
}
|
|
6897
|
-
onProgress == null ? void 0 : onProgress("
|
|
6897
|
+
onProgress == null ? void 0 : onProgress("pack_zip", 0.98);
|
|
6898
6898
|
const zipData = zipSync(zipEntries, { level: 0 });
|
|
6899
|
-
onProgress == null ? void 0 : onProgress("
|
|
6899
|
+
onProgress == null ? void 0 : onProgress("done", 1);
|
|
6900
6900
|
return zipData.buffer;
|
|
6901
6901
|
}
|
|
6902
6902
|
const WORKGROUP_SIZE$1 = 256;
|