Skip to content

Conversation

@willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Jun 13, 2025

Migrate from Application to AppBase for the pc-app element. This makes it easy to switch on WebGPU support.

This PR also allows the examples to run without throwing exceptions in non-XR capable browsers.

@willeastcott willeastcott requested a review from Copilot June 13, 2025 22:04
@willeastcott willeastcott self-assigned this Jun 13, 2025
@willeastcott willeastcott added the enhancement New feature or request label Jun 13, 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

Migrate the PlayCanvas integration from the old Application API to the new AppBase-plus-createGraphicsDevice/AppOptions pattern, enabling flexible backend switching for WebGPU support.

  • Replace all Application references with AppBase in element classes
  • Initialize graphics device separately via createGraphicsDevice and use AppOptions for app setup
  • Add optional chaining around app.xr in the example script to safely handle missing XR support

Reviewed Changes

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

File Description
src/entity.ts Switched createEntity and buildHierarchy signatures to accept AppBase instead of Application
src/app.ts Replaced direct Application creation with createGraphicsDevice + AppOptions + AppBase
examples/js/example.mjs Guard app.xr calls with optional chaining to avoid null-reference errors
Comments suppressed due to low confidence (2)

src/entity.ts:53

  • The JSDoc comment above createEntity still references Application. Please update it to mention AppBase so the docs match the new signature.
createEntity(app: AppBase) {

src/entity.ts:108

  • Similarly, update the JSDoc for buildHierarchy to use AppBase instead of Application.
buildHierarchy(app: AppBase) {

@willeastcott willeastcott merged commit ef832e7 into main Jun 15, 2025
2 checks passed
@willeastcott willeastcott deleted the appbase branch June 15, 2025 01:35
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