@d5techs/3dgs-lib 1.4.17 → 1.4.18
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 +20 -2
- package/dist/3dgs-lib.cjs.map +1 -1
- package/dist/3dgs-lib.js +20 -2
- package/dist/3dgs-lib.js.map +1 -1
- package/dist/gs/SOGEncoder.d.ts +7 -2
- package/package.json +1 -1
package/dist/3dgs-lib.cjs
CHANGED
|
@@ -6229,8 +6229,26 @@ async function encodeWebP(width, height, pixelData) {
|
|
|
6229
6229
|
}
|
|
6230
6230
|
return new Uint8Array(await blob.arrayBuffer());
|
|
6231
6231
|
}
|
|
6232
|
-
async function serializeSOG(data) {
|
|
6233
|
-
const { count,
|
|
6232
|
+
async function serializeSOG(data, coordinateSystem = "blender") {
|
|
6233
|
+
const { count, colors, opacities } = data;
|
|
6234
|
+
let { positions, scales, rotations } = data;
|
|
6235
|
+
if (coordinateSystem === "blender") {
|
|
6236
|
+
positions = new Float32Array(positions);
|
|
6237
|
+
scales = new Float32Array(scales);
|
|
6238
|
+
rotations = new Float32Array(rotations);
|
|
6239
|
+
for (let i = 0; i < count; i++) {
|
|
6240
|
+
const i3 = i * 3, i4 = i * 4;
|
|
6241
|
+
const py = positions[i3 + 1], pz = positions[i3 + 2];
|
|
6242
|
+
positions[i3 + 1] = -pz;
|
|
6243
|
+
positions[i3 + 2] = py;
|
|
6244
|
+
const sy = scales[i3 + 1], sz = scales[i3 + 2];
|
|
6245
|
+
scales[i3 + 1] = sz;
|
|
6246
|
+
scales[i3 + 2] = sy;
|
|
6247
|
+
const ry = rotations[i4 + 2], rz = rotations[i4 + 3];
|
|
6248
|
+
rotations[i4 + 2] = -rz;
|
|
6249
|
+
rotations[i4 + 3] = ry;
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6234
6252
|
const { width, height } = calcImageDimensions(count);
|
|
6235
6253
|
const totalPixels = width * height;
|
|
6236
6254
|
const logPositions = new Float32Array(count * 3);
|