VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
xrManager.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 13.10.2025.
5//
6#pragma once
7
8#include "core/eventHandler.h"
9
10namespace visutwin::canvas
11{
12 using XrErrorCallback = std::function<void(const std::string* err)>;
13
14 using MakeTickCallback = std::function<void(double, void*)>;
15
19 class XrManager : public EventHandler
20 {
21 public:
22 bool active() const { return _session != nullptr; }
23
24 // Attempts to end the XR session and optionally fires callback when the session is ended or failed to end
25 void end(XrErrorCallback callback = nullptr) {}
26
27 bool update(void* frame) { return _session != nullptr && frame != nullptr; }
28
29 void* requestAnimationFrame(const MakeTickCallback& callback) { return nullptr; }
30
31 private:
32 void* _session = nullptr;
33 };
34}
void end(XrErrorCallback callback=nullptr)
Definition xrManager.h:25
void * requestAnimationFrame(const MakeTickCallback &callback)
Definition xrManager.h:29
bool update(void *frame)
Definition xrManager.h:27
std::function< void(double, void *)> MakeTickCallback
Definition xrManager.h:14
std::function< void(const std::string *err)> XrErrorCallback
Definition xrManager.h:12