Skip to content

Unify DataTable clone and permuteRows into single clone(options?) method#194

Merged
slimbuck merged 3 commits intoplaycanvas:mainfrom
slimbuck:glb-dev
Mar 26, 2026
Merged

Unify DataTable clone and permuteRows into single clone(options?) method#194
slimbuck merged 3 commits intoplaycanvas:mainfrom
slimbuck:glb-dev

Conversation

@slimbuck
Copy link
Copy Markdown
Member

Summary

  • Merges DataTable.clone() and DataTable.permuteRows() into a single clone(options?) method that accepts optional { rows, columns } for row selection and column filtering in one call
  • Adds a coordinate-space transform in the voxel writer (180° Z-rotation) to orient data into PlayCanvas space before voxelization, using column-selective clone to avoid mutating the caller's DataTable and skip unnecessary SH transform
  • Bumps voxel metadata version from 1.0 to 1.1

API Changes

DataTable.clone(options?) now accepts an optional options object:

// Before
const copy = table.clone();
const subset = table.permuteRows(indices);

// After
const copy = table.clone();
const subset = table.clone({ rows: indices });
const projected = table.clone({ columns: ['x', 'y', 'z'] });
const both = table.clone({ rows: [0, 2, 4], columns: ['x', 'y', 'z'] });

Breaking: DataTable.permuteRows() is removed. Replace with clone({ rows }).

@slimbuck slimbuck requested review from a team and Copilot March 26, 2026 17:20
@slimbuck slimbuck self-assigned this Mar 26, 2026
@slimbuck slimbuck added the enhancement New feature or request label Mar 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates DataTable.clone() and DataTable.permuteRows() into a single clone(options?) API that supports row selection and column filtering, then updates call sites accordingly. It also adjusts voxel writing by rotating Gaussian data into PlayCanvas coordinate space before GPU voxelization and bumps the voxel metadata version.

Changes:

  • Replace permuteRows() usages with clone({ rows }) and remove the standalone permuteRows() API in favor of clone(options?).
  • Extend DataTable.clone() to optionally select rows and/or columns.
  • In writeVoxel, clone a reduced column set, apply a 180° Z rotation, and update voxel metadata version to 1.1.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/decimate.test.mjs Updates tests to use clone({ rows }) instead of permuteRows()
src/lib/writers/write-voxel.ts Rotates a cloned subset of columns into PlayCanvas space; bumps voxel version to 1.1
src/lib/writers/write-lod.ts Replaces permuteRows() with clone({ rows })
src/lib/process.ts Updates filtering to return clone({ rows })
src/lib/data-table/decimate.ts Updates row-subsetting calls to clone({ rows })
src/lib/data-table/data-table.ts Implements clone(options?) supporting row/column selection; updates docs referencing clone({ rows })

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@slimbuck slimbuck marked this pull request as ready for review March 26, 2026 18:18
@slimbuck slimbuck merged commit 9d3854d into playcanvas:main Mar 26, 2026
7 checks passed
@slimbuck slimbuck deleted the glb-dev branch March 26, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants