Skip to content
Snippets Groups Projects
Commit b7c8f2b0 authored by Lucas Gandel's avatar Lucas Gandel
Browse files

Allow users to define a custom directory to look for RemotingXR.json

parent 68a4c9d9
Branches
No related tags found
No related merge requests found
......@@ -41,7 +41,8 @@ bool vtkOpenXRManagerRemoteConnection::Initialize()
// If found, set the XR_RUNTIME_JSON environment variable. It will be used by the OpenXR loader
// to not use the system default OpenXR runtime but instead redirect to the Holographic Remoting
// OpenXR runtime.
std::string remotingXRPath = vtksys::SystemTools::FindFile("RemotingXR.json", { libDir, exeDir });
std::string remotingXRPath =
vtksys::SystemTools::FindFile("RemotingXR.json", { libDir, exeDir, this->RemotingXRDirectory });
if (remotingXRPath.empty())
{
return false;
......
......@@ -29,6 +29,18 @@ public:
bool EndInitialize() override;
bool ConnectToRemote(XrInstance instance, XrSystemId id) override;
///@{
/**
* Set/Get a custom path to look for the RemotingXR.json file provided by the
* microsoft.holographic.remoting.openxr package.
* This file sets the XR_RUNTIME_JSON environment variable used by the OpenXR loader to not use
* the system default OpenXR runtime but instead redirect to the Holographic Remoting runtime.
* Default is empty. Calling this method after initialization has no effect.
*/
vtkGetMacro(RemotingXRDirectory, std::string);
vtkSetMacro(RemotingXRDirectory, std::string);
///@}
/**
* Enable the OpenXR Remoting extension if supported.
*/
......@@ -48,6 +60,7 @@ private:
void operator=(const vtkOpenXRManagerRemoteConnection&) = delete;
std::string OldXrRuntimeEnvValue;
std::string RemotingXRDirectory;
};
VTK_ABI_NAMESPACE_END
......
......@@ -43,6 +43,22 @@ void vtkOpenXRRemotingRenderWindow::SetRemotingIPAddress(const char* host)
vtkOpenXRManager::GetInstance().GetConnectionStrategy()->SetIPAddress(host);
}
//------------------------------------------------------------------------------
void vtkOpenXRRemotingRenderWindow::SetRemotingXRDirectory(const char* path)
{
vtkOpenXRManagerRemoteConnection* connectionStrategy =
vtkOpenXRManagerRemoteConnection::SafeDownCast(
vtkOpenXRManager::GetInstance().GetConnectionStrategy());
if (!connectionStrategy)
{
vtkWarningMacro(<< "Unexpected connection strategy used by vtkOpenXRManager.");
return;
}
connectionStrategy->SetRemotingXRDirectory(path);
}
//------------------------------------------------------------------------------
void vtkOpenXRRemotingRenderWindow::Initialize()
{
......
......@@ -25,6 +25,15 @@ public:
*/
void SetRemotingIPAddress(const char* host);
/**
* Set a custom path to look for the RemotingXR.json file provided by the
* microsoft.holographic.remoting.openxr package.
* This file sets the XR_RUNTIME_JSON environment variable used by the OpenXR loader to not use
* the system default OpenXR runtime but instead redirect to the Holographic Remoting runtime.
* Default is empty. Calling this method after the window initialization has no effect.
*/
void SetRemotingXRDirectory(const char* path);
/**
* Initialize helper window resources.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment