@onerjs/core 8.32.7 → 8.32.9

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.
Files changed (112) hide show
  1. package/Audio/sound.js +0 -1
  2. package/Audio/sound.js.map +1 -1
  3. package/AudioV2/abstractAudio/abstractSoundSource.js +12 -4
  4. package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
  5. package/AudioV2/webAudio/webAudioStaticSound.js +10 -3
  6. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  7. package/Engines/Extensions/engine.prefilteredCubeTexture.js +1 -1
  8. package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
  9. package/Engines/abstractEngine.js +2 -2
  10. package/Engines/abstractEngine.js.map +1 -1
  11. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +1 -1
  12. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
  13. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +18 -0
  14. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +105 -15
  15. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  16. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +7 -7
  17. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  18. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +1 -1
  19. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
  20. package/FrameGraph/Passes/pass.d.ts +11 -2
  21. package/FrameGraph/Passes/pass.js +14 -2
  22. package/FrameGraph/Passes/pass.js.map +1 -1
  23. package/FrameGraph/Passes/renderPass.d.ts +4 -2
  24. package/FrameGraph/Passes/renderPass.js +5 -2
  25. package/FrameGraph/Passes/renderPass.js.map +1 -1
  26. package/FrameGraph/Tasks/Layers/baseLayerTask.js +27 -31
  27. package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
  28. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +41 -1
  29. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +122 -0
  30. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  31. package/FrameGraph/Tasks/Texture/clearTextureTask.js +6 -4
  32. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  33. package/FrameGraph/frameGraph.js +3 -0
  34. package/FrameGraph/frameGraph.js.map +1 -1
  35. package/FrameGraph/frameGraphRenderTarget.js +1 -0
  36. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  37. package/FrameGraph/frameGraphTask.d.ts +2 -0
  38. package/FrameGraph/frameGraphTask.js +11 -0
  39. package/FrameGraph/frameGraphTask.js.map +1 -1
  40. package/FrameGraph/frameGraphTypes.d.ts +8 -0
  41. package/FrameGraph/frameGraphTypes.js.map +1 -1
  42. package/Layers/effectLayer.d.ts +1 -1
  43. package/Layers/effectLayer.js.map +1 -1
  44. package/Layers/glowLayer.js +2 -0
  45. package/Layers/glowLayer.js.map +1 -1
  46. package/Layers/highlightLayer.js +2 -0
  47. package/Layers/highlightLayer.js.map +1 -1
  48. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +9 -0
  49. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +66 -22
  50. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  51. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +3 -6
  52. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  53. package/Materials/materialHelper.functions.js +2 -8
  54. package/Materials/materialHelper.functions.js.map +1 -1
  55. package/Materials/shaderMaterial.js +2 -2
  56. package/Materials/shaderMaterial.js.map +1 -1
  57. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +16 -6
  58. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +37 -33
  59. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  60. package/Misc/snapshotRenderingHelper.js +10 -0
  61. package/Misc/snapshotRenderingHelper.js.map +1 -1
  62. package/Rendering/depthPeelingRenderer.d.ts +7 -78
  63. package/Rendering/depthPeelingRenderer.js +12 -398
  64. package/Rendering/depthPeelingRenderer.js.map +1 -1
  65. package/Rendering/depthPeelingSceneComponent.d.ts +3 -3
  66. package/Rendering/depthPeelingSceneComponent.js.map +1 -1
  67. package/Rendering/depthRenderer.js +9 -1
  68. package/Rendering/depthRenderer.js.map +1 -1
  69. package/Rendering/index.d.ts +1 -0
  70. package/Rendering/index.js +1 -0
  71. package/Rendering/index.js.map +1 -1
  72. package/Rendering/objectRenderer.d.ts +20 -0
  73. package/Rendering/objectRenderer.js +17 -1
  74. package/Rendering/objectRenderer.js.map +1 -1
  75. package/Rendering/renderingGroup.d.ts +10 -3
  76. package/Rendering/renderingGroup.js +24 -13
  77. package/Rendering/renderingGroup.js.map +1 -1
  78. package/Rendering/renderingManager.d.ts +6 -2
  79. package/Rendering/renderingManager.js +8 -2
  80. package/Rendering/renderingManager.js.map +1 -1
  81. package/Rendering/thinDepthPeelingRenderer.d.ts +120 -0
  82. package/Rendering/thinDepthPeelingRenderer.js +469 -0
  83. package/Rendering/thinDepthPeelingRenderer.js.map +1 -0
  84. package/Shaders/ShadersInclude/gaussianSplatting.js +1 -1
  85. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  86. package/Shaders/gaussianSplatting.vertex.js +2 -2
  87. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  88. package/Shaders/gaussianSplattingDepth.fragment.js +9 -2
  89. package/Shaders/gaussianSplattingDepth.fragment.js.map +1 -1
  90. package/Shaders/gaussianSplattingDepth.vertex.js +13 -2
  91. package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
  92. package/Shaders/oitFinalSimpleBlend.fragment.d.ts +5 -0
  93. package/Shaders/oitFinalSimpleBlend.fragment.js +12 -0
  94. package/Shaders/oitFinalSimpleBlend.fragment.js.map +1 -0
  95. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +1 -5
  96. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  97. package/ShadersWGSL/gaussianSplatting.vertex.js +2 -2
  98. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  99. package/ShadersWGSL/gaussianSplattingDepth.fragment.js +12 -3
  100. package/ShadersWGSL/gaussianSplattingDepth.fragment.js.map +1 -1
  101. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +13 -2
  102. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  103. package/ShadersWGSL/iblVoxelGrid.vertex.d.ts +1 -0
  104. package/ShadersWGSL/iblVoxelGrid.vertex.js +15 -8
  105. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  106. package/ShadersWGSL/oitFinalSimpleBlend.fragment.d.ts +5 -0
  107. package/ShadersWGSL/oitFinalSimpleBlend.fragment.js +13 -0
  108. package/ShadersWGSL/oitFinalSimpleBlend.fragment.js.map +1 -0
  109. package/node.d.ts +2 -0
  110. package/node.js +5 -0
  111. package/node.js.map +1 -1
  112. package/package.json +1 -1
@@ -8,6 +8,9 @@ import { Vector3 } from "../../Maths/math.vector.js";
8
8
  import "../thinInstanceMesh.js";
9
9
  import type { Material } from "../../Materials/material.js";
10
10
  import type { Camera } from "../../Cameras/camera.js";
11
+ interface IUpdateOptions {
12
+ flipY?: boolean;
13
+ }
11
14
  /**
12
15
  * Representation of the types
13
16
  */
@@ -194,7 +197,6 @@ export declare class GaussianSplattingMesh extends Mesh {
194
197
  private _splatIndex;
195
198
  private _shTextures;
196
199
  private _splatsData;
197
- private _sh;
198
200
  private readonly _keepInRam;
199
201
  private _delayedTextureUpdate;
200
202
  private _useRGBACovariants;
@@ -206,13 +208,13 @@ export declare class GaussianSplattingMesh extends Mesh {
206
208
  private static _SplatBatchSize;
207
209
  private static _PlyConversionBatchSize;
208
210
  private _shDegree;
209
- private _viewDirectionFactor;
210
211
  private static readonly _BatchSize;
211
212
  private _cameraViewInfos;
212
213
  /**
213
214
  * View direction factor used to compute the SH view direction in the shader.
215
+ * @deprecated Not used anymore for SH rendering
214
216
  */
215
- get viewDirectionFactor(): Vector3;
217
+ get viewDirectionFactor(): import("../../types.js").DeepImmutableObject<Vector3>;
216
218
  /**
217
219
  * SH degree. 0 = no sh (default). 1 = 3 parameters. 2 = 8 parameters. 3 = 15 parameters.
218
220
  */
@@ -261,6 +263,7 @@ export declare class GaussianSplattingMesh extends Mesh {
261
263
  * Get the compensation state
262
264
  */
263
265
  get compensation(): boolean;
266
+ private _loadingPromise;
264
267
  /**
265
268
  * set rendering material
266
269
  */
@@ -278,6 +281,11 @@ export declare class GaussianSplattingMesh extends Mesh {
278
281
  * @param keepInRam keep datas in ram for editing purpose
279
282
  */
280
283
  constructor(name: string, url?: Nullable<string>, scene?: Nullable<Scene>, keepInRam?: boolean);
284
+ /**
285
+ * Get the loading promise when loading the mesh from a URL in the constructor
286
+ * @returns constructor loading promise or null if no URL was provided
287
+ */
288
+ getLoadingPromise(): Promise<void> | null;
281
289
  /**
282
290
  * Returns the class name
283
291
  * @returns "GaussianSplattingMesh"
@@ -364,12 +372,13 @@ export declare class GaussianSplattingMesh extends Mesh {
364
372
  */
365
373
  loadDataAsync(data: ArrayBuffer): Promise<void>;
366
374
  /**
367
- * Loads a .splat Gaussian or .ply Splatting file asynchronously
375
+ * Loads a Gaussian or Splatting file asynchronously
368
376
  * @param url path to the splat file to load
377
+ * @param scene optional scene it belongs to
369
378
  * @returns a promise that resolves when the operation is complete
370
379
  * @deprecated Please use SceneLoader.ImportMeshAsync instead
371
380
  */
372
- loadFileAsync(url: string): Promise<void>;
381
+ loadFileAsync(url: string, scene?: Scene): Promise<void>;
373
382
  /**
374
383
  * Releases resources associated with this mesh.
375
384
  * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
@@ -399,8 +408,9 @@ export declare class GaussianSplattingMesh extends Mesh {
399
408
  * Update data from GS (position, orientation, color, scaling)
400
409
  * @param data array that contain all the datas
401
410
  * @param sh optional array of uint8 array for SH data
411
+ * @param options optional informations on how to treat data
402
412
  */
403
- updateData(data: ArrayBuffer, sh?: Uint8Array[]): void;
413
+ updateData(data: ArrayBuffer, sh?: Uint8Array[], options?: IUpdateOptions): void;
404
414
  /**
405
415
  * Refreshes the bounding info, taking into account all the thin instances defined
406
416
  * @returns the current Gaussian Splatting
@@ -6,12 +6,12 @@ import { Logger } from "../../Misc/logger.js";
6
6
  import { GaussianSplattingMaterial } from "../../Materials/GaussianSplatting/gaussianSplattingMaterial.js";
7
7
  import { RawTexture } from "../../Materials/Textures/rawTexture.js";
8
8
 
9
- import { Tools } from "../../Misc/tools.js";
10
9
  import "../thinInstanceMesh.js";
11
10
  import { ToHalfFloat } from "../../Misc/textureTools.js";
12
11
  import { Scalar } from "../../Maths/math.scalar.js";
13
12
  import { runCoroutineSync, runCoroutineAsync, createYieldingScheduler } from "../../Misc/coroutine.js";
14
13
  import { EngineStore } from "../../Engines/engineStore.js";
14
+ import { ImportMeshAsync } from "../../Loading/sceneLoader.js";
15
15
  // @internal
16
16
  const UnpackUnorm = (value, bits) => {
17
17
  const t = (1 << bits) - 1;
@@ -163,9 +163,10 @@ var PLYValue;
163
163
  export class GaussianSplattingMesh extends Mesh {
164
164
  /**
165
165
  * View direction factor used to compute the SH view direction in the shader.
166
+ * @deprecated Not used anymore for SH rendering
166
167
  */
167
168
  get viewDirectionFactor() {
168
- return this._viewDirectionFactor;
169
+ return Vector3.OneReadOnly;
169
170
  }
170
171
  /**
171
172
  * SH degree. 0 = no sh (default). 1 = 3 parameters. 2 = 8 parameters. 3 = 15 parameters.
@@ -235,7 +236,7 @@ export class GaussianSplattingMesh extends Mesh {
235
236
  */
236
237
  set material(value) {
237
238
  this._material = value;
238
- this._material.backFaceCulling = true;
239
+ this._material.backFaceCulling = false;
239
240
  this._material.cullBackFaces = false;
240
241
  value.resetDrawCache();
241
242
  }
@@ -288,7 +289,6 @@ export class GaussianSplattingMesh extends Mesh {
288
289
  this._splatIndex = null;
289
290
  this._shTextures = null;
290
291
  this._splatsData = null;
291
- this._sh = null;
292
292
  this._keepInRam = false;
293
293
  this._delayedTextureUpdate = null;
294
294
  this._useRGBACovariants = false;
@@ -296,8 +296,8 @@ export class GaussianSplattingMesh extends Mesh {
296
296
  this._tmpCovariances = [0, 0, 0, 0, 0, 0];
297
297
  this._sortIsDirty = false;
298
298
  this._shDegree = 0;
299
- this._viewDirectionFactor = new Vector3(1, 1, -1);
300
299
  this._cameraViewInfos = new Map();
300
+ this._loadingPromise = null;
301
301
  this.subMeshes = [];
302
302
  new SubMesh(0, 0, 4 * GaussianSplattingMesh._BatchSize, 0, 6 * GaussianSplattingMesh._BatchSize, this);
303
303
  this.setEnabled(false);
@@ -305,8 +305,7 @@ export class GaussianSplattingMesh extends Mesh {
305
305
  this._useRGBACovariants = !this.getEngine().isWebGPU && this.getEngine().version === 1.0;
306
306
  this._keepInRam = keepInRam;
307
307
  if (url) {
308
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
309
- this.loadFileAsync(url);
308
+ this._loadingPromise = this.loadFileAsync(url);
310
309
  }
311
310
  const gaussianSplattingMaterial = new GaussianSplattingMaterial(this.name + "_material", this._scene);
312
311
  gaussianSplattingMaterial.setSourceMesh(this);
@@ -322,6 +321,13 @@ export class GaussianSplattingMesh extends Mesh {
322
321
  }
323
322
  });
324
323
  }
324
+ /**
325
+ * Get the loading promise when loading the mesh from a URL in the constructor
326
+ * @returns constructor loading promise or null if no URL was provided
327
+ */
328
+ getLoadingPromise() {
329
+ return this._loadingPromise;
330
+ }
325
331
  /**
326
332
  * Returns the class name
327
333
  * @returns "GaussianSplattingMesh"
@@ -355,11 +361,11 @@ export class GaussianSplattingMesh extends Mesh {
355
361
  _getCameraDirection(camera) {
356
362
  const cameraMatrix = camera.getViewMatrix();
357
363
  this.getWorldMatrix().multiplyToRef(cameraMatrix, this._modelViewMatrix);
358
- cameraMatrix.invertToRef(TmpVectors.Matrix[0]);
359
- this.getWorldMatrix().multiplyToRef(TmpVectors.Matrix[0], TmpVectors.Matrix[1]);
360
- Vector3.TransformNormalToRef(Vector3.Forward(this._scene.useRightHandedSystem), TmpVectors.Matrix[1], TmpVectors.Vector3[2]);
361
- TmpVectors.Vector3[2].normalize();
362
- return TmpVectors.Vector3[2];
364
+ // return vector used to compute distance to camera
365
+ const localDirection = TmpVectors.Vector3[1];
366
+ localDirection.set(this._modelViewMatrix.m[2], this._modelViewMatrix.m[6], this._modelViewMatrix.m[10]);
367
+ localDirection.normalize();
368
+ return localDirection;
363
369
  }
364
370
  /** @internal */
365
371
  _postToWorker(forced = false) {
@@ -692,10 +698,10 @@ export class GaussianSplattingMesh extends Mesh {
692
698
  shDegree = 3;
693
699
  }
694
700
  else if (value >= 64 /* PLYValue.SH_24 */) {
695
- shDegree = 2;
701
+ shDegree = Math.max(shDegree, 2);
696
702
  }
697
703
  else if (value >= 48 /* PLYValue.SH_8 */) {
698
- shDegree = 1;
704
+ shDegree = Math.max(shDegree, 1);
699
705
  }
700
706
  }
701
707
  const type = GaussianSplattingMesh._TypeNameToEnum(typeName);
@@ -1104,15 +1110,14 @@ export class GaussianSplattingMesh extends Mesh {
1104
1110
  return await this.updateDataAsync(data);
1105
1111
  }
1106
1112
  /**
1107
- * Loads a .splat Gaussian or .ply Splatting file asynchronously
1113
+ * Loads a Gaussian or Splatting file asynchronously
1108
1114
  * @param url path to the splat file to load
1115
+ * @param scene optional scene it belongs to
1109
1116
  * @returns a promise that resolves when the operation is complete
1110
1117
  * @deprecated Please use SceneLoader.ImportMeshAsync instead
1111
1118
  */
1112
- async loadFileAsync(url) {
1113
- const plyBuffer = await Tools.LoadFileAsync(url, true);
1114
- const splatsData = await GaussianSplattingMesh.ConvertPLYWithSHToSplatAsync(plyBuffer);
1115
- await this.updateDataAsync(splatsData.buffer, splatsData.sh);
1119
+ async loadFileAsync(url, scene) {
1120
+ await ImportMeshAsync(url, (scene || EngineStore.LastCreatedScene), { pluginOptions: { splat: { gaussianSplattingMesh: this } } });
1116
1121
  }
1117
1122
  /**
1118
1123
  * Releases resources associated with this mesh.
@@ -1187,13 +1192,13 @@ export class GaussianSplattingMesh extends Mesh {
1187
1192
  covB[index * covBSItemSize + 1] = ToHalfFloat(0);
1188
1193
  colorArray[index * 4 + 3] = 0;
1189
1194
  }
1190
- _makeSplat(index, fBuffer, uBuffer, covA, covB, colorArray, minimum, maximum) {
1195
+ _makeSplat(index, fBuffer, uBuffer, covA, covB, colorArray, minimum, maximum, options) {
1191
1196
  const matrixRotation = TmpVectors.Matrix[0];
1192
1197
  const matrixScale = TmpVectors.Matrix[1];
1193
1198
  const quaternion = TmpVectors.Quaternion[0];
1194
1199
  const covBSItemSize = this._useRGBACovariants ? 4 : 2;
1195
1200
  const x = fBuffer[8 * index + 0];
1196
- const y = -fBuffer[8 * index + 1];
1201
+ const y = fBuffer[8 * index + 1] * (options.flipY ? -1 : 1);
1197
1202
  const z = fBuffer[8 * index + 2];
1198
1203
  this._splatPositions[4 * index + 0] = x;
1199
1204
  this._splatPositions[4 * index + 1] = y;
@@ -1271,7 +1276,7 @@ export class GaussianSplattingMesh extends Mesh {
1271
1276
  this._instanciateWorker();
1272
1277
  }
1273
1278
  }
1274
- *_updateData(data, isAsync, sh) {
1279
+ *_updateData(data, isAsync, sh, options = { flipY: false }) {
1275
1280
  // if a covariance texture is present, then it's not a creation but an update
1276
1281
  if (!this._covariancesATexture) {
1277
1282
  this._readyToDisplay = false;
@@ -1281,9 +1286,7 @@ export class GaussianSplattingMesh extends Mesh {
1281
1286
  const fBuffer = new Float32Array(uBuffer.buffer);
1282
1287
  if (this._keepInRam) {
1283
1288
  this._splatsData = data;
1284
- if (sh) {
1285
- this._sh = sh;
1286
- }
1289
+ // keep sh in ram too ?
1287
1290
  }
1288
1291
  const vertexCount = uBuffer.length / GaussianSplattingMesh._RowOutputLength;
1289
1292
  if (vertexCount != this._vertexCount) {
@@ -1311,7 +1314,7 @@ export class GaussianSplattingMesh extends Mesh {
1311
1314
  const updateLine = partIndex * lineCountUpdate;
1312
1315
  const splatIndexBase = updateLine * textureSize.x;
1313
1316
  for (let i = 0; i < textureLengthPerUpdate; i++) {
1314
- this._makeSplat(splatIndexBase + i, fBuffer, uBuffer, covA, covB, colorArray, minimum, maximum);
1317
+ this._makeSplat(splatIndexBase + i, fBuffer, uBuffer, covA, covB, colorArray, minimum, maximum, options);
1315
1318
  }
1316
1319
  this._updateSubTextures(this._splatPositions, covA, covB, colorArray, updateLine, Math.min(lineCountUpdate, textureSize.y - updateLine));
1317
1320
  // Update the binfo
@@ -1329,7 +1332,7 @@ export class GaussianSplattingMesh extends Mesh {
1329
1332
  else {
1330
1333
  const paddedVertexCount = (vertexCount + 15) & ~0xf;
1331
1334
  for (let i = 0; i < vertexCount; i++) {
1332
- this._makeSplat(i, fBuffer, uBuffer, covA, covB, colorArray, minimum, maximum);
1335
+ this._makeSplat(i, fBuffer, uBuffer, covA, covB, colorArray, minimum, maximum, options);
1333
1336
  if (isAsync && i % GaussianSplattingMesh._SplatBatchSize === 0) {
1334
1337
  yield;
1335
1338
  }
@@ -1343,6 +1346,7 @@ export class GaussianSplattingMesh extends Mesh {
1343
1346
  // Update the binfo
1344
1347
  this.getBoundingInfo().reConstruct(minimum, maximum, this.getWorldMatrix());
1345
1348
  this.setEnabled(true);
1349
+ this._sortIsDirty = true;
1346
1350
  }
1347
1351
  this._postToWorker(true);
1348
1352
  }
@@ -1360,9 +1364,10 @@ export class GaussianSplattingMesh extends Mesh {
1360
1364
  * Update data from GS (position, orientation, color, scaling)
1361
1365
  * @param data array that contain all the datas
1362
1366
  * @param sh optional array of uint8 array for SH data
1367
+ * @param options optional informations on how to treat data
1363
1368
  */
1364
- updateData(data, sh) {
1365
- runCoroutineSync(this._updateData(data, false, sh));
1369
+ updateData(data, sh, options = { flipY: true }) {
1370
+ runCoroutineSync(this._updateData(data, false, sh, options));
1366
1371
  }
1367
1372
  /**
1368
1373
  * Refreshes the bounding info, taking into account all the thin instances defined
@@ -1403,7 +1408,7 @@ export class GaussianSplattingMesh extends Mesh {
1403
1408
  if (sh) {
1404
1409
  for (let i = 0; i < sh.length; i++) {
1405
1410
  const componentCount = 4;
1406
- const shView = new Uint8Array(this._sh[i].buffer, texelStart * componentCount, texelCount * componentCount);
1411
+ const shView = new Uint32Array(sh[i].buffer, texelStart * componentCount * 4, texelCount * componentCount);
1407
1412
  updateTextureFromData(this._shTextures[i], shView, textureSize.x, lineStart, lineCount);
1408
1413
  }
1409
1414
  }
@@ -1421,7 +1426,7 @@ export class GaussianSplattingMesh extends Mesh {
1421
1426
  const vertexCountPadded = (this._vertexCount + 15) & ~0xf;
1422
1427
  this._depthMix = new BigInt64Array(vertexCountPadded);
1423
1428
  const positions = Float32Array.from(this._splatPositions);
1424
- this._worker.postMessage({ positions, vertexCountPadded }, [positions.buffer]);
1429
+ this._worker.postMessage({ positions }, [positions.buffer]);
1425
1430
  this._worker.onmessage = (e) => {
1426
1431
  this._depthMix = e.data.depthMix;
1427
1432
  const cameraId = e.data.cameraId;
@@ -1490,7 +1495,6 @@ GaussianSplattingMesh._BatchSize = 16; // 16 splats per instance
1490
1495
  */
1491
1496
  GaussianSplattingMesh.ProgressiveUpdateAmount = 0;
1492
1497
  GaussianSplattingMesh._CreateWorker = function (self) {
1493
- let vertexCountPadded = 0;
1494
1498
  let positions;
1495
1499
  let depthMix;
1496
1500
  let indices;
@@ -1499,12 +1503,12 @@ GaussianSplattingMesh._CreateWorker = function (self) {
1499
1503
  // updated on init
1500
1504
  if (e.data.positions) {
1501
1505
  positions = e.data.positions;
1502
- vertexCountPadded = e.data.vertexCountPadded;
1503
1506
  }
1504
1507
  // udpate on view changed
1505
1508
  else {
1506
1509
  const cameraId = e.data.cameraId;
1507
1510
  const viewProj = e.data.view;
1511
+ const vertexCountPadded = (positions.length + 15) & ~0xf;
1508
1512
  if (!positions || !viewProj) {
1509
1513
  // Sanity check, it shouldn't happen!
1510
1514
  throw new Error("positions or view is not defined!");