Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Improved performance and reduced memory usage of `Event` class. [#12896](https://github.com/CesiumGS/cesium/pull/12896)
- Fixes vertical misalignment of glyphs in labels with small fonts [#8474](https://github.com/CesiumGS/cesium/issues/8474)
- Prevent runtime errors for certain forms of invalid PNTS files [#12872](https://github.com/CesiumGS/cesium/issues/12872)
- Improved tile selection check for Gaussian splats. Allows proper LoD rendering.

#### Additions :tada:

Expand Down
22 changes: 18 additions & 4 deletions packages/engine/Source/Scene/GaussianSplatPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,24 @@ GaussianSplatPrimitive.prototype.update = function (frameState) {
return;
}

if (
tileset._selectedTiles.length !== 0 &&
tileset._selectedTiles.length !== this.selectedTileLength
) {
const selectionChanged = () => {
const currentSelection = tileset._selectedTiles;
if (this._previousSelectionLength !== currentSelection.length) {
this._previousSelectionLength = currentSelection.length;
return true;
}
for (let i = 0; i < currentSelection.length; i++) {
if (!currentSelection[i]._wasSelectedLastFrame) {
this._previousSelectionLength = currentSelection.length;
return true;
}
}

this._previousSelectionLength = currentSelection.length;
return false;
};
Comment on lines +841 to +856
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - the update function is pretty long as-is, why not just extract this into a proper function instead of a lambda?

Copy link
Contributor

@mzschwartz5 mzschwartz5 Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other comments:

  1. Every branch of this function sets this._previousSelectionLength = currentSelection.length;, so rather than doing it 3x we do it just once, at the top.
  2. "selection" refers to a 3D tile, right? This function seems like it belongs to the tileset class, not to this class. The logic itself isn't specific to splats. It also seems like, if it were done in the tileset class, there may be a more performant way to do it that doesn't involve iterating over the whole surrent selection.

(Note that 2 is mutually exclusive with my other comment above; we can only do one or the other)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last this._previousSelectionLength = currentSelection.length; is unnecessary anyhow, because when they are not (already) equal, the first if has already kicked in.

All this should refer to selected tiles that have splat content - but this is not handled, see other issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point- actually, by the same logic, the second this._previousSelectionLength = currentSelection.length; is also unnecessary.


if (selectionChanged()) {
this._numSplats = 0;
this._positions = undefined;
this._rotations = undefined;
Expand Down