awtterpip / bevy_oxr

Apache License 2.0
241 stars 39 forks source link

implement session creators #112

Closed awtterpip closed 4 months ago

awtterpip commented 5 months ago

This implements a new way to be able to manage xr resources easily, as well as guarantee sync rules in both pipelined, and unpipelined rendering, guaranteeing that resources will go to both worlds in the same frame always, even when pipelined rendering is enabled.

  1. Create a new type that implements OxrSessionResourceCreator. This type should have an uninitialized state. update is the method that will initialize the resource with &mut World access. SessionResourceCreators are automatically ordered so that you have access to any other session resource creators that were initialized on the app before yours. in other words, the last session resource creator added should have access to every other session resource
  2. you can then use the remaining methods to control what goes into the render world, and main world. adding methods to then drop those resources also allows automatic destruction of XR objects.
  3. finally, use the add_xr_resource_creator or init_xr_resource_creator method on App to add the resource creator.

code to check for implementation examples