From 7f2a0b4dc15d511c94432a549e548be32f076284 Mon Sep 17 00:00:00 2001 From: Mark Kellogg Date: Tue, 9 Jan 2024 16:00:54 -0800 Subject: [PATCH] Correctly apply scene transform for static mode --- src/SplatMesh.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/SplatMesh.js b/src/SplatMesh.js index 54c2405..5ec867a 100644 --- a/src/SplatMesh.js +++ b/src/SplatMesh.js @@ -1164,7 +1164,7 @@ export class SplatMesh extends THREE.Mesh { } const scene = this.getScene(i); const splatBuffer = scene.splatBuffer; - const sceneTransform = applySceneTransform ? null : scene.transform; + const sceneTransform = applySceneTransform ? scene.transform : null; if (covariances) splatBuffer.fillSplatCovarianceArray(covariances, offset, sceneTransform); if (centers) splatBuffer.fillSplatCenterArray(centers, offset, sceneTransform); if (colors) splatBuffer.fillSplatColorArray(colors, offset, sceneTransform); @@ -1176,15 +1176,12 @@ export class SplatMesh extends THREE.Mesh { * Convert splat centers, which are floating point values, to an array of integers and multiply * each by 1000. Centers will get transformed as appropriate before conversion to integer. * @param {number} padFour Enforce alignement of 4 by inserting a 1000 after every 3 values - * @param {boolean} applySceneTransform By default, scene transforms are applied to the splat centers only if the splat mesh is - * static. If 'applySceneTransform' is true, scene transforms will always be applied and if - * it is false, they will never be applied. If undefined, the default behavior will apply. * @return {Int32Array} */ - getIntegerCenters(padFour, applySceneTransform) { + getIntegerCenters(padFour) { const splatCount = this.getSplatCount(); const floatCenters = new Float32Array(splatCount * 3); - this.fillSplatDataArrays(null, floatCenters, null, applySceneTransform); + this.fillSplatDataArrays(null, floatCenters, null); let intCenters; let componentCount = padFour ? 4 : 3; intCenters = new Int32Array(splatCount * componentCount); @@ -1201,15 +1198,12 @@ export class SplatMesh extends THREE.Mesh { /** * Returns an array of splat centers, transformed as appropriate, optionally padded. * @param {number} padFour Enforce alignement of 4 by inserting a 1 after every 3 values - * @param {boolean} applySceneTransform By default, scene transforms are applied to the splat centers only if the splat mesh is - * static. If 'applySceneTransform' is true, scene transforms will always be applied and if - * it is false, they will never be applied. If undefined, the default behavior will apply. * @return {Float32Array} */ getFloatCenters(padFour) { const splatCount = this.getSplatCount(); const floatCenters = new Float32Array(splatCount * 3); - this.fillSplatDataArrays(null, floatCenters, null, applySceneTransform); + this.fillSplatDataArrays(null, floatCenters, null); if (!padFour) return floatCenters; let paddedFloatCenters = new Float32Array(splatCount * 4); for (let i = 0; i < splatCount; i++) {