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