Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: Make Animation WebXR compatible. #29783

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Nov 1, 2024

Related issue: #28968

Description

This is a first gentle step towards WebXR support in WebGPURenderer. The internal Animation module must be refactored a bit so it can be used in an upcoming XRManager module.

A native XRSession object offers similar to window a requestAnimationFrame() function. When presenting, it must be used instead of the window version. WebXRManager also overwrites the animation loop which is set on app level (via renderer.setAnimationLoop()) which is why the module currently uses an own instance of Animation.

To make this work, Animation requires start() and stop() methods as well as setContext(). setContext() is later used in XRManager with the current XR session object. _init() is replaced with start().

Copy link

github-actions bot commented Nov 1, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 692.66
171.56
692.66
171.56
+0 B
+0 B
WebGPU 822.12
221.9
822.22
221.93
+105 B
+32 B
WebGPU Nodes 821.63
221.78
821.73
221.81
+105 B
+30 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.01
112.35
465.01
112.35
+0 B
+0 B
WebGPU 542.65
146.78
542.76
146.81
+105 B
+26 B
WebGPU Nodes 498.65
136.58
498.76
136.61
+105 B
+32 B

@Mugen87 Mugen87 added this to the r171 milestone Nov 5, 2024
@Mugen87 Mugen87 merged commit c177eaf into mrdoob:dev Nov 5, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant