Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type {
} from './chunk';

// Structural combinators (lazy views over sources)
export { bakeTransform, concatSource, selectLod, stackLods } from './ops';
export { bakeTransform, concatSource, selectLod, stackLods, sortMortonColumns, sortMortonInterleaved } from './ops';

// How a scene was trained (carried on `ChunkSourceMetadata.model`). The per-format
// spellings of the tag live with their reader/writer.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ops/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tier-1 ops over a ChunkSource (views & passes).
export { mapSource } from './map-source';
export { bakeTransform } from './bake-transform';
export { mortonOrder, sortMortonColumns } from './morton-order';
export { mortonOrder, sortMortonColumns, sortMortonInterleaved } from './morton-order';
export { permuteSource } from './permute-source';
export { stackLods } from './stack-lods';
export { selectLod, resolveLodLevels } from './select-lod';
Expand Down
11 changes: 8 additions & 3 deletions src/lib/ops/morton-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,16 @@ const sortMortonStrided = (
* Sort `indices` in place into morton (Z-order) using interleaved positions
* `[x, y, z, x, y, z, ...]` — the natural packing of the `position` layer.
*
* @param positions - Interleaved xyz; gaussian `g` is at `positions[g*3 + {0,1,2}]`.
* `stride` lets the same call sort a wider record whose first three words are
* xyz, e.g. a packed `[x, y, z, w]` GPU texture row viewed as floats, without
* copying the positions out first.
*
* @param positions - Interleaved xyz; gaussian `g` is at `positions[g*stride + {0,1,2}]`.
* @param indices - Indices to sort in place.
* @param stride - Words per gaussian in `positions` (default 3).
*/
const sortMortonInterleaved = (positions: ArrayLike<number>, indices: Uint32Array): void => {
sortMortonStrided(indices, positions, positions, positions, 3, 0, 1, 2);
const sortMortonInterleaved = (positions: ArrayLike<number>, indices: Uint32Array, stride = 3): void => {
sortMortonStrided(indices, positions, positions, positions, stride, 0, 1, 2);
};

/**
Expand Down
Loading