initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0fe3eb93fbf42844a9267549f4c8f855
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,32 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eaddb2a10e11d4242a02d5acc1e952dd
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package com.unity.oculus;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Build;
|
||||
import java.util.Locale;
|
||||
import com.unity3d.player.UnityPlayer;
|
||||
|
||||
public class OculusUnity implements SurfaceHolder.Callback
|
||||
{
|
||||
Activity activity;
|
||||
SurfaceView glView;
|
||||
|
||||
public void initOculus()
|
||||
{
|
||||
Log.d("Unity", "initOculus Java!");
|
||||
activity = UnityPlayer.currentActivity;
|
||||
|
||||
activity.runOnUiThread(() -> {
|
||||
glView = null;
|
||||
int surfaceViewId = activity.getResources().getIdentifier("unitySurfaceView", "id", activity.getPackageName());
|
||||
|
||||
if(surfaceViewId == 0){
|
||||
Log.e("Unity", "Failed to find SurfaceView Identifier!");
|
||||
}
|
||||
else{
|
||||
SurfaceView view = activity.findViewById(surfaceViewId);
|
||||
|
||||
if(view != null && view instanceof SurfaceView){
|
||||
glView = view;
|
||||
glView.getHolder().addCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (glView == null) {
|
||||
Log.e("Unity", "Failed to find GlView!");
|
||||
}
|
||||
|
||||
Log.d("Unity", "Oculus UI thread done.");
|
||||
|
||||
surfaceCreated(glView.getHolder().getSurface());
|
||||
});
|
||||
}
|
||||
|
||||
public void pauseOculus()
|
||||
{
|
||||
}
|
||||
|
||||
public void resumeOculus()
|
||||
{
|
||||
}
|
||||
|
||||
public void destroyOculus()
|
||||
{
|
||||
if (glView != null)
|
||||
glView.getHolder().removeCallback(this);
|
||||
}
|
||||
|
||||
private native void surfaceCreated(Surface glView);
|
||||
|
||||
public static void loadLibrary(String name) {
|
||||
Log.d("Unity", "loading library " + name);
|
||||
java.lang.System.loadLibrary(name);
|
||||
}
|
||||
|
||||
public static boolean getManifestSetting(String boolName) {
|
||||
boolean ret = false;
|
||||
|
||||
try
|
||||
{
|
||||
Activity activity = UnityPlayer.currentActivity;
|
||||
ApplicationInfo appInfo = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA);
|
||||
Bundle bundle = appInfo.metaData;
|
||||
ret = bundle.getBoolean(boolName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("Unity", "Oculus XR Plugin init error");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static boolean getLateLatching() {
|
||||
return getManifestSetting("com.unity.xr.oculus.LateLatching");
|
||||
}
|
||||
|
||||
public static boolean getLateLatchingDebug() {
|
||||
return getManifestSetting("com.unity.xr.oculus.LateLatchingDebug");
|
||||
}
|
||||
|
||||
public static boolean getLowOverheadMode() {
|
||||
return getManifestSetting("com.unity.xr.oculus.LowOverheadMode");
|
||||
}
|
||||
|
||||
public static boolean getIsOnOculusHardware() {
|
||||
String manufacturer = android.os.Build.MANUFACTURER;
|
||||
return manufacturer.toLowerCase(Locale.ENGLISH).contains("oculus");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
surfaceCreated(holder.getSurface());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 84f0340ca660f3e4d89f415b7b4afe5e
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 106a91a40ec8b3749a20262a95e1d73d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,96 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 79bba68ededa12b4487980d107e1a6c4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 1
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 0
|
||||
Exclude Editor: 1
|
||||
Exclude Linux: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude LinuxUniversal: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: LinuxUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,82 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0efee23e53927834d9302e9b93629236
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 0
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7ac43841c796ce240bfaeb5c7e068487
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,96 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 372f18573ba40ef4cbc883eaf7e75502
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 1
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 0
|
||||
Exclude Editor: 1
|
||||
Exclude Linux: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude LinuxUniversal: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: ARM64
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: LinuxUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,82 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a58f523749b4c0d48bb8a73966b4c9b0
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 0
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: ARM64
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eec1a5d7bedfd4a46bd10d6a16017743
|
||||
folderAsset: yes
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 1
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 0
|
||||
Exclude Win64: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: OSX
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXIntel
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Standalone: OSXIntel64
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: None
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ef54f9a52be74c04d8e2e5aa0590096c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>AudioPluginOculusSpatializer</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string></string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string></string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>1.64.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string></string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.64.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.64.0</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ff0abe765611ef34e8aa577eccdc8c5c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4719ff4e270c79b4d9f4c6e20a74dbba
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d56510647ccffc2409998cb2a0383b2b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
public static partial class Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Set the color scale and color offset of the eye texture layers
|
||||
/// </summary>
|
||||
/// <param name="colorScale">Scales the eye layer texture color by this Vector4.</param>
|
||||
/// <param name="colorOffset">Offsets the eye layer texture color by this Vector4</param>
|
||||
public static void SetColorScaleAndOffset(Vector4 colorScale, Vector4 colorOffset)
|
||||
{
|
||||
NativeMethods.SetColorScale(colorScale.x, colorScale.y, colorScale.z, colorScale.w);
|
||||
NativeMethods.SetColorOffset(colorOffset.x, colorOffset.y, colorOffset.z, colorOffset.w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 85c096871d5cdcf489edc1a740aa8011
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
public static partial class Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the type of the current headset
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static SystemHeadset GetSystemHeadsetType()
|
||||
{
|
||||
return NativeMethods.GetSystemHeadsetType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 543baada3327a254a92e8fde6bba5553
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
196
Library/PackageCache/com.unity.xr.oculus@4.0.0/Runtime/FFR.cs
Normal file
196
Library/PackageCache/com.unity.xr.oculus@4.0.0/Runtime/FFR.cs
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Android;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
public static partial class Utils
|
||||
{
|
||||
static void PermissionGrantedCallback(string permissionName)
|
||||
{
|
||||
if (permissionName == "com.oculus.permission.EYE_TRACKING")
|
||||
{
|
||||
NativeMethods.SetEyeTrackedFoveatedRenderingEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the user has allowed the Eye Tracking permission.
|
||||
/// </summary>
|
||||
public static bool IsEyeTrackingPermissionGranted()
|
||||
{
|
||||
return Permission.HasUserAuthorizedPermission("com.oculus.permission.EYE_TRACKING");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dynamic foveated rendering which will change the foveated rendering level automatically based on the current performance.
|
||||
/// Works for both FFR and ETFR.
|
||||
/// </summary>
|
||||
public static bool useDynamicFoveatedRendering
|
||||
{
|
||||
get
|
||||
{
|
||||
return NativeMethods.GetTiledMultiResSupported();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!NativeMethods.GetTiledMultiResSupported())
|
||||
{
|
||||
Debug.LogWarning("Can't enable dynamic FFR on current platform");
|
||||
}
|
||||
|
||||
NativeMethods.SetTiledMultiResDynamic(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the foveated rendering level. This works for both FFR and ETFR
|
||||
/// level can be 0, 1, 2, 3, or 4:
|
||||
///
|
||||
/// * -1 (get) not supported on current platform
|
||||
/// * 0 foveated rendering disabled
|
||||
/// * 1 low foveated rendering level
|
||||
/// * 2 medium foveated rendering level
|
||||
/// * 3 high foveated rendering level
|
||||
/// * 4 high top foveated rendering level
|
||||
/// </summary>
|
||||
public static int foveatedRenderingLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!NativeMethods.GetTiledMultiResSupported())
|
||||
{
|
||||
Debug.LogWarning("Can't get foveation level on current platform");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return NativeMethods.GetTiledMultiResLevel();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!NativeMethods.GetTiledMultiResSupported())
|
||||
{
|
||||
Debug.LogWarning("Can't set foveation level on current platform");
|
||||
}
|
||||
|
||||
NativeMethods.SetTiledMultiResLevel(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether or not eye tracked foveated rendering (ETFR) is supported.
|
||||
/// You cannot enable ETFR using eyeTrackedFoveatedRenderingEnabled if the feature isn't supported.
|
||||
/// </summary>
|
||||
public static bool eyeTrackedFoveatedRenderingSupported
|
||||
{
|
||||
get
|
||||
{
|
||||
return NativeMethods.GetEyeTrackedFoveatedRenderingSupported();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether eye tracked foveated rendering is enabled or not.
|
||||
/// </summary>
|
||||
public static bool eyeTrackedFoveatedRenderingEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
if (eyeTrackedFoveatedRenderingSupported)
|
||||
return NativeMethods.GetEyeTrackedFoveatedRenderingEnabled();
|
||||
return false;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (eyeTrackedFoveatedRenderingSupported)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
if (IsEyeTrackingPermissionGranted())
|
||||
{
|
||||
NativeMethods.SetEyeTrackedFoveatedRenderingEnabled(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
var permissionCallbacks = new PermissionCallbacks();
|
||||
permissionCallbacks.PermissionGranted += PermissionGrantedCallback;
|
||||
Permission.RequestUserPermission("com.oculus.permission.EYE_TRACKING", permissionCallbacks);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NativeMethods.SetEyeTrackedFoveatedRenderingEnabled(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the degree of foveation. Only supported on mobile. See [Oculus Documention](https://developer.oculus.com/documentation/quest/latest/concepts/mobile-ffr/).
|
||||
/// </summary>
|
||||
/// <param name="level">
|
||||
/// level can be 0, 1, 2, 3, or 4:
|
||||
///
|
||||
/// * 0 disables foveated rendering
|
||||
/// * 1 low foveated rendering level
|
||||
/// * 2 medium foveated rendering level
|
||||
/// * 3 high foveated rendering level
|
||||
/// * 4 high top foveated rendering level
|
||||
/// </param>
|
||||
[Obsolete("Please use foveatedRenderingLevel instead.", false)]
|
||||
public static bool SetFoveationLevel(int level)
|
||||
{
|
||||
if (!NativeMethods.GetTiledMultiResSupported())
|
||||
{
|
||||
Debug.LogWarning("Can't set foveation level on current platform");
|
||||
return false;
|
||||
}
|
||||
|
||||
NativeMethods.SetTiledMultiResLevel(level);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable dynamic foveated rendering. Only supported on mobile. See [Oculus Documention](https://developer.oculus.com/documentation/quest/latest/concepts/mobile-ffr/).
|
||||
/// </summary>
|
||||
/// <param name="enable">
|
||||
/// Set to true to enable dynamic foveated rendering or false to disable it.
|
||||
/// </param>
|
||||
[Obsolete("Please use useDynamicFoveatedRendering instead", false)]
|
||||
public static bool EnableDynamicFFR(bool enable)
|
||||
{
|
||||
if (!NativeMethods.GetTiledMultiResSupported())
|
||||
{
|
||||
Debug.LogWarning("Can't enable dynamic FFR on current platform");
|
||||
return false;
|
||||
}
|
||||
|
||||
NativeMethods.SetTiledMultiResDynamic(enable);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the level of foveated rendering. Only supported on mobile. See [Oculus Documentation](https://developer.oculus.com/documentation/quest/latest/concepts/mobile-ffr/).
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// * -1 error
|
||||
/// * 0 disables foveated rendering
|
||||
/// * 1 low foveated rendering level
|
||||
/// * 2 medium foveated rendering level
|
||||
/// * 3 high foveated rendering level
|
||||
/// * 4 high top foveated rendering level
|
||||
/// </returns>
|
||||
[Obsolete("Please use foveatedRenderingLevel instead.", false)]
|
||||
public static int GetFoveationLevel()
|
||||
{
|
||||
if (!NativeMethods.GetTiledMultiResSupported())
|
||||
{
|
||||
Debug.LogWarning("Can't get foveation level on current platform");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return NativeMethods.GetTiledMultiResLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4e81e5497d1f44a31b53aee2dbb30704
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
public class InputFocus
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when Input Focus is acquired. The application is the foreground application and receives input.
|
||||
/// </summary>
|
||||
public static event Action InputFocusAcquired;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when Input Focus is lost. The application is in the background (but possibly still visible), while the Universal Menu is up.
|
||||
/// </summary>
|
||||
public static event Action InputFocusLost;
|
||||
|
||||
private static bool hadInputFocus = false;
|
||||
|
||||
internal static bool hasInputFocus
|
||||
{
|
||||
get
|
||||
{
|
||||
return NativeMethods.GetHasInputFocus();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Update()
|
||||
{
|
||||
bool appHasInputFocus = hasInputFocus;
|
||||
if (!appHasInputFocus && hadInputFocus)
|
||||
{
|
||||
if (InputFocusLost != null)
|
||||
InputFocusLost();
|
||||
}
|
||||
|
||||
if (appHasInputFocus && !hadInputFocus)
|
||||
{
|
||||
if (InputFocusAcquired != null)
|
||||
InputFocusAcquired();
|
||||
}
|
||||
|
||||
hadInputFocus = appHasInputFocus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e9100f92c50a498e8556560e090205e3
|
||||
timeCreated: 1619214878
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d5cc3bbf5998a3c4494688b9de505a96
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,394 @@
|
|||
#if UNITY_INPUT_SYSTEM || PACKAGE_DOCS_GENERATION
|
||||
using UnityEngine.Scripting;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Controls;
|
||||
using UnityEngine.InputSystem.Layouts;
|
||||
|
||||
#if ENABLE_VR || PACKAGE_DOCS_GENERATION
|
||||
using UnityEngine.InputSystem.XR;
|
||||
#endif
|
||||
|
||||
namespace Unity.XR.Oculus.Input
|
||||
{
|
||||
#if ENABLE_VR || PACKAGE_DOCS_GENERATION
|
||||
/// <summary>
|
||||
/// An Oculus VR headset (such as the Oculus Rift series of devices).
|
||||
/// </summary>
|
||||
[Preserve]
|
||||
[InputControlLayout(displayName = "Oculus Headset")]
|
||||
public class OculusHMD : XRHMD
|
||||
{
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl userPresence { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "devicetrackingstate" })]
|
||||
public new IntegerControl trackingState { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "deviceistracked" })]
|
||||
public new ButtonControl isTracked { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new Vector3Control devicePosition { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new QuaternionControl deviceRotation { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control deviceAngularVelocity { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control deviceAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control deviceAngularAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new Vector3Control leftEyePosition { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new QuaternionControl leftEyeRotation { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control leftEyeAngularVelocity { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control leftEyeAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control leftEyeAngularAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new Vector3Control rightEyePosition { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new QuaternionControl rightEyeRotation { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control rightEyeAngularVelocity { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control rightEyeAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control rightEyeAngularAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new Vector3Control centerEyePosition { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new QuaternionControl centerEyeRotation { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control centerEyeAngularVelocity { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control centerEyeAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control centerEyeAngularAcceleration { get; private set; }
|
||||
|
||||
|
||||
protected override void FinishSetup()
|
||||
{
|
||||
base.FinishSetup();
|
||||
|
||||
userPresence = GetChildControl<ButtonControl>("userPresence");
|
||||
trackingState = GetChildControl<IntegerControl>("trackingState");
|
||||
isTracked = GetChildControl<ButtonControl>("isTracked");
|
||||
devicePosition = GetChildControl<Vector3Control>("devicePosition");
|
||||
deviceRotation = GetChildControl<QuaternionControl>("deviceRotation");
|
||||
deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
|
||||
deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
|
||||
deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration");
|
||||
leftEyePosition = GetChildControl<Vector3Control>("leftEyePosition");
|
||||
leftEyeRotation = GetChildControl<QuaternionControl>("leftEyeRotation");
|
||||
leftEyeAngularVelocity = GetChildControl<Vector3Control>("leftEyeAngularVelocity");
|
||||
leftEyeAcceleration = GetChildControl<Vector3Control>("leftEyeAcceleration");
|
||||
leftEyeAngularAcceleration = GetChildControl<Vector3Control>("leftEyeAngularAcceleration");
|
||||
rightEyePosition = GetChildControl<Vector3Control>("rightEyePosition");
|
||||
rightEyeRotation = GetChildControl<QuaternionControl>("rightEyeRotation");
|
||||
rightEyeAngularVelocity = GetChildControl<Vector3Control>("rightEyeAngularVelocity");
|
||||
rightEyeAcceleration = GetChildControl<Vector3Control>("rightEyeAcceleration");
|
||||
rightEyeAngularAcceleration = GetChildControl<Vector3Control>("rightEyeAngularAcceleration");
|
||||
centerEyePosition = GetChildControl<Vector3Control>("centerEyePosition");
|
||||
centerEyeRotation = GetChildControl<QuaternionControl>("centerEyeRotation");
|
||||
centerEyeAngularVelocity = GetChildControl<Vector3Control>("centerEyeAngularVelocity");
|
||||
centerEyeAcceleration = GetChildControl<Vector3Control>("centerEyeAcceleration");
|
||||
centerEyeAngularAcceleration = GetChildControl<Vector3Control>("centerEyeAngularAcceleration");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An Oculus Touch controller.
|
||||
/// </summary>
|
||||
[Preserve]
|
||||
[InputControlLayout(displayName = "Oculus Touch Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
|
||||
public class OculusTouchController : XRControllerWithRumble
|
||||
{
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "Primary2DAxis", "Joystick" })]
|
||||
public Vector2Control thumbstick { get; private set; }
|
||||
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public AxisControl trigger { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public AxisControl grip { get; private set; }
|
||||
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "A", "X", "Alternate" })]
|
||||
public ButtonControl primaryButton { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "B", "Y", "Primary" })]
|
||||
public ButtonControl secondaryButton { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "GripButton" })]
|
||||
public ButtonControl gripPressed { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl start { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "JoystickOrPadPressed", "thumbstickClick" })]
|
||||
public ButtonControl thumbstickClicked { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "ATouched", "XTouched", "ATouch", "XTouch" })]
|
||||
public ButtonControl primaryTouched { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "BTouched", "YTouched", "BTouch", "YTouch" })]
|
||||
public ButtonControl secondaryTouched { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "indexTouch", "indexNearTouched" })]
|
||||
public AxisControl triggerTouched { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "indexButton", "indexTouched" })]
|
||||
public ButtonControl triggerPressed { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "JoystickOrPadTouched", "thumbstickTouch" })]
|
||||
public ButtonControl thumbstickTouched { get; private set; }
|
||||
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "controllerTrackingState" })]
|
||||
public new IntegerControl trackingState { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "ControllerIsTracked" })]
|
||||
public new ButtonControl isTracked { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "controllerPosition" })]
|
||||
public new Vector3Control devicePosition { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "controllerRotation" })]
|
||||
public new QuaternionControl deviceRotation { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "controllerVelocity" })]
|
||||
public Vector3Control deviceVelocity { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "controllerAngularVelocity" })]
|
||||
public Vector3Control deviceAngularVelocity { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "controllerAcceleration" })]
|
||||
public Vector3Control deviceAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "controllerAngularAcceleration" })]
|
||||
public Vector3Control deviceAngularAcceleration { get; private set; }
|
||||
|
||||
protected override void FinishSetup()
|
||||
{
|
||||
base.FinishSetup();
|
||||
|
||||
thumbstick = GetChildControl<Vector2Control>("thumbstick");
|
||||
trigger = GetChildControl<AxisControl>("trigger");
|
||||
triggerTouched = GetChildControl<AxisControl>("triggerTouched");
|
||||
grip = GetChildControl<AxisControl>("grip");
|
||||
|
||||
primaryButton = GetChildControl<ButtonControl>("primaryButton");
|
||||
secondaryButton = GetChildControl<ButtonControl>("secondaryButton");
|
||||
gripPressed = GetChildControl<ButtonControl>("gripPressed");
|
||||
start = GetChildControl<ButtonControl>("start");
|
||||
thumbstickClicked = GetChildControl<ButtonControl>("thumbstickClicked");
|
||||
primaryTouched = GetChildControl<ButtonControl>("primaryTouched");
|
||||
secondaryTouched = GetChildControl<ButtonControl>("secondaryTouched");
|
||||
thumbstickTouched = GetChildControl<ButtonControl>("thumbstickTouched");
|
||||
triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
|
||||
|
||||
trackingState = GetChildControl<IntegerControl>("trackingState");
|
||||
isTracked = GetChildControl<ButtonControl>("isTracked");
|
||||
devicePosition = GetChildControl<Vector3Control>("devicePosition");
|
||||
deviceRotation = GetChildControl<QuaternionControl>("deviceRotation");
|
||||
deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
|
||||
deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
|
||||
deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
|
||||
deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[Preserve]
|
||||
[InputControlLayout(displayName = "Oculus Tracking Reference")]
|
||||
public class OculusTrackingReference : InputDevice
|
||||
{
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "trackingReferenceTrackingState" })]
|
||||
public IntegerControl trackingState { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl(aliases = new[] { "trackingReferenceIsTracked" })]
|
||||
public ButtonControl isTracked { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control devicePosition { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public QuaternionControl deviceRotation { get; private set; }
|
||||
|
||||
protected override void FinishSetup()
|
||||
{
|
||||
base.FinishSetup();
|
||||
|
||||
trackingState = GetChildControl<IntegerControl>("trackingState");
|
||||
isTracked = GetChildControl<ButtonControl>("isTracked");
|
||||
devicePosition = GetChildControl<Vector3Control>("devicePosition");
|
||||
deviceRotation = GetChildControl<QuaternionControl>("deviceRotation");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An Oculus Remote controller.
|
||||
/// </summary>
|
||||
[Preserve]
|
||||
[InputControlLayout(displayName = "Oculus Remote")]
|
||||
public class OculusRemote : InputDevice
|
||||
{
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl back { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl start { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector2Control touchpad { get; private set; }
|
||||
|
||||
protected override void FinishSetup()
|
||||
{
|
||||
base.FinishSetup();
|
||||
|
||||
back = GetChildControl<ButtonControl>("back");
|
||||
start = GetChildControl<ButtonControl>("start");
|
||||
touchpad = GetChildControl<Vector2Control>("touchpad");
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_VR || PACKAGE_DOCS_GENERATION
|
||||
/// <summary>
|
||||
/// An Oculus Go controller.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Go is no longer supported in 2020.1+ and this will be removed in a future Oculus XR Plugin.
|
||||
/// </remarks>
|
||||
[Preserve]
|
||||
[InputControlLayout(hideInUI = true, displayName = "Oculus Go Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
|
||||
public class OculusGoController : GearVRTrackedController
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Standalone VR headset that includes on-headset controls.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This device was never supported by the Oculus XR Plugin and will be removed in a future Oculus XR Plugin.
|
||||
/// </remarks>
|
||||
[Preserve]
|
||||
[InputControlLayout(hideInUI = true, displayName = "Oculus Headset (w/ on-headset controls)")]
|
||||
public class OculusHMDExtended : OculusHMD
|
||||
{
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl back { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector2Control touchpad { get; private set; }
|
||||
|
||||
protected override void FinishSetup()
|
||||
{
|
||||
base.FinishSetup();
|
||||
|
||||
back = GetChildControl<ButtonControl>("back");
|
||||
touchpad = GetChildControl<Vector2Control>("touchpad");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Gear VR controller.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This device was never supported by the Oculus XR Plugin and will be removed in a future Oculus XR Plugin.
|
||||
/// Use OculusGoController instead if targeting the Oculus Go.
|
||||
/// </remarks>
|
||||
[Preserve]
|
||||
[InputControlLayout(hideInUI = true, displayName = "GearVR Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
|
||||
public class GearVRTrackedController : XRController
|
||||
{
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector2Control touchpad { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public AxisControl trigger { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl back { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl triggerPressed { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl touchpadClicked { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public ButtonControl touchpadTouched { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new IntegerControl trackingState { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new ButtonControl isTracked { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new Vector3Control devicePosition { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public new QuaternionControl deviceRotation { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control deviceAngularVelocity { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control deviceAcceleration { get; private set; }
|
||||
[Preserve]
|
||||
[InputControl]
|
||||
public Vector3Control deviceAngularAcceleration { get; private set; }
|
||||
|
||||
protected override void FinishSetup()
|
||||
{
|
||||
base.FinishSetup();
|
||||
|
||||
touchpad = GetChildControl<Vector2Control>("touchpad");
|
||||
trigger = GetChildControl<AxisControl>("trigger");
|
||||
back = GetChildControl<ButtonControl>("back");
|
||||
triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
|
||||
touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
|
||||
touchpadTouched = GetChildControl<ButtonControl>("touchpadTouched");
|
||||
|
||||
trackingState = GetChildControl<IntegerControl>("trackingState");
|
||||
isTracked = GetChildControl<ButtonControl>("isTracked");
|
||||
devicePosition = GetChildControl<Vector3Control>("devicePosition");
|
||||
deviceRotation = GetChildControl<QuaternionControl>("deviceRotation");
|
||||
deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
|
||||
deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
|
||||
deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3d1f4a47ef459d14d9aeadd495127314
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
public static class Boundary
|
||||
{
|
||||
public enum BoundaryType
|
||||
{
|
||||
/// <summary>
|
||||
/// Outer Boundary - axis-aligned rectangular bounding box enclosing the outer boundary.
|
||||
/// </summary>
|
||||
OuterBoundary = 0,
|
||||
/// <summary>
|
||||
/// Play area - axis-aligned smaller rectangle area inside outer boundary where gameplay happens.
|
||||
/// </summary>
|
||||
PlayArea = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the boundary system is currently configured with valid boundary data.
|
||||
/// </summary>
|
||||
public static bool GetBoundaryConfigured()
|
||||
{
|
||||
return NativeMethods.GetBoundaryConfigured();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a vector of the spatial dimensions of the specified boundary type. (x = width, y = height, z = depth) with height always returning 0.
|
||||
/// Return true if boundary dimensions are supported and values are available. Return false otherwise.
|
||||
/// </summary>
|
||||
public static bool GetBoundaryDimensions(BoundaryType boundaryType, out Vector3 dimensions)
|
||||
{
|
||||
return NativeMethods.GetBoundaryDimensions(boundaryType, out dimensions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the boundary system is currently visible. Return false otherwise.
|
||||
/// </summary>
|
||||
public static bool GetBoundaryVisible()
|
||||
{
|
||||
return NativeMethods.GetBoundaryVisible();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests that the boundary system visibility be set to the specified value.
|
||||
/// The actual visibility can be overridden by the system (i.e., proximity trigger) or by the user (boundary system disabled)
|
||||
/// </summary>
|
||||
public static void SetBoundaryVisible(bool boundaryVisible)
|
||||
{
|
||||
NativeMethods.SetBoundaryVisible(boundaryVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2ad7b5d1570eccf478da00e0a20a6f96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
public static class Development
|
||||
{
|
||||
private enum UserDeveloperModeSettingCache
|
||||
{
|
||||
NoUserSettingCached = 0,
|
||||
UserSettingFalse = 1,
|
||||
UserSettingTrue = 2
|
||||
}
|
||||
|
||||
private static UserDeveloperModeSettingCache s_CachedMode = UserDeveloperModeSettingCache.NoUserSettingCached;
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable developer mode, default enable in development build
|
||||
/// </summary>
|
||||
public static void TrySetDeveloperMode(bool active)
|
||||
{
|
||||
//cache this setting to use it in Start() only
|
||||
s_CachedMode = active ? UserDeveloperModeSettingCache.UserSettingTrue : UserDeveloperModeSettingCache.UserSettingFalse;
|
||||
}
|
||||
|
||||
internal static void OverrideDeveloperModeStart()
|
||||
{
|
||||
bool enable = true;
|
||||
bool shouldOverride = false;
|
||||
if (s_CachedMode != UserDeveloperModeSettingCache.NoUserSettingCached)
|
||||
{
|
||||
shouldOverride = true;
|
||||
enable = (s_CachedMode == UserDeveloperModeSettingCache.UserSettingTrue);
|
||||
}
|
||||
else if (Debug.isDebugBuild)
|
||||
shouldOverride = true;
|
||||
|
||||
if (shouldOverride && !NativeMethods.SetDeveloperModeStrict(enable))
|
||||
Debug.LogError("Failed to set DeveloperMode on Start.");
|
||||
}
|
||||
|
||||
internal static void OverrideDeveloperModeStop()
|
||||
{
|
||||
if (!NativeMethods.SetDeveloperModeStrict(false))
|
||||
Debug.LogError("Failed to set DeveloperMode to false on Stop.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4abcfd9badad03e41a7ddc6909d0c137
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,477 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Android;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.XR.Management;
|
||||
using UnityEngine.XR;
|
||||
#if UNITY_INPUT_SYSTEM && ENABLE_VR
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Layouts;
|
||||
using UnityEngine.InputSystem.XR;
|
||||
using Unity.XR.Oculus.Input;
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
#if UNITY_INPUT_SYSTEM && ENABLE_VR
|
||||
#if UNITY_EDITOR
|
||||
[InitializeOnLoad]
|
||||
#endif
|
||||
static class InputLayoutLoader
|
||||
{
|
||||
static InputLayoutLoader()
|
||||
{
|
||||
RegisterInputLayouts();
|
||||
}
|
||||
|
||||
public static void RegisterInputLayouts()
|
||||
{
|
||||
InputSystem.RegisterLayout<OculusHMD>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface(XRUtilities.InterfaceMatchAnyVersion)
|
||||
.WithProduct("^(Oculus Rift)|^(Oculus Quest)|^(Oculus Go)"));
|
||||
InputSystem.RegisterLayout<OculusTouchController>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface(XRUtilities.InterfaceMatchAnyVersion)
|
||||
.WithProduct(@"(^(Oculus Touch Controller))|(^(Oculus Quest Controller))"));
|
||||
InputSystem.RegisterLayout<OculusRemote>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface(XRUtilities.InterfaceMatchAnyVersion)
|
||||
.WithProduct(@"Oculus Remote"));
|
||||
InputSystem.RegisterLayout<OculusTrackingReference>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface(XRUtilities.InterfaceMatchAnyVersion)
|
||||
.WithProduct(@"((Tracking Reference)|(^(Oculus Rift [a-zA-Z0-9]* \(Camera)))"));
|
||||
InputSystem.RegisterLayout<OculusGoController>(
|
||||
matches: new InputDeviceMatcher()
|
||||
.WithInterface(XRUtilities.InterfaceMatchAnyVersion)
|
||||
.WithProduct("^(Oculus Tracked Remote)"));
|
||||
|
||||
InputSystem.RegisterLayout<OculusHMDExtended>();
|
||||
InputSystem.RegisterLayout<GearVRTrackedController>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public class OculusLoader : XRLoaderHelper
|
||||
#if UNITY_EDITOR
|
||||
, IXRLoaderPreInit
|
||||
#endif
|
||||
{
|
||||
private enum DeviceSupportedResult
|
||||
{
|
||||
Supported, // we should attempt to initialize and run in VR
|
||||
NotSupported, // we shouldn't attempt to initialize on this device, and should run in non-VR
|
||||
ExitApplication // we're built for VR, but are on a non-Oculus Android device and should exit the application
|
||||
};
|
||||
|
||||
static DeviceSupportedResult IsDeviceSupported()
|
||||
{
|
||||
#if !ENABLE_VR
|
||||
return DeviceSupportedResult.NotSupported;
|
||||
#elif UNITY_EDITOR_WIN
|
||||
return DeviceSupportedResult.Supported;
|
||||
#elif (UNITY_STANDALONE_WIN && !UNITY_EDITOR)
|
||||
return DeviceSupportedResult.Supported;
|
||||
#elif (UNITY_ANDROID && !UNITY_EDITOR)
|
||||
try
|
||||
{
|
||||
if (NativeMethods.GetIsSupportedDevice())
|
||||
return DeviceSupportedResult.Supported;
|
||||
else
|
||||
return DeviceSupportedResult.ExitApplication;
|
||||
}
|
||||
catch(DllNotFoundException)
|
||||
{
|
||||
// return NotSupported since we've been built with Oculus XR Plugin disabled
|
||||
return DeviceSupportedResult.NotSupported;
|
||||
}
|
||||
#else
|
||||
return DeviceSupportedResult.NotSupported;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLE_VR
|
||||
private static List<XRDisplaySubsystemDescriptor> s_DisplaySubsystemDescriptors = new List<XRDisplaySubsystemDescriptor>();
|
||||
private static List<XRInputSubsystemDescriptor> s_InputSubsystemDescriptors = new List<XRInputSubsystemDescriptor>();
|
||||
|
||||
public XRDisplaySubsystem displaySubsystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetLoadedSubsystem<XRDisplaySubsystem>();
|
||||
}
|
||||
}
|
||||
|
||||
public XRInputSubsystem inputSubsystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetLoadedSubsystem<XRInputSubsystem>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public override bool Initialize()
|
||||
{
|
||||
if (!CheckUnityVersionCompatibility())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsDeviceSupported() != DeviceSupportedResult.Supported
|
||||
#if UNITY_EDITOR_WIN
|
||||
|| SystemInfo.graphicsDeviceType != GraphicsDeviceType.Direct3D11
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if ENABLE_VR
|
||||
#if UNITY_INPUT_SYSTEM
|
||||
InputLayoutLoader.RegisterInputLayouts();
|
||||
#endif
|
||||
|
||||
OculusSettings settings = GetSettings();
|
||||
|
||||
if (settings != null)
|
||||
{
|
||||
NativeMethods.UserDefinedSettings userDefinedSettings;
|
||||
userDefinedSettings.sharedDepthBuffer = (ushort)(settings.SharedDepthBuffer ? 1 : 0);
|
||||
userDefinedSettings.dashSupport = (ushort)(settings.DashSupport ? 1 : 0);
|
||||
userDefinedSettings.stereoRenderingMode = (ushort)settings.GetStereoRenderingMode();
|
||||
userDefinedSettings.colorSpace = (ushort)((QualitySettings.activeColorSpace == ColorSpace.Linear) ? 1 : 0);
|
||||
userDefinedSettings.lowOverheadMode = (ushort)(settings.LowOverheadMode ? 1 : 0);
|
||||
userDefinedSettings.optimizeBufferDiscards = (ushort)(settings.OptimizeBufferDiscards ? 1 : 0);
|
||||
userDefinedSettings.phaseSync = (ushort)(settings.PhaseSync ? 1 : 0);
|
||||
userDefinedSettings.symmetricProjection = (ushort)(settings.SymmetricProjection ? 1 : 0);
|
||||
userDefinedSettings.subsampledLayout = (ushort)(settings.SubsampledLayout ? 1 : 0);
|
||||
userDefinedSettings.foveatedRenderingMethod = (ushort)settings.FoveatedRenderingMethod;
|
||||
userDefinedSettings.lateLatching = (ushort)(settings.LateLatching ? 1 : 0);
|
||||
userDefinedSettings.lateLatchingDebug = (ushort)(settings.LateLatchingDebug ? 1 : 0);
|
||||
userDefinedSettings.enableTrackingOriginStageMode = (ushort)(settings.EnableTrackingOriginStageMode ? 1 : 0);
|
||||
#if (UNITY_ANDROID && !UNITY_EDITOR)
|
||||
userDefinedSettings.spaceWarp = (ushort)(settings.SpaceWarp ? 1 : 0);
|
||||
userDefinedSettings.depthSubmission = (ushort)(settings.DepthSubmission ? 1 : 0);
|
||||
#else
|
||||
userDefinedSettings.spaceWarp = 0;
|
||||
userDefinedSettings.depthSubmission = 0;
|
||||
#endif
|
||||
NativeMethods.SetUserDefinedSettings(userDefinedSettings);
|
||||
}
|
||||
|
||||
CreateSubsystem<XRDisplaySubsystemDescriptor, XRDisplaySubsystem>(s_DisplaySubsystemDescriptors, "oculus display");
|
||||
CreateSubsystem<XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "oculus input");
|
||||
|
||||
if (displaySubsystem == null && inputSubsystem == null)
|
||||
{
|
||||
#if (UNITY_ANDROID && !UNITY_EDITOR)
|
||||
Debug.LogWarning("Unable to start Oculus XR Plugin.");
|
||||
#else
|
||||
Debug.LogWarning("Unable to start Oculus XR Plugin.\n" +
|
||||
"Possible causes include a headset not being attached, or the Oculus runtime is not installed or up to date.\n" +
|
||||
"If you've recently installed or updated the Oculus runtime, you may need to reboot or close Unity and the Unity Hub and try again.");
|
||||
#endif
|
||||
}
|
||||
else if (displaySubsystem == null)
|
||||
{
|
||||
Debug.LogError("Unable to start Oculus XR Plugin. Failed to load display subsystem.");
|
||||
}
|
||||
else if (inputSubsystem == null)
|
||||
{
|
||||
Debug.LogError("Unable to start Oculus XR Plugin. Failed to load input subsystem.");
|
||||
}
|
||||
else
|
||||
{
|
||||
RegisterUpdateCallback.Initialize();
|
||||
}
|
||||
|
||||
return displaySubsystem != null && inputSubsystem != null;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override bool Start()
|
||||
{
|
||||
#if ENABLE_VR
|
||||
StartSubsystem<XRDisplaySubsystem>();
|
||||
StartSubsystem<XRInputSubsystem>();
|
||||
#endif
|
||||
Development.OverrideDeveloperModeStart();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Stop()
|
||||
{
|
||||
#if ENABLE_VR
|
||||
StopSubsystem<XRDisplaySubsystem>();
|
||||
StopSubsystem<XRInputSubsystem>();
|
||||
#endif
|
||||
Development.OverrideDeveloperModeStop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Deinitialize()
|
||||
{
|
||||
RegisterUpdateCallback.Deinitialize();
|
||||
|
||||
#if ENABLE_VR
|
||||
DestroySubsystem<XRDisplaySubsystem>();
|
||||
DestroySubsystem<XRInputSubsystem>();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR_WIN
|
||||
[InitializeOnLoadMethod]
|
||||
static void EditorLoadOVRPlugin()
|
||||
{
|
||||
string ovrpPath = "";
|
||||
|
||||
// loop over all the native plugin importers and find the OVRPlugin the editor should use
|
||||
var importers = PluginImporter.GetAllImporters();
|
||||
foreach (var importer in importers)
|
||||
{
|
||||
if (!importer.GetCompatibleWithEditor() || !importer.assetPath.Contains("OVRPlugin"))
|
||||
continue;
|
||||
|
||||
if (!importer.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows64) || !importer.assetPath.EndsWith(".dll"))
|
||||
continue;
|
||||
|
||||
ovrpPath = importer.assetPath;
|
||||
|
||||
if (!importer.GetIsOverridable())
|
||||
break;
|
||||
}
|
||||
|
||||
if (ovrpPath == "")
|
||||
{
|
||||
Debug.LogError("Couldn't locate OVRPlugin.dll");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NativeMethods.LoadOVRPlugin(AssetPathToAbsolutePath(ovrpPath)))
|
||||
{
|
||||
Debug.LogError("Failed to load OVRPlugin.dll");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static string AssetPathToAbsolutePath(string assetPath)
|
||||
{
|
||||
var path = assetPath.Replace('/', Path.DirectorySeparatorChar);
|
||||
|
||||
if (assetPath.StartsWith("Packages"))
|
||||
{
|
||||
path = String.Join(Path.DirectorySeparatorChar.ToString(), path.Split(Path.DirectorySeparatorChar).Skip(2));
|
||||
|
||||
return Path.Combine(UnityEditor.PackageManager.PackageInfo.FindForAssetPath(assetPath).resolvedPath, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
string assetsPath = Application.dataPath;
|
||||
assetsPath = assetsPath.Replace('/', Path.DirectorySeparatorChar);
|
||||
|
||||
if (assetsPath.EndsWith("Assets"))
|
||||
{
|
||||
assetsPath = assetsPath.Substring(0, assetsPath.LastIndexOf("Assets"));
|
||||
}
|
||||
|
||||
return Path.Combine(assetsPath, assetPath);
|
||||
}
|
||||
}
|
||||
#elif (UNITY_STANDALONE_WIN && !UNITY_EDITOR)
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
|
||||
static void RuntimeLoadOVRPlugin()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!NativeMethods.LoadOVRPlugin(""))
|
||||
Debug.LogError("Failed to load OVRPlugin.dll");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// handle Windows standalone build with Oculus XR Plugin installed but disabled in loader list.
|
||||
}
|
||||
}
|
||||
#elif (UNITY_ANDROID && !UNITY_EDITOR)
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
|
||||
static void RuntimeLoadOVRPlugin()
|
||||
{
|
||||
var supported = IsDeviceSupported();
|
||||
|
||||
if (supported == DeviceSupportedResult.ExitApplication)
|
||||
{
|
||||
Debug.LogError("\n\nExiting application:\n\nThis .apk was built with the Oculus XR Plugin loader enabled, but is attempting to run on a non-Oculus device.\nTo build for general Android devices, please disable the Oculus XR Plugin before building the Android player.\n\n\n");
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
if (supported != DeviceSupportedResult.Supported)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
if (!NativeMethods.LoadOVRPlugin(""))
|
||||
Debug.LogError("Failed to load libOVRPlugin.so");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// handle Android standalone build with Oculus XR Plugin installed but disabled in loader list.
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR && XR_MGMT_GTE_320
|
||||
#if !UNITY_2021_2_OR_NEWER
|
||||
private void RemoveVulkanFromAndroidGraphicsAPIs()
|
||||
{
|
||||
|
||||
// don't need to do anything if auto apis is selected
|
||||
if (PlayerSettings.GetUseDefaultGraphicsAPIs(BuildTarget.Android))
|
||||
return;
|
||||
|
||||
GraphicsDeviceType[] oldApis = PlayerSettings.GetGraphicsAPIs(BuildTarget.Android);
|
||||
List<GraphicsDeviceType> newApisList = new List<GraphicsDeviceType>();
|
||||
bool vulkanRemoved = false;
|
||||
|
||||
// copy all entries except vulkan
|
||||
foreach (GraphicsDeviceType dev in oldApis)
|
||||
{
|
||||
if (dev == GraphicsDeviceType.Vulkan)
|
||||
{
|
||||
vulkanRemoved = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
newApisList.Add(dev);
|
||||
}
|
||||
|
||||
// if we didn't remove Vulkan from the list, no need to do any further processing
|
||||
if (vulkanRemoved == false)
|
||||
return;
|
||||
|
||||
if (newApisList.Count <= 0)
|
||||
{
|
||||
newApisList.Add(GraphicsDeviceType.OpenGLES3);
|
||||
Debug.LogWarning(
|
||||
"Vulkan is currently experimental on Oculus Quest. It has been removed from your list of Android graphics APIs and replaced with OpenGLES3.\n" +
|
||||
"If you would like to use experimental Quest Vulkan support, you can add it back into the list of graphics APIs in the Player settings.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning(
|
||||
"Vulkan is currently experimental on Oculus Quest. It has been removed from your list of Android graphics APIs.\n" +
|
||||
"If you would like to use experimental Quest Vulkan support, you can add it back into the list of graphics APIs in the Player settings.");
|
||||
}
|
||||
|
||||
PlayerSettings.SetGraphicsAPIs(BuildTarget.Android, newApisList.ToArray());
|
||||
}
|
||||
#endif // !UNITY_2021_2_OR_NEWER
|
||||
|
||||
private void SetAndroidMinSdkVersion()
|
||||
{
|
||||
if (PlayerSettings.Android.minSdkVersion < AndroidSdkVersions.AndroidApiLevel23)
|
||||
{
|
||||
Debug.Log("The Android Minimum API Level has been updated to 23 in Player Settings as this is the minimum required for Oculus builds.");
|
||||
PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel23;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WasAssignedToBuildTarget(BuildTargetGroup buildTargetGroup)
|
||||
{
|
||||
if (buildTargetGroup == BuildTargetGroup.Android)
|
||||
{
|
||||
#if !UNITY_2021_2_OR_NEWER
|
||||
RemoveVulkanFromAndroidGraphicsAPIs();
|
||||
#endif
|
||||
SetAndroidMinSdkVersion();
|
||||
}
|
||||
}
|
||||
#endif // UNITY_EDITOR && XR_MGMT_GTE_320
|
||||
|
||||
public OculusSettings GetSettings()
|
||||
{
|
||||
OculusSettings settings = null;
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorBuildSettings.TryGetConfigObject<OculusSettings>("Unity.XR.Oculus.Settings", out settings);
|
||||
#else
|
||||
settings = OculusSettings.s_Settings;
|
||||
#endif
|
||||
return settings;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public string GetPreInitLibraryName(BuildTarget buildTarget, BuildTargetGroup buildTargetGroup)
|
||||
{
|
||||
return "OculusXRPlugin";
|
||||
}
|
||||
#endif
|
||||
|
||||
private bool CheckUnityVersionCompatibility()
|
||||
{
|
||||
#if !UNITY_2021_3_OR_NEWER
|
||||
Debug.LogWarning("This version of the Oculus XR Plugin requires at least Unity 2021.3.4f1.\n" +
|
||||
"Please update to that version or higher of Unity, or use the verified Oculus XR Plugin package for this version of Unity.");
|
||||
return false;
|
||||
#else
|
||||
// verify that 3.1.0+ versions of the package are on compatible versions of Unity
|
||||
var unityVersion = Application.unityVersion;
|
||||
var versionRegex = @"^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(?<type>.).*";
|
||||
var match = Regex.Match(unityVersion, versionRegex);
|
||||
|
||||
// if we can't parse the Unity version number, just assume success
|
||||
if (!match.Success)
|
||||
return true;
|
||||
|
||||
int major = Int32.Parse((match.Groups["major"].Value));
|
||||
int minor = Int32.Parse((match.Groups["minor"].Value));
|
||||
int patch = Int32.Parse((match.Groups["patch"].Value));
|
||||
var type = match.Groups["type"].Value;
|
||||
|
||||
// 2021.3 requires at least 2021.3.4f1. this is handled by the package.json, but handle here for internal development as well
|
||||
if (major == 2021)
|
||||
{
|
||||
if ((minor < 3) || ((minor == 3) && (patch < 4)))
|
||||
{
|
||||
Debug.LogWarning("This version of the Oculus XR Plugin requires at least Unity 2021.3.4f1.\n" +
|
||||
"Please update to that version or higher of Unity, or use the verified Oculus XR Plugin package for this version of Unity.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 2022.1 requires at least 2022.1.12f1
|
||||
if ((major == 2022) && (minor == 1) && (patch < 12))
|
||||
{
|
||||
Debug.LogWarning("This version of the Oculus XR Plugin requires at least Unity 2022.1.12f1.\n" +
|
||||
"Please update to that version or higher of Unity, or use the verified Oculus XR Plugin package for this version of Unity.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2022.2 requires at least 2022.0b1
|
||||
if ((major == 2022) && (minor == 2) && (patch == 0) && (type == "a"))
|
||||
{
|
||||
Debug.LogWarning("This version of the Oculus XR Plugin requires at least Unity 2022.2.0b1.\n" +
|
||||
"Please update to that version or higher of Unity, or use the verified Oculus XR Plugin package for this version of Unity.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 03bc68f14d65e7747a59d5ff74bd199b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,607 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
#if ENABLE_VR || PACKAGE_DOCS_GENERATION
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.XR;
|
||||
using XRStats = UnityEngine.XR.Provider.XRStats;
|
||||
#endif
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
public static class Performance
|
||||
{
|
||||
/// <summary>
|
||||
/// Set the CPU Level for the device
|
||||
/// </summary>
|
||||
/// <param name="level">
|
||||
/// Allowable values are integers in the range 0 - 4 (inclusive). A value of 0 is the lowest performance level but is the most power efficient.
|
||||
/// Please note: as this is a hint, it may not be immediately reflected by the system.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// True if we have no errors returned by the native function. We return false when the native function returns a failure condition.
|
||||
/// Check the log for more information.
|
||||
/// </returns>
|
||||
public static bool TrySetCPULevel(int level)
|
||||
{
|
||||
return (NativeMethods.SetCPULevel(level) == 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the GPU performance level
|
||||
/// </summary>
|
||||
/// <param name="level">
|
||||
/// Allowable values are integers in the range 0 - 4 (inclusive). A value of 0 is the lowest performance level but is the most power efficient.
|
||||
/// Please note: as this is a hint, it may not be immediately reflected by the system.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// True if we have no errors returned by the native function. We return false when the native function returns a failure condition. Check
|
||||
/// the log for more information.
|
||||
/// </returns>
|
||||
public static bool TrySetGPULevel(int level)
|
||||
{
|
||||
return (NativeMethods.SetGPULevel(level) == 0);
|
||||
}
|
||||
|
||||
private static float[] cachedDisplayAvailableFrequencies = null;
|
||||
|
||||
/// <summary>
|
||||
/// Get an array of available display frequencies supported by this hardware.
|
||||
/// </summary>
|
||||
public static bool TryGetAvailableDisplayRefreshRates(out float[] refreshRates)
|
||||
{
|
||||
if (cachedDisplayAvailableFrequencies == null || cachedDisplayAvailableFrequencies.Length == 0)
|
||||
{
|
||||
cachedDisplayAvailableFrequencies = new float[0];
|
||||
int numFrequencies = 0;
|
||||
if (NativeMethods.GetDisplayAvailableFrequencies(IntPtr.Zero, ref numFrequencies) && numFrequencies > 0)
|
||||
{
|
||||
int size = sizeof(float) * numFrequencies;
|
||||
IntPtr ptr = Marshal.AllocHGlobal(size);
|
||||
if (NativeMethods.GetDisplayAvailableFrequencies(ptr, ref numFrequencies) && numFrequencies > 0)
|
||||
{
|
||||
cachedDisplayAvailableFrequencies = new float[numFrequencies];
|
||||
Marshal.Copy(ptr, cachedDisplayAvailableFrequencies, 0, numFrequencies);
|
||||
}
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
refreshRates = cachedDisplayAvailableFrequencies;
|
||||
return (cachedDisplayAvailableFrequencies.Length > 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the current display frequency.
|
||||
/// </summary>
|
||||
public static bool TrySetDisplayRefreshRate(float refreshRate)
|
||||
{
|
||||
return NativeMethods.SetDisplayFrequency(refreshRate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current display frequency.
|
||||
/// </summary>
|
||||
public static bool TryGetDisplayRefreshRate(out float refreshRate)
|
||||
{
|
||||
return NativeMethods.GetDisplayFrequency(out refreshRate);
|
||||
}
|
||||
}
|
||||
|
||||
public class Stats
|
||||
{
|
||||
private static IntegratedSubsystem m_Display;
|
||||
private static string m_PluginVersion = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of OVRPlugin currently in use. Format: "major.minor.release"
|
||||
/// </summary>
|
||||
public static string PluginVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.Equals(string.Empty, m_PluginVersion))
|
||||
{
|
||||
byte[] buf = new byte[256];
|
||||
NativeMethods.GetOVRPVersion(buf);
|
||||
var end = Array.IndexOf<byte>(buf, 0);
|
||||
m_PluginVersion = System.Text.Encoding.ASCII.GetString(buf, 0, end);
|
||||
}
|
||||
return m_PluginVersion;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides performance statistics useful for adaptive performance systems. Not every stat is supported on every Oculus platform and will always return a value of 0 if unsupported.
|
||||
/// </summary>
|
||||
public static class AdaptivePerformance
|
||||
{
|
||||
/// <summary>
|
||||
/// Reports the time the application spent on the GPU last frame in seconds.
|
||||
/// </summary>
|
||||
public static float GPUAppTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
((XRDisplaySubsystem) GetOculusDisplaySubsystem()).TryGetAppGPUTimeLastFrame(out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the time the compositor spent on the GPU last frame in seconds.
|
||||
/// </summary>
|
||||
public static float GPUCompositorTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
((XRDisplaySubsystem) GetOculusDisplaySubsystem()).TryGetCompositorGPUTimeLastFrame(out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the latency from when the last predicted tracking information was queried by the application to the moment the middle scaline of the target frame is illuminated on the display.
|
||||
/// </summary>
|
||||
public static float MotionToPhoton
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
((XRDisplaySubsystem) GetOculusDisplaySubsystem()).TryGetMotionToPhoton(out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the display's refresh rate in frames per second
|
||||
/// </summary>
|
||||
[Obsolete("RefreshRate is deprecated. Use Performance.TryGetDisplayRefreshRate instead.", false)]
|
||||
public static float RefreshRate
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
((XRDisplaySubsystem) GetOculusDisplaySubsystem()).TryGetDisplayRefreshRate(out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current battery temperature in degrees Celsius.
|
||||
/// </summary>
|
||||
public static float BatteryTemp
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float batteryTemp;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "batteryTemperature", out batteryTemp);
|
||||
return batteryTemp;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current available battery charge, ranging from 0.0 (empty) to 1.0 (full).
|
||||
/// </summary>
|
||||
public static float BatteryLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float batteryLevel;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "batteryLevel", out batteryLevel);
|
||||
return batteryLevel;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If true, the system is running in a reduced performance mode to save power.
|
||||
/// </summary>
|
||||
public static bool PowerSavingMode
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float powerSavingMode;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "powerSavingMode", out powerSavingMode);
|
||||
return !(powerSavingMode == 0.0f);
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the recommended amount to scale GPU work in order to maintain framerate.
|
||||
/// Can be used to adjust viewportScale and textureScale
|
||||
/// </summary>
|
||||
public static float AdaptivePerformanceScale
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float performanceScale;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "adaptivePerformanceScale", out performanceScale);
|
||||
return performanceScale;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current CPU performance level, integer in the range 0 - 3.
|
||||
/// </summary>
|
||||
public static int CPULevel
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float cpuLevel;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "cpuLevel", out cpuLevel);
|
||||
return (int) cpuLevel;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current GPU performance level, integer in the range 0 - 3.
|
||||
/// </summary>
|
||||
public static int GPULevel
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float gpuLevel;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "gpuLevel", out gpuLevel);
|
||||
return (int) gpuLevel;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides additional perf metrics. These stats will not be tracked unless the user makes a PerfMetrics.EnablePerfMetrics(true) method call. Not every stat is supported on every Oculus platform and will always return a value of 0 if unsupported.
|
||||
/// <para/><b>Note:</b> PerfMetrics stats will return 0 when using the OpenXR runtime. The suggested replacement is to use the profiling tools available via the Oculus Developer Hub: https://developer.oculus.com/documentation/unity/ts-odh-logs-metrics/
|
||||
/// </summary>
|
||||
public static class PerfMetrics
|
||||
{
|
||||
/// <summary>
|
||||
/// Reports the time the application spent on the CPU last frame in seconds.
|
||||
/// </summary>
|
||||
public static float AppCPUTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.appcputime", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the time the application spen on the GPU last frame in seconds.
|
||||
/// </summary>
|
||||
public static float AppGPUTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.appgputime", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the time the compositor spent on the CPU last frame in seconds.
|
||||
/// </summary>
|
||||
public static float CompositorCPUTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.compositorcputime", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the time the compositor spent on the GPU last frame in seconds.
|
||||
/// </summary>
|
||||
public static float CompositorGPUTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.compositorgputime", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the GPU utilization as a value from 0.0 - 1.0.
|
||||
/// </summary>
|
||||
public static float GPUUtilization
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.gpuutil", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the average CPU utilization as a value from 0.0 - 1.0.
|
||||
/// </summary>
|
||||
public static float CPUUtilizationAverage
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.cpuutilavg", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the worst CPU utilization as a value from 0.0 - 1.0.
|
||||
/// </summary>
|
||||
public static float CPUUtilizationWorst
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.cpuutilworst", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the CPU clock frequency
|
||||
/// </summary>
|
||||
public static float CPUClockFrequency
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.cpuclockfreq", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the GPU clock frequency
|
||||
/// </summary>
|
||||
public static float GPUClockFrequency
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "perfmetrics.gpuclockfreq", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable provider tracking perf metrics. Perf metrics are disabled by default.
|
||||
/// </summary>
|
||||
public static void EnablePerfMetrics(bool enable)
|
||||
{
|
||||
NativeMethods.EnablePerfMetrics(enable);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides additional application metrics. These metrics will not be tracked unless the user makes a AppMetrics.EnableAppMetrics(true) method call.
|
||||
/// <para/><b>Note:</b> AppMetrics are deprecated and currently return 0 on all Oculus runtimes. The suggested replacement is to use the profiling tools available via the Oculus Developer Hub: https://developer.oculus.com/documentation/unity/ts-odh-logs-metrics/
|
||||
/// </summary>
|
||||
public static class AppMetrics
|
||||
{
|
||||
public static float AppQueueAheadTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "appstats.appqueueahead", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static float AppCPUElapsedTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "appstats.cpuelapsedtime", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the number of frames dropped by the compositor.
|
||||
/// </summary>
|
||||
public static float CompositorDroppedFrames
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "appstats.compositordroppedframes", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static float CompositorLatency
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "appstats.compositorlatency", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the time the compositor spent on the CPU last frame in seconds.
|
||||
/// </summary>
|
||||
public static float CompositorCPUTime
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "appstats.compositorcputime", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the total time from beginning of the main thread until compositor frame submission.
|
||||
/// </summary>
|
||||
public static float CPUStartToGPUEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "appstats.compositorcpustartgpuendelapsedtime", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports the total time from compositor frame submission until the frame sync point.
|
||||
/// </summary>
|
||||
public static float GPUEndToVsync
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ENABLE_VR
|
||||
float val;
|
||||
XRStats.TryGetStat(GetOculusDisplaySubsystem(), "appstats.compositorgpuendtovsyncelapsedtime", out val);
|
||||
return val;
|
||||
#else
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static void EnableAppMetrics(bool enable)
|
||||
{
|
||||
NativeMethods.EnableAppMetrics(enable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static IntegratedSubsystem GetOculusDisplaySubsystem()
|
||||
{
|
||||
if (m_Display != null)
|
||||
return m_Display;
|
||||
|
||||
#if ENABLE_VR
|
||||
List<XRDisplaySubsystem> displays = new List<XRDisplaySubsystem>();
|
||||
SubsystemManager.GetInstances(displays);
|
||||
|
||||
foreach (XRDisplaySubsystem xrDisplaySubsystem in displays)
|
||||
{
|
||||
if (xrDisplaySubsystem.SubsystemDescriptor.id == "oculus display" && xrDisplaySubsystem.running)
|
||||
{
|
||||
m_Display = xrDisplaySubsystem;
|
||||
return m_Display;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Debug.LogError("No active Oculus display subsystem was found.");
|
||||
return m_Display;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 06e72146948ed8641b996f6fa5c0a602
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,411 @@
|
|||
#if !(UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || (UNITY_ANDROID && !UNITY_EDITOR))
|
||||
#define OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
#endif
|
||||
|
||||
#if (UNITY_ANDROID && !UNITY_EDITOR)
|
||||
#define OCULUSPLUGIN_ANDROID_PLATFORM_ONLY
|
||||
#endif
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
|
||||
public enum SystemHeadset
|
||||
{
|
||||
None = 0,
|
||||
|
||||
// Standalone headsets
|
||||
Oculus_Quest = 8,
|
||||
Oculus_Quest_2 = 9,
|
||||
Meta_Quest_Pro = 10,
|
||||
Placeholder_10 = 10,
|
||||
Placeholder_11,
|
||||
Placeholder_12,
|
||||
Placeholder_13,
|
||||
Placeholder_14,
|
||||
|
||||
// PC headsets
|
||||
Rift_DK1 = 0x1000,
|
||||
Rift_DK2,
|
||||
Rift_CV1,
|
||||
Rift_CB,
|
||||
Rift_S,
|
||||
Oculus_Link_Quest,
|
||||
Oculus_Link_Quest_2,
|
||||
Meta_Link_Quest_Pro,
|
||||
PC_Placeholder_4103 = Meta_Link_Quest_Pro,
|
||||
PC_Placeholder_4104,
|
||||
PC_Placeholder_4105,
|
||||
PC_Placeholder_4106,
|
||||
PC_Placeholder_4107
|
||||
}
|
||||
|
||||
public static partial class NativeMethods
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct UserDefinedSettings
|
||||
{
|
||||
public ushort sharedDepthBuffer;
|
||||
public ushort dashSupport;
|
||||
public ushort stereoRenderingMode;
|
||||
public ushort colorSpace;
|
||||
public ushort lowOverheadMode;
|
||||
public ushort optimizeBufferDiscards;
|
||||
public ushort phaseSync;
|
||||
public ushort symmetricProjection;
|
||||
public ushort subsampledLayout;
|
||||
public ushort lateLatching;
|
||||
public ushort lateLatchingDebug;
|
||||
public ushort enableTrackingOriginStageMode;
|
||||
public ushort spaceWarp;
|
||||
public ushort depthSubmission;
|
||||
public ushort foveatedRenderingMethod;
|
||||
}
|
||||
|
||||
internal static void SetColorScale(float x, float y, float z, float w)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.SetColorScale(x, y, z, w);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void SetColorOffset(float x, float y, float z, float w)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.SetColorOffset(x, y, z, w);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetIsSupportedDevice()
|
||||
{
|
||||
#if OCULUSPLUGIN_ANDROID_PLATFORM_ONLY
|
||||
return Internal.GetIsSupportedDevice();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool LoadOVRPlugin(string ovrpPath)
|
||||
{
|
||||
#if OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return false;
|
||||
#else
|
||||
return Internal.LoadOVRPlugin(ovrpPath);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void UnloadOVRPlugin()
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.UnloadOVRPlugin();
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void SetUserDefinedSettings(UserDefinedSettings settings)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.SetUserDefinedSettings(settings);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static int SetCPULevel(int cpuLevel)
|
||||
{
|
||||
#if OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return -1;
|
||||
#else
|
||||
return Internal.SetCPULevel(cpuLevel);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static int SetGPULevel(int gpuLevel)
|
||||
{
|
||||
#if OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return -1;
|
||||
#else
|
||||
return Internal.SetGPULevel(gpuLevel);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void GetOVRPVersion(byte[] version)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.GetOVRPVersion(version);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void EnablePerfMetrics(bool enable)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.EnablePerfMetrics(enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void EnableAppMetrics(bool enable)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.EnableAppMetrics(enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool SetDeveloperModeStrict(bool active)
|
||||
{
|
||||
#if OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return false;
|
||||
#else
|
||||
return Internal.SetDeveloperModeStrict(active);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetHasInputFocus()
|
||||
{
|
||||
#if OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return false;
|
||||
#else
|
||||
return Internal.GetAppHasInputFocus();
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetBoundaryConfigured()
|
||||
{
|
||||
#if OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return false;
|
||||
#else
|
||||
return Internal.GetBoundaryConfigured();
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetBoundaryDimensions(Boundary.BoundaryType boundaryType, out Vector3 dimensions)
|
||||
{
|
||||
#if OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
dimensions = Vector3.zero;
|
||||
return false;
|
||||
#else
|
||||
return Internal.GetBoundaryDimensions(boundaryType, out dimensions);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetBoundaryVisible()
|
||||
{
|
||||
#if OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return false;
|
||||
#else
|
||||
return Internal.GetBoundaryVisible();
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void SetBoundaryVisible(bool boundaryVisible)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.SetBoundaryVisible(boundaryVisible);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetAppShouldQuit()
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetAppShouldQuit();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetDisplayAvailableFrequencies(IntPtr ptr, ref int numFrequencies)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetDisplayAvailableFrequencies(ptr, ref numFrequencies);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool SetDisplayFrequency(float refreshRate)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.SetDisplayFrequency(refreshRate);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetDisplayFrequency(out float refreshRate)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetDisplayFrequency(out refreshRate);
|
||||
#else
|
||||
refreshRate = 0.0f;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static SystemHeadset GetSystemHeadsetType()
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetSystemHeadsetType();
|
||||
#else
|
||||
return SystemHeadset.None;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetTiledMultiResSupported()
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetTiledMultiResSupported();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void SetTiledMultiResLevel(int level)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.SetTiledMultiResLevel(level);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static int GetTiledMultiResLevel()
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetTiledMultiResLevel();
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void SetTiledMultiResDynamic(bool isDynamic)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.SetTiledMultiResDynamic(isDynamic);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetEyeTrackedFoveatedRenderingSupported()
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetEyeTrackedFoveatedRenderingSupported();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetEyeTrackedFoveatedRenderingEnabled()
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetEyeTrackedFoveatedRenderingEnabled();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static void SetEyeTrackedFoveatedRenderingEnabled(bool isEnabled)
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
Internal.SetEyeTrackedFoveatedRenderingEnabled(isEnabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static bool GetShouldRestartSession()
|
||||
{
|
||||
#if !OCULUSPLUGIN_UNSUPPORTED_PLATFORM
|
||||
return Internal.GetShouldRestartSession();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
private static class Internal
|
||||
{
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void SetColorScale(float x, float y, float z, float w);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void SetColorOffset(float x, float y, float z, float w);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetIsSupportedDevice();
|
||||
|
||||
[DllImport("OculusXRPlugin", CharSet = CharSet.Unicode)]
|
||||
internal static extern bool LoadOVRPlugin(string ovrpPath);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void UnloadOVRPlugin();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void SetUserDefinedSettings(UserDefinedSettings settings);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern int SetCPULevel(int cpuLevel);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern int SetGPULevel(int gpuLevel);
|
||||
|
||||
[DllImport("OculusXRPlugin", CharSet = CharSet.Auto)]
|
||||
internal static extern void GetOVRPVersion(byte[] version);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void EnablePerfMetrics(bool enable);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void EnableAppMetrics(bool enable);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool SetDeveloperModeStrict(bool active);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetAppHasInputFocus();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetBoundaryConfigured();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetBoundaryDimensions(Boundary.BoundaryType boundaryType, out Vector3 dimensions);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetBoundaryVisible();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void SetBoundaryVisible(bool boundaryVisible);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetAppShouldQuit();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetDisplayAvailableFrequencies(IntPtr ptr, ref int numFrequencies);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool SetDisplayFrequency(float refreshRate);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetDisplayFrequency(out float refreshRate);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern SystemHeadset GetSystemHeadsetType();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetTiledMultiResSupported();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void SetTiledMultiResLevel(int level);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern int GetTiledMultiResLevel();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void SetTiledMultiResDynamic(bool isDynamic);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetEyeTrackedFoveatedRenderingSupported();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetEyeTrackedFoveatedRenderingEnabled();
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern void SetEyeTrackedFoveatedRenderingEnabled(bool isEnabled);
|
||||
|
||||
[DllImport("OculusXRPlugin")]
|
||||
internal static extern bool GetShouldRestartSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e5a7c828960f46f41a8e89314eb055d7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Management;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
internal class OculusRestarter : MonoBehaviour
|
||||
{
|
||||
internal Action onAfterRestart;
|
||||
internal Action onAfterShutdown;
|
||||
internal Action onQuit;
|
||||
internal Action onAfterCoroutine;
|
||||
|
||||
static readonly String k_GameObjectName = "~oculusrestarter";
|
||||
|
||||
static OculusRestarter()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
EditorApplication.playModeStateChanged += (state) =>
|
||||
{
|
||||
if (state == PlayModeStateChange.EnteredPlayMode)
|
||||
m_pauseAndRestartAttempts = 0;
|
||||
};
|
||||
#endif
|
||||
TimeBetweenRestartAttempts = 5.0f;
|
||||
}
|
||||
|
||||
|
||||
public void ResetCallbacks ()
|
||||
{
|
||||
onAfterRestart = null;
|
||||
onAfterShutdown = null;
|
||||
onAfterCoroutine = null;
|
||||
onQuit = null;
|
||||
m_pauseAndRestartAttempts = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if the restarter is currently running
|
||||
/// </summary>
|
||||
public bool isRunning => m_Coroutine != null;
|
||||
|
||||
private static OculusRestarter s_Instance = null;
|
||||
|
||||
private Coroutine m_Coroutine;
|
||||
|
||||
private Coroutine m_pauseAndRestartCoroutine;
|
||||
|
||||
private static int m_pauseAndRestartAttempts = 0;
|
||||
|
||||
public static float TimeBetweenRestartAttempts
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public static int PauseAndRestartAttempts
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_pauseAndRestartAttempts;
|
||||
}
|
||||
}
|
||||
|
||||
public static OculusRestarter Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_Instance == null)
|
||||
{
|
||||
var go = GameObject.Find(k_GameObjectName);
|
||||
if (go == null)
|
||||
{
|
||||
go = new GameObject(k_GameObjectName);
|
||||
go.hideFlags = HideFlags.HideAndDontSave;
|
||||
go.AddComponent<OculusRestarter>();
|
||||
}
|
||||
s_Instance = go.GetComponent<OculusRestarter>();
|
||||
}
|
||||
return s_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pause and then restart.
|
||||
/// If the restart triggers another restart, the pause adds some delay between restarts.
|
||||
/// </summary>
|
||||
public void PauseAndRestart()
|
||||
{
|
||||
if (m_pauseAndRestartCoroutine != null)
|
||||
{
|
||||
Debug.LogError("Only one pause then shutdown/restart can be executed at a time");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("Please make sure the device is connected. Will try to restart xr periodically.");
|
||||
m_pauseAndRestartCoroutine = StartCoroutine(PauseAndRestartCoroutine(TimeBetweenRestartAttempts));
|
||||
}
|
||||
|
||||
public IEnumerator PauseAndRestartCoroutine(float pauseTimeInSeconds)
|
||||
{
|
||||
try
|
||||
{
|
||||
yield return new WaitForSeconds(pauseTimeInSeconds);
|
||||
m_pauseAndRestartAttempts += 1;
|
||||
if (m_Coroutine == null)
|
||||
{
|
||||
m_Coroutine = StartCoroutine(RestartCoroutine(true));
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(String.Format("Restart/Shutdown already in progress so skipping this attempt."));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_pauseAndRestartCoroutine = null;
|
||||
onAfterCoroutine?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator RestartCoroutine (bool shouldRestart)
|
||||
{
|
||||
try
|
||||
{
|
||||
yield return null;
|
||||
|
||||
// Always shutdown the loader
|
||||
XRGeneralSettings.Instance.Manager.DeinitializeLoader();
|
||||
yield return null;
|
||||
|
||||
onAfterShutdown?.Invoke();
|
||||
|
||||
// Restart?
|
||||
if (shouldRestart)
|
||||
{
|
||||
yield return XRGeneralSettings.Instance.Manager.InitializeLoader();
|
||||
|
||||
XRGeneralSettings.Instance.Manager.StartSubsystems();
|
||||
|
||||
if (XRGeneralSettings.Instance.Manager.activeLoader == null)
|
||||
{
|
||||
Debug.LogError("Failure to restart OculusLoader after shutdown.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("OculusLoader restart successful.");
|
||||
m_pauseAndRestartAttempts = 0;
|
||||
}
|
||||
|
||||
onAfterRestart?.Invoke();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_Coroutine = null;
|
||||
onAfterCoroutine?.Invoke();
|
||||
|
||||
// this is invoked if the restart failed, typically because Oculus Link still hasn't been restored.
|
||||
if (XRGeneralSettings.Instance.Manager.activeLoader == null) {
|
||||
PauseAndRestart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 24ad86ba07a055e4da8a87644757a635
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
internal static class OculusSession
|
||||
{
|
||||
public static void Update()
|
||||
{
|
||||
if (NativeMethods.GetShouldRestartSession()) {
|
||||
OculusRestarter.Instance.PauseAndRestart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 831ffaf1b2551514bb24d78397003782
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,205 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Management;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
[System.Serializable]
|
||||
[XRConfigurationData("Oculus", "Unity.XR.Oculus.Settings")]
|
||||
public class OculusSettings : ScriptableObject
|
||||
{
|
||||
public enum StereoRenderingModeDesktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Unity makes two passes across the scene graph, each one entirely indepedent of the other.
|
||||
/// Each pass has its own eye matrices and render target. Unity draws everything twice, which includes setting the graphics state for each pass.
|
||||
/// This is a slow and simple rendering method which doesn't require any special modification to shaders.
|
||||
/// </summary>
|
||||
MultiPass = 0,
|
||||
/// <summary>
|
||||
/// Unity uses a single texture array with two elements. Unity converts each call into an instanced draw call.
|
||||
/// Shaders need to be aware of this. Unity's shader macros handle the situation.
|
||||
/// </summary>
|
||||
SinglePassInstanced = 1,
|
||||
}
|
||||
|
||||
public enum StereoRenderingModeAndroid
|
||||
{
|
||||
/// <summary>
|
||||
/// Unity makes two passes across the scene graph, each one entirely indepedent of the other.
|
||||
/// Each pass has its own eye matrices and render target. Unity draws everything twice, which includes setting the graphics state for each pass.
|
||||
/// This is a slow and simple rendering method which doesn't require any special modification to shaders.
|
||||
/// </summary>
|
||||
MultiPass = 0,
|
||||
/// <summary>
|
||||
/// Unity uses a single texture array with two elements.
|
||||
/// Multiview is very similar to Single Pass Instanced; however, the graphics driver converts each call into an instanced draw call so it requires less work on Unity's side.
|
||||
/// As with Single Pass Instanced, shaders need to be aware of the Multiview setting. Unity's shader macros handle the situation.
|
||||
/// </summary>
|
||||
Multiview = 2
|
||||
}
|
||||
|
||||
public enum FoveationMethod
|
||||
{
|
||||
/// <summary>
|
||||
/// Fixed Foveated Rendering
|
||||
/// Foveates the image based on a fixed pattern.
|
||||
/// </summary>
|
||||
FixedFoveatedRendering = 0,
|
||||
/// <summary>
|
||||
/// Eye Tracked Foveated Rendering
|
||||
/// Foveates the image using eye tracking.
|
||||
/// </summary>
|
||||
EyeTrackedFoveatedRendering = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current stereo rendering mode selected for desktop-based Oculus platforms
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("The current stereo rendering mode selected for desktop-based Oculus platforms.")]
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
public StereoRenderingModeDesktop m_StereoRenderingModeDesktop = StereoRenderingModeDesktop.SinglePassInstanced;
|
||||
#else
|
||||
public StereoRenderingModeDesktop m_StereoRenderingModeDesktop = StereoRenderingModeDesktop.MultiPass;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The current stereo rendering mode selected for Android-based Oculus platforms
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("The current stereo rendering mode selected for Android-based Oculus platforms.")]
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
public StereoRenderingModeAndroid m_StereoRenderingModeAndroid = StereoRenderingModeAndroid.Multiview;
|
||||
#else
|
||||
public StereoRenderingModeAndroid m_StereoRenderingModeAndroid = StereoRenderingModeAndroid.MultiPass;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable support for using a shared depth buffer. This allows Unity and Oculus to use a common depth buffer which enables Oculus to composite the Oculus Dash and other utilities over the Unity application.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Allows Unity and the Oculus runtime to share a common depth buffer for better scene integration with the Dash.")]
|
||||
public bool SharedDepthBuffer = true;
|
||||
|
||||
/// <summary>
|
||||
/// Enables support for submitting the depth buffer on mobile. This allows for depth testing between layers on mobile Oculus platforms.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Enables support for submitting the depth buffer on mobile. This allows for depth testing between layers on mobile Oculus platforms.")]
|
||||
public bool DepthSubmission = false;
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable Dash support. This inintializes the Oculus Plugin with Dash support which enables the Oculus Dash to composite over the Unity application.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Initialize the Oculus Plugin with Dash support which allows the Oculus Dash to composite over the Unity application.")]
|
||||
public bool DashSupport = true;
|
||||
|
||||
/// <summary>
|
||||
/// If enabled, the GLES graphics driver will bypass validation code, potentially running faster.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("If enabled, the GLES graphics driver will bypass validation code, potentially running faster at the expense of detecting and reporting errors. GLES only.")]
|
||||
public bool LowOverheadMode = false;
|
||||
|
||||
/// <summary>
|
||||
/// If enabled, the depth buffer and MSAA contents will be discarded rather than resolved. This is an optimization that can possibly break rendering in certain cases. Vulkan only.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("If enabled, the depth buffer and MSAA contents will be discarded rather than resolved. This is an optimization that can possibly break rendering in certain cases. Vulkan only.")]
|
||||
public bool OptimizeBufferDiscards = true;
|
||||
|
||||
/// <summary>
|
||||
/// Enables a latency optimization technique which can reduce simulation latency by several ms, depending on application workload.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Enables a latency optimization technique which can reduce simulation latency by several ms, depending on application workload.")]
|
||||
public bool PhaseSync = false;
|
||||
|
||||
/// <summary>
|
||||
/// Allows the application to render with symmetric projection matrices which can improve performance when using multiview.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Allows the application to render with symmetric projection matrices.")]
|
||||
public bool SymmetricProjection = true;
|
||||
|
||||
/// <summary>
|
||||
/// Enables a subsampled eye texture layout, which can improve performance when using FFR and reduce FFR related artifacts. Vulkan and Quest 2/Quest Pro only.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Enables a subsampled eye texture layout, which can improve performance when using FFR and reduce FFR related artifacts. Vulkan and Quest 2/Quest Pro only.")]
|
||||
public bool SubsampledLayout = false;
|
||||
|
||||
/// <summary>
|
||||
/// Choose which foveated rendering method is used when foveation is enabled.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Choose which foveated rendering method is used when foveation is enabled.")]
|
||||
public FoveationMethod FoveatedRenderingMethod = FoveationMethod.FixedFoveatedRendering;
|
||||
|
||||
/// <summary>
|
||||
/// Reduces tracked rendering latency by updating head and controller poses as late as possible before rendering. Vulkan only.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Reduces tracked rendering latency by updating head and controller poses as late as possible before rendering. Vulkan only.")]
|
||||
public bool LateLatching = false;
|
||||
|
||||
/// <summary>
|
||||
/// Debug mode for Late Latching which will print information about the Late Latching system as well as any errors.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Debug mode for Late Latching which will print information about the Late Latching system as well as any errors.")]
|
||||
public bool LateLatchingDebug = false;
|
||||
|
||||
/// <summary>
|
||||
/// When the Tracking Origin Mode is set to Floor, the tracking origin won't change with a system recenter.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("When the Tracking Origin Mode is set to Floor, the tracking origin won't change with a system recenter.")]
|
||||
public bool EnableTrackingOriginStageMode = false;
|
||||
|
||||
/// <summary>
|
||||
/// A frame synthesis technology to allow your application to render at half frame rate, while still delivering a smooth experience. Note that this currently requires a custom version of the URP provided by Oculus in order to work, and should not be enabled if you aren't using that customized Oculus URP package.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("A frame synthesis technology to allow your application to render at half frame rate, while still delivering a smooth experience. Note that this currently requires a custom version of the URP provided by Oculus in order to work, and should not be enabled if you aren't using that customized Oculus URP package.")]
|
||||
public bool SpaceWarp = false;
|
||||
|
||||
/// <summary>
|
||||
/// Adds a Quest 2 entry to the supported devices list in the Android manifest.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Adds a Quest 2 entry to the supported devices list in the Android manifest.")]
|
||||
public bool TargetQuest2 = true;
|
||||
|
||||
/// <summary>
|
||||
/// Adds a Quest Pro entry to the supported devices list in the Android manifest.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Adds a Quest Pro entry to the supported devices list in the Android manifest.")]
|
||||
public bool TargetQuestPro = false;
|
||||
|
||||
/// <summary>
|
||||
/// Adds a PNG under the Assets folder as the system splash screen image. If set, the OS will display the system splash screen as a high quality compositor layer as soon as the app is starting to launch until the app submits the first frame.
|
||||
/// </summary>
|
||||
[SerializeField, Tooltip("Adds a PNG under the Assets folder as the system splash screen image. If set, the OS will display the system splash screen as a high quality compositor layer as soon as the app is starting to launch until the app submits the first frame.")]
|
||||
public Texture2D SystemSplashScreen;
|
||||
|
||||
|
||||
public ushort GetStereoRenderingMode()
|
||||
{
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
return (ushort)m_StereoRenderingModeAndroid;
|
||||
# else
|
||||
return (ushort)m_StereoRenderingModeDesktop;
|
||||
#endif
|
||||
}
|
||||
#if !UNITY_EDITOR
|
||||
public static OculusSettings s_Settings;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
s_Settings = this;
|
||||
}
|
||||
#else
|
||||
private void OnValidate()
|
||||
{
|
||||
if(SystemSplashScreen == null)
|
||||
return;
|
||||
|
||||
string splashScreenAssetPath = AssetDatabase.GetAssetPath(SystemSplashScreen);
|
||||
if (Path.GetExtension(splashScreenAssetPath).ToLower() != ".png")
|
||||
{
|
||||
SystemSplashScreen = null;
|
||||
throw new ArgumentException("Invalid file format of System Splash Screen. It has to be a PNG file to be used by the Quest OS. The asset path: " + splashScreenAssetPath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c353a8f1e58cf884584123914fe63cd5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#if ENABLE_VR || PACKAGE_DOCS_GENERATION
|
||||
using UnityEngine.XR;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
/// <summary>
|
||||
/// Input Usages, consumed by the UnityEngine.XR.InputDevice class in order to retrieve inputs.
|
||||
/// These usages are all Oculus specific.
|
||||
/// </summary>
|
||||
public static class OculusUsages
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the capacitive touch thumbrest on Oculus Rift controllers.
|
||||
/// </summary>
|
||||
public static InputFeatureUsage<bool> thumbrest = new InputFeatureUsage<bool>("Thumbrest");
|
||||
/// <summary>
|
||||
/// Represents the capacitive touch sensor state on the trigger of the Oculus Rift Controller.
|
||||
/// </summary>
|
||||
public static InputFeatureUsage<bool> indexTouch = new InputFeatureUsage<bool>("IndexTouch");
|
||||
/// <summary>
|
||||
/// Represents the capacitive touch sensor state on the grip of the Oculus Rift Controller.
|
||||
/// </summary>
|
||||
public static InputFeatureUsage<bool> thumbTouch = new InputFeatureUsage<bool>("ThumbTouch");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed82b3d3678d2da4b8d3b1934859a081
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
|
||||
#define OCULUSPLUGIN_WINDOWS_PLATFORM_ONLY
|
||||
#endif
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.XR.Oculus
|
||||
{
|
||||
internal static class RegisterUpdateCallback
|
||||
{
|
||||
internal static void Initialize()
|
||||
{
|
||||
Application.onBeforeRender += Update;
|
||||
}
|
||||
|
||||
internal static void Deinitialize()
|
||||
{
|
||||
Application.onBeforeRender -= Update;
|
||||
}
|
||||
|
||||
private static void Update()
|
||||
{
|
||||
//Detect if input focus lost or acquired.
|
||||
InputFocus.Update();
|
||||
|
||||
// Update our session state
|
||||
OculusSession.Update();
|
||||
|
||||
#if OCULUSPLUGIN_WINDOWS_PLATFORM_ONLY
|
||||
//Detect if App is closed from Oculus dash menu and close Windows based App as well.
|
||||
if (NativeMethods.GetAppShouldQuit())
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 249d9bd59fa447809365a610c2a1f327
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "Unity.XR.Oculus",
|
||||
"references": [
|
||||
"Unity.XR.Management",
|
||||
"Unity.ugui",
|
||||
"Unity.InputSystem"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.inputsystem",
|
||||
"expression": "",
|
||||
"define": "UNITY_INPUT_SYSTEM"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.xr.management",
|
||||
"expression": "3.2.0",
|
||||
"define": "XR_MGMT_GTE_320"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4af21795022437d4bb139a86514b9ff9
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "OculusXRPlugin",
|
||||
"version": "1.0.0-preview",
|
||||
"libraryName": "OculusXRPlugin",
|
||||
|
||||
"displays": [
|
||||
{
|
||||
"id": "oculus display",
|
||||
"disablesLegacyVr" : true,
|
||||
"supportedMirrorBlitReservedModes" : ["leftEye","rightEye", "sideBySide","occlusionMesh"]
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"id": "oculus input"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 227683a27092e4f4ca6b9af1f4e5eef6
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4a6feeafaf988f8479c97b565f58704d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,82 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ba473f1b8a4a10845a4396a861972ae5
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 1
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,82 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7d14b6fe4c2527a41b6c20e19a06e78d
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,82 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3d6867c27c643e94da78b5ad8c8a372c
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue