add package files
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HVR
|
||||
{
|
||||
public class EnablePassThrough : MonoBehaviour
|
||||
{
|
||||
EHVRErrorCode hvrErr;
|
||||
EHVRSettingsError settingErr;
|
||||
//IHVRSettings_FnTable *vr_settings = (IHVRSettings_FnTable*) HVR_GetGenericInterface(IHVRSettings_Version, &hvrErr);
|
||||
public bool enable = true;
|
||||
public int blend_mode = 0;
|
||||
private int origin_blend_mode = 4;
|
||||
// Start is called before the first frame update
|
||||
private CHVRSettings vr_settings;
|
||||
|
||||
private void Awake() {
|
||||
HVRClass.Init(ref hvrErr);
|
||||
vr_settings = HVRClass.Settings;
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
if(vr_settings != null)
|
||||
{
|
||||
origin_blend_mode = vr_settings.GetInt32("camera", "cameraRoomViewMode", ref settingErr);
|
||||
Debug.Log("cameraRoomViewMode: " + origin_blend_mode);
|
||||
// Change exposure mode
|
||||
vr_settings.SetBool("camera", "cameraRoomViewAlwaysOn", enable, ref settingErr);
|
||||
if (settingErr == EHVRSettingsError.EVRSettingsError_None)
|
||||
{
|
||||
Debug.Log("Enable pass through successfully."); // Enable pass through successfully
|
||||
} else
|
||||
{
|
||||
Debug.Log("Enable pass through failed: " + settingErr);
|
||||
}
|
||||
|
||||
vr_settings.SetInt32("camera", "cameraRoomViewMode", blend_mode, ref settingErr);
|
||||
if (settingErr == EHVRSettingsError.EVRSettingsError_None)
|
||||
{
|
||||
Debug.Log("Set camera mode successfully."); // Set camera mode successfully
|
||||
} else
|
||||
{
|
||||
Debug.Log("Set camera mode failed: " + settingErr);
|
||||
}
|
||||
} else
|
||||
{
|
||||
Debug.Log("vr_settings is null.");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
if(vr_settings != null)
|
||||
{
|
||||
// Disable pass through before closing the App.
|
||||
vr_settings.SetBool("camera", "cameraRoomViewAlwaysOn", !enable, ref settingErr);
|
||||
if (settingErr == EHVRSettingsError.EVRSettingsError_None)
|
||||
{
|
||||
Debug.Log("Disable pass through.");
|
||||
}
|
||||
|
||||
vr_settings.SetInt32("camera", "cameraRoomViewMode", origin_blend_mode, ref settingErr);
|
||||
if (settingErr == EHVRSettingsError.EVRSettingsError_None)
|
||||
{
|
||||
Debug.Log("Reset cameraRoomViewMode: " + origin_blend_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9a9f8c3b3ddb4a4b80d22ea03baff18
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnablePassThrough_cmd : MonoBehaviour
|
||||
{
|
||||
private Thread enablePassThrough_t;
|
||||
private Thread disablePassThrough_t;
|
||||
string path;
|
||||
// Start is called before the first frame update
|
||||
private void Awake() {
|
||||
#if UNITY_EDITOR
|
||||
path = System.IO.Path.Combine(Directory.GetCurrentDirectory() + "\\Assets\\Samples\\VIVE OpenXR Plugin - Windows\\1.0.12\\SceneUnderstanding Example\\PassThrough Plugin\\OfflineTool.exe");
|
||||
#elif UNITY_STANDALONE
|
||||
path = System.IO.Path.Combine(Directory.GetCurrentDirectory() + "/OfflineTool.exe");
|
||||
#endif
|
||||
UnityEngine.Debug.Log(path);
|
||||
|
||||
enablePassThrough_t = new Thread(new ThreadStart(EnablePassThrough));
|
||||
enablePassThrough_t.Start();
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void EnablePassThrough()
|
||||
{
|
||||
string cmd = "PassThrough 1 0";
|
||||
RunCMD(cmd);
|
||||
UnityEngine.Debug.Log("enable pass through");
|
||||
}
|
||||
|
||||
public void DisablePassThrough()
|
||||
{
|
||||
string cmd = "PassThrough 0 4";
|
||||
RunCMD(cmd);
|
||||
}
|
||||
|
||||
public void RunCMD(string command)
|
||||
{
|
||||
Process process = new Process();
|
||||
if(System.IO.File.Exists(path))
|
||||
{
|
||||
process.StartInfo.FileName = path;
|
||||
process.StartInfo.Arguments = command;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
process.StartInfo.RedirectStandardInput = true;
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
process.StartInfo.CreateNoWindow = true;
|
||||
process.Start();
|
||||
UnityEngine.Debug.Log(process.StandardOutput.ReadToEnd());
|
||||
} else
|
||||
{
|
||||
UnityEngine.Debug.Log("OfflineTool.exe isn't exists.");
|
||||
}
|
||||
}
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
disablePassThrough_t = new Thread(new ThreadStart(DisablePassThrough));
|
||||
disablePassThrough_t.Start();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86cba7bb45e47c34f83cac2fac8ae085
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 438feafad63dc2d4491f43bd900133de
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83bd3ae3514cb0745b367f588c8bc81c
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a12b3213ee4d2a440aa0fcfeafee6dec
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c6b633080837d44d8cfd23f6d081fb5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user