Skip to content

Conversation

@slimbuck
Copy link
Member

This PR makes small changes to the gsplat sort worker so it can run under nodejs.

Functionality remains unchanged.

@slimbuck slimbuck requested review from a team and Copilot June 14, 2025 13:20
@slimbuck slimbuck self-assigned this Jun 14, 2025
@slimbuck slimbuck added area: graphics Graphics related issue enhancement labels Jun 14, 2025
Copy link
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 enables the existing GSplat sorting worker to run both in browsers and under Node.js without changing its core logic.

  • Detects environment (browser vs Node) inside the worker and in the main thread
  • Replaces self/onmessage with a unified myself and branches event registration
  • Instantiates Worker differently in Node (with eval: true) vs browser (via Blob)
Comments suppressed due to low confidence (1)

src/scene/gsplat/gsplat-sorter.js:330

  • In Node.js context, Worker is not a global. You need to import or require { Worker } from 'worker_threads' before instantiating the worker.
this.worker = new Worker(workerSource, {

@slimbuck slimbuck merged commit 9eee52a into playcanvas:main Jun 16, 2025
7 checks passed
@slimbuck slimbuck deleted the node-dev branch June 16, 2025 07:58
mvaligursky pushed a commit that referenced this pull request Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants