As for
ar_data_providers_create_with_data_providers(...)
From modifications to warrenm example (see above)
am calling
private func runWorldTrackingARSession() async {
guard let arSession else { return err("arSession") }
try? await arSession.run([worldTracking]) //WorldTrackingProvider
}
passing through the arSession and worldTracking via
public func SpatialRenderer_InitAndRun(_ layerRenderer: LayerRenderer,
_ arSession: ARKitSession,
_ worldTracking: WorldTrackingProvider) {
let renderThread = RenderThread(layerRenderer, arSession, worldTracking)
renderThread.name = "Spatial Renderer Thread"
renderThread.start()
}
called from
@main
struct FullyImmersiveMetalApp: App {
@State var session = ARKitSession() //??
@State var worldTracking = WorldTrackingProvider() //??
init() {}
var body: some Scene {
WindowGroup {
ContentView()
}
ImmersiveSpace(id: "ImmersiveSpace") {
CompositorLayer(configuration: MetalLayerConfiguration()) { layerRenderer in
SpatialRenderer_InitAndRun(layerRenderer, session, worldTracking)
}
}.immersionStyle(selection: .constant(.full), in: .full)
}
}
All swift code compile but fails at runtime. Probably in another code block. YMMV