I am maintaining a C# WPF application, and I want to add Windows Mixed Reality support to it.
Porting the app to UWP is probably not a very good idea, as the app supports a lot of other APIs that do not have their UWP variants. For example Oculus, OSVR and OpenVR(Vive) support. I do not have enough UWP experience to sure, though.
So, any idea if it's even possible to use Mixed Reality UWP APIs in a non-UWP application? Or perhaps porting middleware API to UWP is not so scary after all?
Yes, it's possible to use UWP API in any non-UWP app because all UWP API is actually COM. I usually prefer to use C++/WinRT, but it has the limitation in C++17 language.
If the limitation is unacceptable for you, you might use the classic COM like
Microsoft::WRL::ComPtr<ABI::Windows::UI::Input::Spatial::ISpatialInteractionManagerStatics> interactionManagerStatic;
Windows::Foundation::GetActivationFactory(
Microsoft::WRL::Wrappers::HStringReference(InterfaceName_Windows_UI_Input_Spatial_ISpatialInteractionManagerStatics).Get(),
&interactionManagerStatic);
Microsoft::WRL::ComPtr<ABI::Windows::UI::Input::Spatial::ISpatialInteractionManager> interactionManager;
if (FAILED(interactionManagerStatic->GetForCurrentView(interactionManager.GetAddressOf())))
{
return -1;
}