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

feat: add WebXR Helper widget #81

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

munozco
Copy link

@munozco munozco commented Feb 19, 2025

This adds a WebXR Helper widget to enable VtkView and VtkLocalView to be used for a WebXR session.
vue-vtk-js PR: Kitware/vue-vtk-js#9

The new VtkWebXRHelper class contains the XrSessionTypes enum that has the same values as XrSessionTypes in vtk.js.

Here's an example that uses the new VtkWebXRHelper widget in a TrameApp:

with vuetify3.VContainer(fluid=True, classes="pa-0 fill-height"):
  with vtk.VtkView() as view:
      self.xr_widget = vtk.VtkWebXRHelper(draw_controllers_ray=True, enterXR=self.ctrl.enterXR, exitXR=self.ctrl.exitXR)
      with vtk.VtkGeometryRepresentation():
          vtk.VtkAlgorithm(vtk_class="vtkConeSource")

# [...]

# start a HmdVR WebXR session
self.xr_widget.startXR(vtk.VtkWebXRHelper.XrSessionTypes.HmdVR)

# stop the session
self.xr_widget.stopXR()

@jourdain
Copy link
Collaborator

You need to update the version of vue-vtk-js in that PR

https://github.com/Kitware/trame-vtk/blob/master/.fetch_externals.sh

Copy link
Member

@finetjul finetjul left a comment

Choose a reason for hiding this comment

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

I do not understand how it knows on which view the helper applies...

@munozco
Copy link
Author

munozco commented Feb 20, 2025

The helper has a vtkView (or a vtkLocalView) as its parent. It can get the corresponding ClientView (or LocalView) thanks to the Vue.js provide/inject mechanism. For instance, the vtkView Vue component is providing the ClientView object here

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.

3 participants