mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Add missing includes on Windows. Include GLX only on Linux. Move openxr_platform.h include to OpenXrContext.h. To make this possible, certain names from GLX/X11 need to be undefined in order to be now includable in OpenXrInput.h. Add Overte e.V. copyright. Co-authored-by: Lubosz Sarnecki <lubosz@gmail.com>
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
//
|
|
// Overte OpenXR Plugin
|
|
//
|
|
// Copyright 2024 Lubosz Sarnecki
|
|
// Copyright 2024 Overte e.V.
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
#include "plugins/RuntimePlugin.h"
|
|
#include "OpenXrDisplayPlugin.h"
|
|
#include "OpenXrInputPlugin.h"
|
|
|
|
class OpenXrProvider : public QObject, public DisplayProvider, InputProvider {
|
|
Q_OBJECT
|
|
Q_PLUGIN_METADATA(IID DisplayProvider_iid FILE "plugin.json")
|
|
Q_INTERFACES(DisplayProvider)
|
|
Q_PLUGIN_METADATA(IID InputProvider_iid FILE "plugin.json")
|
|
Q_INTERFACES(InputProvider)
|
|
|
|
public:
|
|
OpenXrProvider(QObject* parent = nullptr) : QObject(parent) {}
|
|
virtual ~OpenXrProvider() {}
|
|
std::shared_ptr<OpenXrContext> context = std::make_shared<OpenXrContext>();
|
|
|
|
virtual DisplayPluginList getDisplayPlugins() override {
|
|
static std::once_flag once;
|
|
std::call_once(once, [&] {
|
|
DisplayPluginPointer plugin(std::make_shared<OpenXrDisplayPlugin>(context));
|
|
if (plugin->isSupported()) {
|
|
_displayPlugins.push_back(plugin);
|
|
}
|
|
});
|
|
|
|
return _displayPlugins;
|
|
}
|
|
|
|
virtual InputPluginList getInputPlugins() override {
|
|
static std::once_flag once;
|
|
|
|
std::call_once(once, [&] {
|
|
InputPluginPointer plugin(std::make_shared<OpenXrInputPlugin>(context));
|
|
if (plugin->isSupported()) {
|
|
_inputPlugins.push_back(plugin);
|
|
}
|
|
});
|
|
|
|
return _inputPlugins;
|
|
}
|
|
|
|
virtual void destroyInputPlugins() override { _inputPlugins.clear(); }
|
|
|
|
virtual void destroyDisplayPlugins() override { _displayPlugins.clear(); }
|
|
|
|
private:
|
|
DisplayPluginList _displayPlugins;
|
|
InputPluginList _inputPlugins;
|
|
};
|
|
|
|
#include "OpenXrProvider.moc"
|