clean project
This commit is contained in:
58
Assets/Oculus/VR/Scripts/Editor/OVRCustomSkeletonEditor.cs
Normal file
58
Assets/Oculus/VR/Scripts/Editor/OVRCustomSkeletonEditor.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using BoneId = OVRSkeleton.BoneId;
|
||||
|
||||
[CustomEditor(typeof(OVRCustomSkeleton))]
|
||||
public class OVRCustomSkeletonEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawPropertiesExcluding(serializedObject, new string[] { "_customBones" });
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
OVRCustomSkeleton skeleton = (OVRCustomSkeleton)target;
|
||||
OVRSkeleton.SkeletonType skeletonType = skeleton.GetSkeletonType();
|
||||
|
||||
if (skeletonType == OVRSkeleton.SkeletonType.None)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Please select a SkeletonType.", MessageType.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button("Auto Map Bones"))
|
||||
{
|
||||
skeleton.TryAutoMapBonesByName();
|
||||
EditorUtility.SetDirty(skeleton);
|
||||
EditorSceneManager.MarkSceneDirty(skeleton.gameObject.scene);
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField("Bones", EditorStyles.boldLabel);
|
||||
BoneId start = skeleton.GetCurrentStartBoneId();
|
||||
BoneId end = skeleton.GetCurrentEndBoneId();
|
||||
if (start != BoneId.Invalid && end != BoneId.Invalid)
|
||||
{
|
||||
for (int i = (int)start; i < (int)end; ++i)
|
||||
{
|
||||
string boneName = OVRSkeleton.BoneLabelFromBoneId(skeletonType, (BoneId)i);
|
||||
skeleton.CustomBones[i] = (Transform)EditorGUILayout.ObjectField(boneName, skeleton.CustomBones[i], typeof(Transform), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48b4582957a398741abd6d10bcb62042
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
244
Assets/Oculus/VR/Scripts/Editor/OVREditorUtil.cs
Normal file
244
Assets/Oculus/VR/Scripts/Editor/OVREditorUtil.cs
Normal file
@@ -0,0 +1,244 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Diagnostics;
|
||||
|
||||
public static class OVREditorUtil {
|
||||
|
||||
private static GUIContent tooltipLink = new GUIContent("[?]");
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupBoolField(Object target, string name, ref bool member, ref bool modified, string docLink = "")
|
||||
{
|
||||
SetupBoolField(target, new GUIContent(name), ref member, ref modified, docLink);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupBoolField(Object target, GUIContent name, ref bool member, ref bool modified, string docLink = "")
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
bool value = EditorGUILayout.Toggle(name, member);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
member = value;
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(docLink))
|
||||
{
|
||||
DisplayDocLink(docLink);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupIntField(Object target, string name, ref int member, ref bool modified)
|
||||
{
|
||||
SetupIntField(target, new GUIContent(name), ref member, ref modified);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupIntField(Object target, GUIContent name, ref int member, ref bool modified)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
int value = EditorGUILayout.IntField(name, member);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
member = value;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupFloatField(Object target, string name, ref float member, ref bool modified)
|
||||
{
|
||||
SetupFloatField(target, new GUIContent(name), ref member, ref modified);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupFloatField(Object target, GUIContent name, ref float member, ref bool modified)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
float value = EditorGUILayout.FloatField(name, member);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
member = value;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupDoubleField(Object target, string name, ref double member, ref bool modified)
|
||||
{
|
||||
SetupDoubleField(target, new GUIContent(name), ref member, ref modified);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupDoubleField(Object target, GUIContent name, ref double member, ref bool modified)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
double value = EditorGUILayout.DoubleField(name, member);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
member = value;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupColorField(Object target, string name, ref Color member, ref bool modified)
|
||||
{
|
||||
SetupColorField(target, new GUIContent(name), ref member, ref modified);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupColorField(Object target, GUIContent name, ref Color member, ref bool modified)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Color value = EditorGUILayout.ColorField(name, member);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
member = value;
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupLayerMaskField(Object target, string name, ref LayerMask layerMask, string[] layerMaskOptions, ref bool modified)
|
||||
{
|
||||
SetupLayerMaskField(target, new GUIContent(name), ref layerMask, layerMaskOptions, ref modified);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupLayerMaskField(Object target, GUIContent name, ref LayerMask layerMask, string[] layerMaskOptions, ref bool modified)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
int value = EditorGUILayout.MaskField(name, layerMask, layerMaskOptions);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
layerMask = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupEnumField<T>(Object target, string name, ref T member, ref bool modified, string docLink = "") where T : struct
|
||||
{
|
||||
SetupEnumField(target, new GUIContent(name), ref member, ref modified, docLink);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupEnumField<T>(Object target, GUIContent name, ref T member, ref bool modified, string docLink = "") where T : struct
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
T value = (T)(object)EditorGUILayout.EnumPopup(name, member as System.Enum);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
member = value;
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(docLink))
|
||||
{
|
||||
DisplayDocLink(docLink);
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupInputField(Object target, string name, ref string member, ref bool modified, string docLink = "")
|
||||
{
|
||||
SetupInputField(target, new GUIContent(name), ref member, ref modified, docLink);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupInputField(Object target, GUIContent name, ref string member, ref bool modified, string docLink = "")
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
string value = EditorGUILayout.TextField(name, member);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
member = value;
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(docLink))
|
||||
{
|
||||
DisplayDocLink(docLink);
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupTexture2DField(Object target, string name, ref Texture2D member, ref bool modified)
|
||||
{
|
||||
SetupTexture2DField(target, new GUIContent(name), ref member, ref modified);
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void SetupTexture2DField(Object target, GUIContent name, ref Texture2D member, ref bool modified, string docLink = "")
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Texture2D value = (Texture2D)EditorGUILayout.ObjectField(name, member, typeof(Texture2D), false);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(target, "Changed " + name);
|
||||
member = value;
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(docLink))
|
||||
{
|
||||
DisplayDocLink(docLink);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR_WIN"), Conditional("UNITY_STANDALONE_WIN"), Conditional("UNITY_ANDROID")]
|
||||
public static void DisplayDocLink(string docLink)
|
||||
{
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
if (EditorGUILayout.LinkButton(tooltipLink))
|
||||
{
|
||||
Application.OpenURL(docLink);
|
||||
}
|
||||
#else
|
||||
if (GUILayout.Button(tooltipLink, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
Application.OpenURL(docLink);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
11
Assets/Oculus/VR/Scripts/Editor/OVREditorUtil.cs.meta
Normal file
11
Assets/Oculus/VR/Scripts/Editor/OVREditorUtil.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00e66be22bd6053489650de094c5efa8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
175
Assets/Oculus/VR/Scripts/Editor/OVRManagerEditor.cs
Normal file
175
Assets/Oculus/VR/Scripts/Editor/OVRManagerEditor.cs
Normal file
@@ -0,0 +1,175 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
[CustomEditor(typeof(OVRManager))]
|
||||
public class OVRManagerEditor : Editor
|
||||
{
|
||||
override public void OnInspectorGUI()
|
||||
{
|
||||
OVRRuntimeSettings runtimeSettings = OVRRuntimeSettings.GetRuntimeSettings();
|
||||
|
||||
#if UNITY_ANDROID
|
||||
OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
|
||||
OVRProjectConfigEditor.DrawTargetDeviceInspector(projectConfig);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
#endif
|
||||
|
||||
DrawDefaultInspector();
|
||||
|
||||
bool modified = false;
|
||||
|
||||
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_ANDROID
|
||||
OVRManager manager = (OVRManager)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Display", EditorStyles.boldLabel);
|
||||
|
||||
OVRManager.ColorSpace colorGamut = runtimeSettings.colorSpace;
|
||||
OVREditorUtil.SetupEnumField(target, new GUIContent("Color Gamut",
|
||||
"The target color gamut when displayed on the HMD"), ref colorGamut, ref modified,
|
||||
"https://developer.oculus.com/documentation/unity/unity-color-space/");
|
||||
manager.colorGamut = colorGamut;
|
||||
|
||||
if (modified)
|
||||
{
|
||||
runtimeSettings.colorSpace = colorGamut;
|
||||
OVRRuntimeSettings.CommitRuntimeSettings(runtimeSettings);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_ANDROID
|
||||
EditorGUILayout.Space();
|
||||
OVRProjectConfigEditor.DrawProjectConfigInspector(projectConfig);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Mixed Reality Capture for Quest", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
OVREditorUtil.SetupEnumField(target, "ActivationMode", ref manager.mrcActivationMode, ref modified);
|
||||
EditorGUI.indentLevel--;
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
manager.expandMixedRealityCapturePropertySheet = EditorGUILayout.BeginFoldoutHeaderGroup(manager.expandMixedRealityCapturePropertySheet, "Mixed Reality Capture");
|
||||
OVREditorUtil.DisplayDocLink("https://developer.oculus.com/documentation/unity/unity-mrc/");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (manager.expandMixedRealityCapturePropertySheet)
|
||||
{
|
||||
string[] layerMaskOptions = new string[32];
|
||||
for (int i=0; i<32; ++i)
|
||||
{
|
||||
layerMaskOptions[i] = LayerMask.LayerToName(i);
|
||||
if (layerMaskOptions[i].Length == 0)
|
||||
{
|
||||
layerMaskOptions[i] = "<Layer " + i.ToString() + ">";
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
OVREditorUtil.SetupBoolField(target, "enableMixedReality", ref manager.enableMixedReality, ref modified);
|
||||
OVREditorUtil.SetupEnumField(target, "compositionMethod", ref manager.compositionMethod, ref modified);
|
||||
OVREditorUtil.SetupLayerMaskField(target, "extraHiddenLayers", ref manager.extraHiddenLayers, layerMaskOptions, ref modified);
|
||||
OVREditorUtil.SetupLayerMaskField(target, "extraVisibleLayers", ref manager.extraVisibleLayers, layerMaskOptions, ref modified);
|
||||
OVREditorUtil.SetupBoolField(target, "dynamicCullingMask", ref manager.dynamicCullingMask, ref modified);
|
||||
|
||||
if (manager.compositionMethod == OVRManager.CompositionMethod.External)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("External Composition", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
OVREditorUtil.SetupColorField(target, "backdropColor (target, Rift)", ref manager.externalCompositionBackdropColorRift, ref modified);
|
||||
OVREditorUtil.SetupColorField(target, "backdropColor (target, Quest)", ref manager.externalCompositionBackdropColorQuest, ref modified);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
if (manager.compositionMethod == OVRManager.CompositionMethod.Direct)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Direct Composition", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Camera", EditorStyles.boldLabel);
|
||||
OVREditorUtil.SetupEnumField(target, "capturingCameraDevice", ref manager.capturingCameraDevice, ref modified);
|
||||
OVREditorUtil.SetupBoolField(target, "flipCameraFrameHorizontally", ref manager.flipCameraFrameHorizontally, ref modified);
|
||||
OVREditorUtil.SetupBoolField(target, "flipCameraFrameVertically", ref manager.flipCameraFrameVertically, ref modified);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Chroma Key", EditorStyles.boldLabel);
|
||||
OVREditorUtil.SetupColorField(target, "chromaKeyColor", ref manager.chromaKeyColor, ref modified);
|
||||
OVREditorUtil.SetupFloatField(target, "chromaKeySimilarity", ref manager.chromaKeySimilarity, ref modified);
|
||||
OVREditorUtil.SetupFloatField(target, "chromaKeySmoothRange", ref manager.chromaKeySmoothRange, ref modified);
|
||||
OVREditorUtil.SetupFloatField(target, "chromaKeySpillRange", ref manager.chromaKeySpillRange, ref modified);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Dynamic Lighting", EditorStyles.boldLabel);
|
||||
OVREditorUtil.SetupBoolField(target, "useDynamicLighting", ref manager.useDynamicLighting, ref modified);
|
||||
OVREditorUtil.SetupEnumField(target, "depthQuality", ref manager.depthQuality, ref modified);
|
||||
OVREditorUtil.SetupFloatField(target, "dynamicLightingSmoothFactor", ref manager.dynamicLightingSmoothFactor, ref modified);
|
||||
OVREditorUtil.SetupFloatField(target, "dynamicLightingDepthVariationClampingValue", ref manager.dynamicLightingDepthVariationClampingValue, ref modified);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Virtual Green Screen", EditorStyles.boldLabel);
|
||||
OVREditorUtil.SetupEnumField(target, "virtualGreenScreenType", ref manager.virtualGreenScreenType, ref modified);
|
||||
OVREditorUtil.SetupFloatField(target, "virtualGreenScreenTopY", ref manager.virtualGreenScreenTopY, ref modified);
|
||||
OVREditorUtil.SetupFloatField(target, "virtualGreenScreenBottomY", ref manager.virtualGreenScreenBottomY, ref modified);
|
||||
OVREditorUtil.SetupBoolField(target, "virtualGreenScreenApplyDepthCulling", ref manager.virtualGreenScreenApplyDepthCulling, ref modified);
|
||||
OVREditorUtil.SetupFloatField(target, "virtualGreenScreenDepthTolerance", ref manager.virtualGreenScreenDepthTolerance, ref modified);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Latency Control", EditorStyles.boldLabel);
|
||||
OVREditorUtil.SetupFloatField(target, "handPoseStateLatency", ref manager.handPoseStateLatency, ref modified);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_ANDROID
|
||||
// Insight Passthrough section
|
||||
#if UNITY_ANDROID
|
||||
bool passthroughCapabilityEnabled = projectConfig.insightPassthroughEnabled;
|
||||
EditorGUI.BeginDisabledGroup(!passthroughCapabilityEnabled);
|
||||
GUIContent enablePassthroughContent = new GUIContent("Enable Passthrough", "Enables passthrough functionality for the scene. Can be toggled at runtime. Passthrough Capability must be enabled in the project settings.");
|
||||
#else
|
||||
GUIContent enablePassthroughContent = new GUIContent("Enable Passthrough", "Enables passthrough functionality for the scene. Can be toggled at runtime.");
|
||||
#endif
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Insight Passthrough", EditorStyles.boldLabel);
|
||||
#if UNITY_ANDROID
|
||||
if (!passthroughCapabilityEnabled) {
|
||||
EditorGUILayout.LabelField("Requires Passthrough Capability to be enabled in the General section of the Quest features.", EditorStyles.wordWrappedLabel);
|
||||
}
|
||||
#endif
|
||||
OVREditorUtil.SetupBoolField(target, enablePassthroughContent, ref manager.isInsightPassthroughEnabled, ref modified);
|
||||
#if UNITY_ANDROID
|
||||
EditorGUI.EndDisabledGroup();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (modified)
|
||||
{
|
||||
EditorUtility.SetDirty(target);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
12
Assets/Oculus/VR/Scripts/Editor/OVRManagerEditor.cs.meta
Normal file
12
Assets/Oculus/VR/Scripts/Editor/OVRManagerEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b07d18088099f94fa00fc15e64b2b17
|
||||
timeCreated: 1502747851
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
174
Assets/Oculus/VR/Scripts/Editor/OVROverlayDestRectEditor.shader
Normal file
174
Assets/Oculus/VR/Scripts/Editor/OVROverlayDestRectEditor.shader
Normal file
@@ -0,0 +1,174 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Unlit/OVROverlayDestRectEditor"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_SrcRectLeft("SrcRectLeft", Vector) = (0,0,1,1)
|
||||
_SrcRectRight("SrcRectRight", Vector) = (0,0,1,1)
|
||||
_DestRectLeft ("DestRectLeft", Vector) = (0,0,1,1)
|
||||
_DestRectRight("DestRectRight", Vector) = (0,0,1,1)
|
||||
_BackgroundColor("Background Color", Color) = (0.225, 0.225, 0.225, 1)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 leftDragX : TEXCOORD1;
|
||||
float4 leftDragY : TEXCOORD2;
|
||||
float4 rightDragX : TEXCOORD3;
|
||||
float4 rightDragY : TEXCOORD4;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
|
||||
float4 _SrcRectLeft;
|
||||
float4 _SrcRectRight;
|
||||
float4 _DestRectLeft;
|
||||
float4 _DestRectRight;
|
||||
|
||||
fixed4 _BackgroundColor;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
// Add padding
|
||||
o.uv = (o.uv - 0.5) * (256.0 + 8.0) / (256.0) + 0.5;
|
||||
|
||||
// left
|
||||
o.leftDragX.x = _DestRectLeft.x;
|
||||
o.leftDragY.x = _DestRectLeft.y + _DestRectLeft.w * 0.5;
|
||||
// right
|
||||
o.leftDragX.y = _DestRectLeft.x + _DestRectLeft.z;
|
||||
o.leftDragY.y = _DestRectLeft.y + _DestRectLeft.w * 0.5;
|
||||
// top
|
||||
o.leftDragX.z = _DestRectLeft.x + _DestRectLeft.z * 0.5;
|
||||
o.leftDragY.z = _DestRectLeft.y;
|
||||
// bottom
|
||||
o.leftDragX.w = _DestRectLeft.x + _DestRectLeft.z * 0.5;
|
||||
o.leftDragY.w = _DestRectLeft.y + _DestRectLeft.w;
|
||||
// right
|
||||
o.rightDragX.x = _DestRectRight.x;
|
||||
o.rightDragY.x = _DestRectRight.y + _DestRectRight.w * 0.5;
|
||||
// right
|
||||
o.rightDragX.y = _DestRectRight.x + _DestRectRight.z;
|
||||
o.rightDragY.y = _DestRectRight.y + _DestRectRight.w * 0.5;
|
||||
// top
|
||||
o.rightDragX.z = _DestRectRight.x + _DestRectRight.z * 0.5;
|
||||
o.rightDragY.z = _DestRectRight.y;
|
||||
// bottom
|
||||
o.rightDragX.w = _DestRectRight.x + _DestRectRight.z * 0.5;
|
||||
o.rightDragY.w = _DestRectRight.y + _DestRectRight.w;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
float onDrag(float2 uv, float x, float y)
|
||||
{
|
||||
const float pixelSize = 6;
|
||||
return abs(uv.x - x) < ((pixelSize / 2) / 128.0) && abs(uv.y - y) < ((pixelSize / 2) / 128.0);
|
||||
}
|
||||
|
||||
float onLine(float2 uv, float4 rect)
|
||||
{
|
||||
return
|
||||
(abs(uv.x - rect.x) < (1 / 128.0) && uv.y >= rect.y && uv.y <= rect.y + rect.w) ||
|
||||
(abs(uv.x - rect.x - rect.z) < (1 / 128.0) && uv.y >= rect.y && uv.y <= rect.y + rect.w) ||
|
||||
(abs(uv.y - rect.y) < (1 / 128.0) && uv.x >= rect.x && uv.x <= rect.x + rect.z) ||
|
||||
(abs(uv.y - rect.y - rect.w) < (1 / 128.0) && uv.x >= rect.x && uv.x <= rect.x + rect.z);
|
||||
}
|
||||
|
||||
float checkerboard(float2 uv)
|
||||
{
|
||||
float x = floor(uv.x * (16 + 2));
|
||||
float y = floor(uv.y * 8);
|
||||
|
||||
return 2 * ((x + y) / 2.0 - floor((x + y) / 2.0));
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
float isLeftEye = i.uv < 0.5;
|
||||
float2 leftUV = float2(i.uv.x * (256.0 + 32.0) / 128.0, i.uv.y);
|
||||
float2 rightUV = float2(1 - ((1 - i.uv.x) * (256.0 + 32.0) / 128.0), i.uv.y);
|
||||
|
||||
float2 uv = i.uv;
|
||||
float2 textureUV = i.uv;
|
||||
if (isLeftEye)
|
||||
{
|
||||
uv = (leftUV - _DestRectLeft.xy) / _DestRectLeft.zw;
|
||||
textureUV = uv * _SrcRectLeft.zw + _SrcRectLeft.xy;
|
||||
}
|
||||
else
|
||||
{
|
||||
uv = (rightUV - _DestRectRight.xy) / _DestRectRight.zw;
|
||||
textureUV = uv * _SrcRectRight.zw + _SrcRectRight.xy;
|
||||
}
|
||||
|
||||
// sample the texture
|
||||
fixed4 col = tex2D(_MainTex, float2(textureUV.x, 1 - textureUV.y));
|
||||
|
||||
if (uv.x < 0 || uv.x > 1 || uv.y < 0 || uv.y > 1)
|
||||
{
|
||||
col.a = 0;
|
||||
}
|
||||
|
||||
col.rgb = lerp(0.41 - 0.13 * checkerboard(i.uv), col.rgb, col.a);
|
||||
|
||||
if (i.uv.x < 0 || i.uv.x > 1 || i.uv.y < 0 || i.uv.y > 1 || abs(i.uv.x - 0.5) < (14 / 256.0))
|
||||
{
|
||||
col = _BackgroundColor;
|
||||
}
|
||||
|
||||
// now draw clipping objects
|
||||
float left = isLeftEye && (onLine(leftUV, _DestRectLeft) ||
|
||||
onDrag(leftUV, i.leftDragX.x, i.leftDragY.x) ||
|
||||
onDrag(leftUV, i.leftDragX.y, i.leftDragY.y) ||
|
||||
onDrag(leftUV, i.leftDragX.z, i.leftDragY.z) ||
|
||||
onDrag(leftUV, i.leftDragX.w, i.leftDragY.w));
|
||||
|
||||
float right = (!isLeftEye) && (onLine(rightUV, _DestRectRight) ||
|
||||
onDrag(rightUV, i.rightDragX.x, i.rightDragY.x) ||
|
||||
onDrag(rightUV, i.rightDragX.y, i.rightDragY.y) ||
|
||||
onDrag(rightUV, i.rightDragX.z, i.rightDragY.z) ||
|
||||
onDrag(rightUV, i.rightDragX.w, i.rightDragY.w));
|
||||
|
||||
return lerp(col, fixed4(left, right, 0, 1), left || right);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c52c9bacdbb59f4a973dd1849d03106
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
631
Assets/Oculus/VR/Scripts/Editor/OVROverlayEditor.cs
Normal file
631
Assets/Oculus/VR/Scripts/Editor/OVROverlayEditor.cs
Normal file
@@ -0,0 +1,631 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(OVROverlay))]
|
||||
public class OVROverlayEditor : Editor
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Common Video Types, to ease source and dest rect creation
|
||||
/// </summary>
|
||||
public enum StereoType
|
||||
{
|
||||
Custom = 0,
|
||||
Mono = 1,
|
||||
Stereo = 2,
|
||||
StereoLeftRight = 3,
|
||||
StereoTopBottom = 4,
|
||||
}
|
||||
|
||||
public enum DisplayType
|
||||
{
|
||||
Custom = 0,
|
||||
Full = 1,
|
||||
Half = 2,
|
||||
}
|
||||
|
||||
private bool sourceRectsVisible = false;
|
||||
private bool destRectsVisible = false;
|
||||
|
||||
private Material _SrcRectMaterial;
|
||||
protected Material SrcRectMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_SrcRectMaterial == null)
|
||||
{
|
||||
string[] shaders = AssetDatabase.FindAssets("OVROverlaySrcRectEditor");
|
||||
|
||||
if (shaders.Length > 0)
|
||||
{
|
||||
Shader shader = (Shader)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(shaders[0]), typeof(Shader));
|
||||
|
||||
if (shader != null)
|
||||
{
|
||||
_SrcRectMaterial = new Material(shader);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _SrcRectMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
private Material _DestRectMaterial;
|
||||
protected Material DestRectMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DestRectMaterial == null)
|
||||
{
|
||||
string[] shaders = AssetDatabase.FindAssets("OVROverlayDestRectEditor");
|
||||
|
||||
if (shaders.Length > 0)
|
||||
{
|
||||
Shader shader = (Shader)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(shaders[0]), typeof(Shader));
|
||||
|
||||
if (shader != null)
|
||||
{
|
||||
_DestRectMaterial = new Material(shader);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _DestRectMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
private TextureRect _DraggingRect;
|
||||
private Side _DraggingSide;
|
||||
|
||||
enum TextureRect
|
||||
{
|
||||
None,
|
||||
SrcLeft,
|
||||
SrcRight,
|
||||
DestLeft,
|
||||
DestRight
|
||||
}
|
||||
|
||||
enum Side
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Top,
|
||||
Bottom
|
||||
}
|
||||
|
||||
private GUIContent[] selectableShapeNames;
|
||||
private OVROverlay.OverlayShape[] selectableShapeValues;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
List<GUIContent> selectableShapeNameList = new List<GUIContent>();
|
||||
List<OVROverlay.OverlayShape> selectableShapesValueList = new List<OVROverlay.OverlayShape>();
|
||||
foreach (OVROverlay.OverlayShape value in Enum.GetValues(typeof(OVROverlay.OverlayShape)))
|
||||
{
|
||||
if (!OVROverlay.IsPassthroughShape(value))
|
||||
{
|
||||
string name = Enum.GetName(typeof(OVROverlay.OverlayShape), value);
|
||||
selectableShapeNameList.Add(new GUIContent(name, name));
|
||||
selectableShapesValueList.Add(value);
|
||||
}
|
||||
}
|
||||
selectableShapeNames = selectableShapeNameList.ToArray();
|
||||
selectableShapeValues = selectableShapesValueList.ToArray();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
OVROverlay overlay = (OVROverlay)target;
|
||||
if (overlay == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField("Display Order", EditorStyles.boldLabel);
|
||||
overlay.currentOverlayType = (OVROverlay.OverlayType)EditorGUILayout.EnumPopup(new GUIContent("Current Overlay Type", "Whether this overlay should layer behind the scene or in front of it"), overlay.currentOverlayType);
|
||||
overlay.compositionDepth = EditorGUILayout.IntField(new GUIContent("Composition Depth", "Depth value used to sort OVROverlays in the scene, smaller value appears in front"), overlay.compositionDepth);
|
||||
overlay.noDepthBufferTesting = EditorGUILayout.Toggle(new GUIContent("No Depth Buffer Testing", "The noDepthBufferTesting will stop layer's depth buffer compositing even if the engine has \"Shared Depth Buffer\" enabled"), overlay.noDepthBufferTesting);
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField(new GUIContent("Overlay Shape", "The shape of this overlay"), EditorStyles.boldLabel);
|
||||
int currentShapeIndex = Array.IndexOf(selectableShapeValues, overlay.currentOverlayShape);
|
||||
if (currentShapeIndex == -1) {
|
||||
Debug.LogError("Invalid shape encountered");
|
||||
currentShapeIndex = 0;
|
||||
}
|
||||
currentShapeIndex = EditorGUILayout.Popup(new GUIContent("Overlay Shape", "The shape of this overlay"), currentShapeIndex, selectableShapeNames);
|
||||
overlay.currentOverlayShape = selectableShapeValues[currentShapeIndex];
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.LabelField("Layer Properties", EditorStyles.boldLabel);
|
||||
overlay.useBicubicFiltering = EditorGUILayout.Toggle(new GUIContent("Bicubic Filtering",
|
||||
"Whether this layer should use bicubic filtering. This can increase quality for small details on text and icons being viewed at farther distances."), overlay.useBicubicFiltering);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.LabelField("Textures", EditorStyles.boldLabel);
|
||||
|
||||
#if UNITY_ANDROID
|
||||
bool lastIsExternalSurface = overlay.isExternalSurface;
|
||||
overlay.isExternalSurface = EditorGUILayout.Toggle(new GUIContent("Is External Surface", "On Android, retrieve an Android Surface object to render to (e.g., video playback)"), overlay.isExternalSurface);
|
||||
|
||||
if (lastIsExternalSurface)
|
||||
{
|
||||
overlay.externalSurfaceWidth = EditorGUILayout.IntField("External Surface Width", overlay.externalSurfaceWidth);
|
||||
overlay.externalSurfaceHeight = EditorGUILayout.IntField("External Surface Height", overlay.externalSurfaceHeight);
|
||||
overlay.isProtectedContent = EditorGUILayout.Toggle(new GUIContent("Is Protected Content", "The external surface has L1 widevine protection."), overlay.isProtectedContent);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (overlay.textures == null)
|
||||
{
|
||||
overlay.textures = new Texture[2];
|
||||
}
|
||||
if (overlay.textures.Length < 2)
|
||||
{
|
||||
Texture[] tmp = new Texture[2];
|
||||
for (int i = 0; i < overlay.textures.Length; i++)
|
||||
{
|
||||
tmp[i] = overlay.textures[i];
|
||||
}
|
||||
overlay.textures = tmp;
|
||||
}
|
||||
|
||||
var labelControlRect = EditorGUILayout.GetControlRect();
|
||||
EditorGUI.LabelField(new Rect(labelControlRect.x, labelControlRect.y, labelControlRect.width / 2, labelControlRect.height), new GUIContent("Left Texture", "Texture used for the left eye"));
|
||||
EditorGUI.LabelField(new Rect(labelControlRect.x + labelControlRect.width / 2, labelControlRect.y, labelControlRect.width / 2, labelControlRect.height), new GUIContent("Right Texture", "Texture used for the right eye"));
|
||||
|
||||
|
||||
var textureControlRect = EditorGUILayout.GetControlRect(GUILayout.Height(64));
|
||||
|
||||
overlay.textures[0] = (Texture)EditorGUI.ObjectField(new Rect(textureControlRect.x, textureControlRect.y, 64, textureControlRect.height), overlay.textures[0], typeof(Texture), true);
|
||||
Texture right = (Texture)EditorGUI.ObjectField(new Rect(textureControlRect.x + textureControlRect.width / 2, textureControlRect.y, 64, textureControlRect.height), overlay.textures[1] != null ? overlay.textures[1] : overlay.textures[0], typeof(Texture), true);
|
||||
if (right == overlay.textures[0])
|
||||
{
|
||||
overlay.textures[1] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
overlay.textures[1] = right;
|
||||
}
|
||||
|
||||
overlay.isDynamic = EditorGUILayout.Toggle(new GUIContent("Dynamic Texture", "This texture will be updated dynamically at runtime (e.g., Video)"), overlay.isDynamic);
|
||||
#if !UNITY_ANDROID
|
||||
overlay.isProtectedContent = EditorGUILayout.Toggle(new GUIContent("Is Protected Content", "The texture has copy protection, e.g., HDCP"), overlay.isProtectedContent);
|
||||
#endif
|
||||
}
|
||||
if (overlay.currentOverlayShape == OVROverlay.OverlayShape.Cylinder || overlay.currentOverlayShape == OVROverlay.OverlayShape.Equirect || overlay.currentOverlayShape == OVROverlay.OverlayShape.Quad || overlay.currentOverlayShape == OVROverlay.OverlayShape.Fisheye)
|
||||
{
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Texture Rects", EditorStyles.boldLabel);
|
||||
|
||||
bool lastOverrideTextureRectMatrix = overlay.overrideTextureRectMatrix;
|
||||
overlay.overrideTextureRectMatrix = !EditorGUILayout.Toggle(new GUIContent("Use Default Rects", overlay.textures[1] == null ? "If you need to use a single texture as a stereo image, uncheck this box" : "Uncheck this box if you need to clip you textures or layer"), !overlay.overrideTextureRectMatrix);
|
||||
|
||||
if (lastOverrideTextureRectMatrix)
|
||||
{
|
||||
sourceRectsVisible = EditorGUILayout.Foldout(sourceRectsVisible, new GUIContent("Source Rects", "What portion of the source texture will ultimately be shown in each eye."));
|
||||
|
||||
if (sourceRectsVisible)
|
||||
{
|
||||
var mat = SrcRectMaterial;
|
||||
|
||||
if (mat != null)
|
||||
{
|
||||
Rect drawRect = EditorGUILayout.GetControlRect(GUILayout.Height(128 + 8));
|
||||
Vector4 srcLeft = new Vector4(Mathf.Max(0.0f, overlay.srcRectLeft.x), Mathf.Max(0.0f, overlay.srcRectLeft.y), Mathf.Min(1.0f - overlay.srcRectLeft.x, overlay.srcRectLeft.width), Mathf.Min(1.0f - overlay.srcRectLeft.y, overlay.srcRectLeft.height));
|
||||
Vector4 srcRight = new Vector4(Mathf.Max(0.0f, overlay.srcRectRight.x), Mathf.Max(0.0f, overlay.srcRectRight.y), Mathf.Min(1.0f - overlay.srcRectRight.x, overlay.srcRectRight.width), Mathf.Min(1.0f - overlay.srcRectRight.y, overlay.srcRectRight.height));
|
||||
|
||||
if (overlay.invertTextureRects)
|
||||
{
|
||||
srcLeft.y = 1 - srcLeft.y - srcLeft.w;
|
||||
srcRight.y = 1 - srcRight.y - srcRight.w;
|
||||
}
|
||||
mat.SetVector("_SrcRectLeft", srcLeft);
|
||||
mat.SetVector("_SrcRectRight", srcRight);
|
||||
// center our draw rect
|
||||
var drawRectCentered = new Rect(drawRect.x + drawRect.width / 2 - 128 - 4, drawRect.y, 256 + 8, drawRect.height);
|
||||
EditorGUI.DrawPreviewTexture(drawRectCentered, overlay.textures[0] ?? Texture2D.blackTexture, mat);
|
||||
|
||||
var drawRectInset = new Rect(drawRectCentered.x + 4, drawRectCentered.y + 4, drawRectCentered.width - 8, drawRectCentered.height - 8);
|
||||
UpdateRectDragging(drawRectInset, drawRectInset, TextureRect.SrcLeft, TextureRect.SrcRight, overlay.invertTextureRects, ref overlay.srcRectLeft, ref overlay.srcRectRight);
|
||||
CreateCursorRects(drawRectInset, overlay.srcRectLeft, overlay.invertTextureRects);
|
||||
CreateCursorRects(drawRectInset, overlay.srcRectRight, overlay.invertTextureRects);
|
||||
}
|
||||
|
||||
var labelControlRect = EditorGUILayout.GetControlRect();
|
||||
EditorGUI.LabelField(new Rect(labelControlRect.x, labelControlRect.y, labelControlRect.width / 2, labelControlRect.height), new GUIContent("Left Source Rect", "The rect in the source image that will be displayed on the left eye layer"));
|
||||
EditorGUI.LabelField(new Rect(labelControlRect.x + labelControlRect.width / 2, labelControlRect.y, labelControlRect.width / 2, labelControlRect.height), new GUIContent("Right Source Rect", "The rect in the source image that will be displayed on the right eye layer"));
|
||||
|
||||
var rectControlRect = EditorGUILayout.GetControlRect(GUILayout.Height(34));
|
||||
|
||||
overlay.srcRectLeft = Clamp01(EditorGUI.RectField(new Rect(rectControlRect.x, rectControlRect.y, rectControlRect.width / 2 - 20, rectControlRect.height), overlay.srcRectLeft));
|
||||
overlay.srcRectRight = Clamp01(EditorGUI.RectField(new Rect(rectControlRect.x + rectControlRect.width / 2, rectControlRect.y, rectControlRect.width / 2 - 20, rectControlRect.height), overlay.srcRectRight));
|
||||
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (overlay.textures[1] != null)
|
||||
{
|
||||
if (GUILayout.Button(new GUIContent("Reset To Default", "Reset Source Rects to default")))
|
||||
{
|
||||
SetRectsByVideoType(overlay, StereoType.Stereo, DisplayType.Custom);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button(new GUIContent("Monoscopic", "Display the full Texture in both eyes")))
|
||||
{
|
||||
SetRectsByVideoType(overlay, StereoType.Mono, DisplayType.Custom);
|
||||
}
|
||||
if (GUILayout.Button(new GUIContent("Stereo Left/Right", "The left half of the texture is displayed in the left eye, and the right half in the right eye")))
|
||||
{
|
||||
SetRectsByVideoType(overlay, StereoType.StereoLeftRight, DisplayType.Custom);
|
||||
}
|
||||
if (GUILayout.Button(new GUIContent("Stereo Top/Bottom", "The top half of the texture is displayed in the left eye, and the bottom half in the right eye")))
|
||||
{
|
||||
SetRectsByVideoType(overlay, StereoType.StereoTopBottom, DisplayType.Custom);
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
}
|
||||
destRectsVisible = EditorGUILayout.Foldout(destRectsVisible, new GUIContent("Destination Rects", "What portion of the destination texture that the source will be rendered into."));
|
||||
if (destRectsVisible)
|
||||
{
|
||||
|
||||
var mat = DestRectMaterial;
|
||||
|
||||
if (mat != null)
|
||||
{
|
||||
Rect drawRect = EditorGUILayout.GetControlRect(GUILayout.Height(128 + 8));
|
||||
|
||||
Vector4 srcLeft = new Vector4(Mathf.Max(0.0f, overlay.srcRectLeft.x), Mathf.Max(0.0f, overlay.srcRectLeft.y), Mathf.Min(1.0f - overlay.srcRectLeft.x, overlay.srcRectLeft.width), Mathf.Min(1.0f - overlay.srcRectLeft.y, overlay.srcRectLeft.height));
|
||||
Vector4 srcRight = new Vector4(Mathf.Max(0.0f, overlay.srcRectRight.x), Mathf.Max(0.0f, overlay.srcRectRight.y), Mathf.Min(1.0f - overlay.srcRectRight.x, overlay.srcRectRight.width), Mathf.Min(1.0f - overlay.srcRectRight.y, overlay.srcRectRight.height));
|
||||
Vector4 destLeft = new Vector4(Mathf.Max(0.0f, overlay.destRectLeft.x), Mathf.Max(0.0f, overlay.destRectLeft.y), Mathf.Min(1.0f - overlay.destRectLeft.x, overlay.destRectLeft.width), Mathf.Min(1.0f - overlay.destRectLeft.y, overlay.destRectLeft.height));
|
||||
Vector4 destRight = new Vector4(Mathf.Max(0.0f, overlay.destRectRight.x), Mathf.Max(0.0f, overlay.destRectRight.y), Mathf.Min(1.0f - overlay.destRectRight.x, overlay.destRectRight.width), Mathf.Min(1.0f - overlay.destRectRight.y, overlay.destRectRight.height));
|
||||
|
||||
if (overlay.invertTextureRects)
|
||||
{
|
||||
srcLeft.y = 1 - srcLeft.y - srcLeft.w;
|
||||
srcRight.y = 1 - srcRight.y - srcRight.w;
|
||||
destLeft.y = 1 - destLeft.y - destLeft.w;
|
||||
destRight.y = 1 - destRight.y - destRight.w;
|
||||
}
|
||||
mat.SetVector("_SrcRectLeft", srcLeft);
|
||||
mat.SetVector("_SrcRectRight", srcRight);
|
||||
mat.SetVector("_DestRectLeft", destLeft);
|
||||
mat.SetVector("_DestRectRight", destRight);
|
||||
mat.SetColor("_BackgroundColor", EditorGUIUtility.isProSkin ? (Color)new Color32(56, 56, 56, 255) : (Color)new Color32(194, 194, 194, 255));
|
||||
|
||||
var drawRectCentered = new Rect(drawRect.x + drawRect.width / 2 - 128 - 16 - 4, drawRect.y, 256 + 32 + 8, drawRect.height);
|
||||
// center our draw rect
|
||||
EditorGUI.DrawPreviewTexture(drawRectCentered, overlay.textures[0] ?? Texture2D.blackTexture, mat);
|
||||
|
||||
var drawRectInsetLeft = new Rect(drawRectCentered.x + 4, drawRectCentered.y + 4, drawRectCentered.width / 2 - 20, drawRectCentered.height - 8);
|
||||
var drawRectInsetRight = new Rect(drawRectCentered.x + drawRectCentered.width / 2 + 16, drawRectCentered.y + 4, drawRectCentered.width / 2 - 20, drawRectCentered.height - 8);
|
||||
UpdateRectDragging(drawRectInsetLeft, drawRectInsetRight, TextureRect.DestLeft, TextureRect.DestRight, overlay.invertTextureRects, ref overlay.destRectLeft, ref overlay.destRectRight);
|
||||
|
||||
CreateCursorRects(drawRectInsetLeft, overlay.destRectLeft, overlay.invertTextureRects);
|
||||
CreateCursorRects(drawRectInsetRight, overlay.destRectRight, overlay.invertTextureRects);
|
||||
|
||||
}
|
||||
|
||||
var labelControlRect = EditorGUILayout.GetControlRect();
|
||||
EditorGUI.LabelField(new Rect(labelControlRect.x, labelControlRect.y, labelControlRect.width / 2, labelControlRect.height), new GUIContent("Left Destination Rect", "The rect in the destination layer the left eye will display to"));
|
||||
EditorGUI.LabelField(new Rect(labelControlRect.x + labelControlRect.width / 2, labelControlRect.y, labelControlRect.width / 2, labelControlRect.height), new GUIContent("Right Destination Rect", "The rect in the destination layer the right eye will display to"));
|
||||
|
||||
var rectControlRect = EditorGUILayout.GetControlRect(GUILayout.Height(34));
|
||||
|
||||
overlay.destRectLeft = Clamp01(EditorGUI.RectField(new Rect(rectControlRect.x, rectControlRect.y, rectControlRect.width / 2 - 20, rectControlRect.height), overlay.destRectLeft));
|
||||
overlay.destRectRight = Clamp01(EditorGUI.RectField(new Rect(rectControlRect.x + rectControlRect.width / 2, rectControlRect.y, rectControlRect.width / 2 - 20, rectControlRect.height), overlay.destRectRight));
|
||||
|
||||
|
||||
if (overlay.currentOverlayShape == OVROverlay.OverlayShape.Equirect)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button(new GUIContent("360 Video", "Display the full 360 layer")))
|
||||
{
|
||||
SetRectsByVideoType(overlay, StereoType.Custom, DisplayType.Full);
|
||||
}
|
||||
if (GUILayout.Button(new GUIContent("180 Video", "Display the front 180 layer")))
|
||||
{
|
||||
SetRectsByVideoType(overlay, StereoType.Custom, DisplayType.Half);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button(new GUIContent("Reset To Default", "Reset Source Rects to default")))
|
||||
{
|
||||
SetRectsByVideoType(overlay, StereoType.Custom, DisplayType.Full);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
overlay.invertTextureRects = EditorGUILayout.Toggle(new GUIContent("Invert Rect Coordinates", "Check this box to use the top left corner of the texture as the origin"), overlay.invertTextureRects);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.LabelField("Color Scale", EditorStyles.boldLabel);
|
||||
EditorGUILayout.Space();
|
||||
overlay.overridePerLayerColorScaleAndOffset = EditorGUILayout.Toggle(new GUIContent("Override Color Scale", "Manually set color scale and offset of this layer, regardless of what the global values are from OVRManager.SetColorScaleAndOffset()."), overlay.overridePerLayerColorScaleAndOffset);
|
||||
if (overlay.overridePerLayerColorScaleAndOffset)
|
||||
{
|
||||
Vector4 colorScale = EditorGUILayout.Vector4Field(new GUIContent("Color Scale", "Scale that the color values for this overlay will be multiplied by."), overlay.colorScale);
|
||||
Vector4 colorOffset = EditorGUILayout.Vector4Field(new GUIContent("Color Offset", "Offset that the color values for this overlay will be added to."), overlay.colorOffset);
|
||||
overlay.SetPerLayerColorScaleAndOffset(colorScale, colorOffset);
|
||||
}
|
||||
|
||||
EditorGUILayout.Separator();
|
||||
EditorGUILayout.LabelField("Preview", EditorStyles.boldLabel);
|
||||
overlay.previewInEditor = EditorGUILayout.Toggle(new GUIContent("Preview in Editor (Experimental)", "Preview the overlay in the editor using a mesh renderer."), overlay.previewInEditor);
|
||||
|
||||
|
||||
|
||||
EditorUtility.SetDirty(overlay);
|
||||
}
|
||||
|
||||
private Rect Clamp01(Rect rect)
|
||||
{
|
||||
rect.x = Mathf.Clamp01(rect.x);
|
||||
rect.y = Mathf.Clamp01(rect.y);
|
||||
rect.width = Mathf.Clamp01(rect.width);
|
||||
rect.height = Mathf.Clamp01(rect.height);
|
||||
return rect;
|
||||
}
|
||||
|
||||
private bool IsUnitRect(Rect rect)
|
||||
{
|
||||
return IsRect(rect, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
private bool IsRect(Rect rect, float x, float y, float w, float h)
|
||||
{
|
||||
return rect.x == x && rect.y == y && rect.width == w && rect.height == h;
|
||||
}
|
||||
|
||||
private StereoType GetStereoType(OVROverlay overlay)
|
||||
{
|
||||
if (overlay.textures[0] != null && overlay.textures[1] != null)
|
||||
{
|
||||
if (IsUnitRect(overlay.srcRectLeft) && IsUnitRect(overlay.srcRectRight))
|
||||
{
|
||||
return StereoType.Stereo;
|
||||
}
|
||||
else
|
||||
{
|
||||
return StereoType.Custom;
|
||||
}
|
||||
}
|
||||
else if (overlay.textures[0] != null)
|
||||
{
|
||||
if (IsUnitRect(overlay.srcRectLeft) && IsUnitRect(overlay.srcRectRight))
|
||||
{
|
||||
return StereoType.Mono;
|
||||
}
|
||||
else if (IsRect(overlay.srcRectLeft, 0, 0, 0.5f, 1f) && IsRect(overlay.srcRectRight, 0.5f, 0, 0.5f, 1f))
|
||||
{
|
||||
return StereoType.StereoLeftRight;
|
||||
}
|
||||
else if (overlay.invertTextureRects && IsRect(overlay.srcRectLeft, 0, 0.0f, 1f, 0.5f) && IsRect(overlay.srcRectRight, 0f, 0.5f, 1f, 0.5f))
|
||||
{
|
||||
return StereoType.StereoTopBottom;
|
||||
}
|
||||
else if (!overlay.invertTextureRects && IsRect(overlay.srcRectLeft, 0, 0.5f, 1f, 0.5f) && IsRect(overlay.srcRectRight, 0f, 0f, 1f, 0.5f))
|
||||
{
|
||||
return StereoType.StereoTopBottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
return StereoType.Custom;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return StereoType.Mono;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetRectsByVideoType(OVROverlay overlay, StereoType stereoType, DisplayType displayType)
|
||||
{
|
||||
Rect srcRectLeft, srcRectRight, destRectLeft, destRectRight;
|
||||
|
||||
switch (displayType)
|
||||
{
|
||||
case DisplayType.Full:
|
||||
destRectLeft = destRectRight = new Rect(0, 0, 1, 1);
|
||||
break;
|
||||
|
||||
case DisplayType.Half:
|
||||
destRectLeft = destRectRight = new Rect(0.25f, 0, 0.5f, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
destRectLeft = overlay.destRectLeft;
|
||||
destRectRight = overlay.destRectRight;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (stereoType)
|
||||
{
|
||||
case StereoType.Mono:
|
||||
case StereoType.Stereo:
|
||||
srcRectLeft = srcRectRight = new Rect(0, 0, 1, 1);
|
||||
break;
|
||||
|
||||
case StereoType.StereoTopBottom:
|
||||
if (overlay.invertTextureRects)
|
||||
{
|
||||
srcRectLeft = new Rect(0, 0.0f, 1, 0.5f);
|
||||
srcRectRight = new Rect(0, 0.5f, 1, 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
srcRectLeft = new Rect(0, 0.5f, 1, 0.5f);
|
||||
srcRectRight = new Rect(0, 0.0f, 1, 0.5f);
|
||||
}
|
||||
break;
|
||||
|
||||
case StereoType.StereoLeftRight:
|
||||
srcRectLeft = new Rect(0, 0, 0.5f, 1);
|
||||
srcRectRight = new Rect(0.5f, 0, 0.5f, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
srcRectLeft = overlay.srcRectLeft;
|
||||
srcRectRight = overlay.srcRectRight;
|
||||
break;
|
||||
}
|
||||
overlay.SetSrcDestRects(srcRectLeft, srcRectRight, destRectLeft, destRectRight);
|
||||
}
|
||||
|
||||
private void GetCursorPoints(Rect drawRect, Rect selectRect, bool invertY, out Vector2 leftPos, out Vector2 rightPos, out Vector2 topPos, out Vector2 bottomPos)
|
||||
{
|
||||
if (invertY)
|
||||
{
|
||||
selectRect.y = 1 - selectRect.y - selectRect.height;
|
||||
}
|
||||
leftPos = new Vector2(drawRect.x + selectRect.x * drawRect.width, drawRect.y + (1 - selectRect.y - selectRect.height / 2) * drawRect.height);
|
||||
rightPos = new Vector2(drawRect.x + (selectRect.x + selectRect.width) * drawRect.width, drawRect.y + (1 - selectRect.y - selectRect.height / 2) * drawRect.height);
|
||||
topPos = new Vector2(drawRect.x + (selectRect.x + selectRect.width / 2) * drawRect.width, drawRect.y + (1 - selectRect.y - selectRect.height) * drawRect.height);
|
||||
bottomPos = new Vector2(drawRect.x + (selectRect.x + selectRect.width / 2) * drawRect.width, drawRect.y + (1 - selectRect.y) * drawRect.height);
|
||||
|
||||
if (invertY)
|
||||
{
|
||||
// swap top and bottom
|
||||
var tmp = topPos;
|
||||
topPos = bottomPos;
|
||||
bottomPos = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateCursorRects(Rect drawRect, Rect selectRect, bool invertY)
|
||||
{
|
||||
Vector2 leftPos, rightPos, topPos, bottomPos;
|
||||
GetCursorPoints(drawRect, selectRect, invertY, out leftPos, out rightPos, out topPos, out bottomPos);
|
||||
|
||||
EditorGUIUtility.AddCursorRect(new Rect(leftPos - 5 * Vector2.one, 10 * Vector2.one), MouseCursor.ResizeHorizontal);
|
||||
EditorGUIUtility.AddCursorRect(new Rect(rightPos - 5 * Vector2.one, 10 * Vector2.one), MouseCursor.ResizeHorizontal);
|
||||
EditorGUIUtility.AddCursorRect(new Rect(topPos - 5 * Vector2.one, 10 * Vector2.one), MouseCursor.ResizeVertical);
|
||||
EditorGUIUtility.AddCursorRect(new Rect(bottomPos - 5 * Vector2.one, 10 * Vector2.one), MouseCursor.ResizeVertical);
|
||||
}
|
||||
|
||||
private bool IsOverRectControls(Rect drawRect, Vector2 mousePos, Rect selectRect, bool invertY, ref Side side)
|
||||
{
|
||||
Vector2 leftPos, rightPos, topPos, bottomPos;
|
||||
GetCursorPoints(drawRect, selectRect, invertY, out leftPos, out rightPos, out topPos, out bottomPos);
|
||||
|
||||
if ((leftPos - mousePos).sqrMagnitude <= 25)
|
||||
{
|
||||
side = Side.Left;
|
||||
return true;
|
||||
}
|
||||
if ((rightPos - mousePos).sqrMagnitude <= 25)
|
||||
{
|
||||
side = Side.Right;
|
||||
return true;
|
||||
}
|
||||
if ((topPos - mousePos).sqrMagnitude <= 25)
|
||||
{
|
||||
side = Side.Top;
|
||||
return true;
|
||||
}
|
||||
if ((bottomPos - mousePos).sqrMagnitude <= 25)
|
||||
{
|
||||
side = Side.Bottom;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UpdateRectDragging(Rect drawingRectLeft, Rect drawingRectRight, TextureRect rectLeftType, TextureRect rectRightType, bool invertY, ref Rect rectLeft, ref Rect rectRight)
|
||||
{
|
||||
if (!Event.current.isMouse || Event.current.button != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Event.current.type == EventType.MouseUp)
|
||||
{
|
||||
_DraggingRect = TextureRect.None;
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 mousePos = Event.current.mousePosition;
|
||||
if (_DraggingRect == TextureRect.None && Event.current.type == EventType.MouseDown)
|
||||
{
|
||||
if (IsOverRectControls(drawingRectLeft, mousePos, rectLeft, invertY, ref _DraggingSide))
|
||||
{
|
||||
_DraggingRect = rectLeftType;
|
||||
}
|
||||
if (_DraggingRect == TextureRect.None || Event.current.shift)
|
||||
{
|
||||
if (IsOverRectControls(drawingRectRight, mousePos, rectRight, invertY, ref _DraggingSide))
|
||||
{
|
||||
_DraggingRect = rectRightType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_DraggingRect == rectLeftType)
|
||||
{
|
||||
SetRectSideValue(drawingRectLeft, mousePos, _DraggingSide, invertY, ref rectLeft);
|
||||
}
|
||||
if (_DraggingRect == rectRightType)
|
||||
{
|
||||
SetRectSideValue(drawingRectRight, mousePos, _DraggingSide, invertY, ref rectRight);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetRectSideValue(Rect drawingRect, Vector2 mousePos, Side side, bool invertY, ref Rect rect)
|
||||
{
|
||||
// quantize to 1/32
|
||||
float x = Mathf.Clamp01(Mathf.Round(((mousePos.x - drawingRect.x) / drawingRect.width) * 32) / 32.0f);
|
||||
float y = Mathf.Clamp01(Mathf.Round(((mousePos.y - drawingRect.y) / drawingRect.height) * 32) / 32.0f);
|
||||
if (!invertY)
|
||||
{
|
||||
y = 1 - y;
|
||||
}
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case Side.Left:
|
||||
float xMax = rect.xMax;
|
||||
rect.x = Mathf.Min(x, xMax);
|
||||
rect.width = xMax - rect.x;
|
||||
break;
|
||||
case Side.Right:
|
||||
rect.width = Mathf.Max(0, x - rect.x);
|
||||
break;
|
||||
case Side.Bottom:
|
||||
float yMax = rect.yMax;
|
||||
rect.y = Mathf.Min(y, yMax);
|
||||
rect.height = yMax - rect.y;
|
||||
break;
|
||||
case Side.Top:
|
||||
rect.height = Mathf.Max(0, y - rect.y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Oculus/VR/Scripts/Editor/OVROverlayEditor.cs.meta
Normal file
11
Assets/Oculus/VR/Scripts/Editor/OVROverlayEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fde3aeb28643f6c48a48f926ac7207e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
150
Assets/Oculus/VR/Scripts/Editor/OVROverlaySrcRectEditor.shader
Normal file
150
Assets/Oculus/VR/Scripts/Editor/OVROverlaySrcRectEditor.shader
Normal file
@@ -0,0 +1,150 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Unlit/OVROverlaySrcRectEditor"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
_SrcRectLeft ("SrcRectLeft", Vector) = (0,0,1,1)
|
||||
_SrcRectRight("SrcRectRight", Vector) = (0,0,1,1)
|
||||
_BackgroundColor("Background Color", Color) = (0.225, 0.225, 0.225, 1)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 leftDragX : TEXCOORD1;
|
||||
float4 leftDragY : TEXCOORD2;
|
||||
float4 rightDragX : TEXCOORD3;
|
||||
float4 rightDragY : TEXCOORD4;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
|
||||
float4 _SrcRectLeft;
|
||||
float4 _SrcRectRight;
|
||||
|
||||
fixed4 _BackgroundColor;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
// Add padding
|
||||
o.uv = (o.uv - 0.5) * (256.0 + 8.0) / (256.0) + 0.5;
|
||||
|
||||
// left
|
||||
o.leftDragX.x = _SrcRectLeft.x;
|
||||
o.leftDragY.x = _SrcRectLeft.y + _SrcRectLeft.w * 0.5;
|
||||
// right
|
||||
o.leftDragX.y = _SrcRectLeft.x + _SrcRectLeft.z;
|
||||
o.leftDragY.y = _SrcRectLeft.y + _SrcRectLeft.w * 0.5;
|
||||
// top
|
||||
o.leftDragX.z = _SrcRectLeft.x + _SrcRectLeft.z * 0.5;
|
||||
o.leftDragY.z = _SrcRectLeft.y;
|
||||
// bottom
|
||||
o.leftDragX.w = _SrcRectLeft.x + _SrcRectLeft.z * 0.5;
|
||||
o.leftDragY.w = _SrcRectLeft.y + _SrcRectLeft.w;
|
||||
// right
|
||||
o.rightDragX.x = _SrcRectRight.x;
|
||||
o.rightDragY.x = _SrcRectRight.y + _SrcRectRight.w * 0.5;
|
||||
// right
|
||||
o.rightDragX.y = _SrcRectRight.x + _SrcRectRight.z;
|
||||
o.rightDragY.y = _SrcRectRight.y + _SrcRectRight.w * 0.5;
|
||||
// top
|
||||
o.rightDragX.z = _SrcRectRight.x + _SrcRectRight.z * 0.5;
|
||||
o.rightDragY.z = _SrcRectRight.y;
|
||||
// bottom
|
||||
o.rightDragX.w = _SrcRectRight.x + _SrcRectRight.z * 0.5;
|
||||
o.rightDragY.w = _SrcRectRight.y + _SrcRectRight.w;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
float onDrag(float2 uv, float x, float y)
|
||||
{
|
||||
const float pixelSize = 6;
|
||||
return abs(uv.x - x) < ((pixelSize / 2) / 256.0) && abs(uv.y - y) < ((pixelSize / 2) / 128.0);
|
||||
}
|
||||
|
||||
float onLine(float2 uv, float4 rect)
|
||||
{
|
||||
return
|
||||
(abs(uv.x - rect.x) < (1 / 256.0) && uv.y >= rect.y && uv.y <= rect.y + rect.w) ||
|
||||
(abs(uv.x - rect.x - rect.z) < (1 / 256.0) && uv.y >= rect.y && uv.y <= rect.y + rect.w) ||
|
||||
(abs(uv.y - rect.y) < (1 / 128.0) && uv.x >= rect.x && uv.x <= rect.x + rect.z) ||
|
||||
(abs(uv.y - rect.y - rect.w) < (1 / 128.0) && uv.x >= rect.x && uv.x <= rect.x + rect.z);
|
||||
}
|
||||
|
||||
float checkerboard(float2 uv)
|
||||
{
|
||||
float x = floor(uv.x * (16));
|
||||
float y = floor(uv.y * 8);
|
||||
|
||||
return 2 * ((x + y) / 2.0 - floor((x + y) / 2.0));
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
// sample the texture
|
||||
fixed4 col = tex2D(_MainTex, i.uv);
|
||||
|
||||
col.rgb = lerp(0.41 - 0.13 * checkerboard(i.uv), col.rgb, col.a);
|
||||
|
||||
if (i.uv.x < 0 || i.uv.x > 1 || i.uv.y < 0 || i.uv.y > 1)
|
||||
{
|
||||
col = _BackgroundColor;
|
||||
}
|
||||
|
||||
float2 uv = i.uv.xy;
|
||||
|
||||
// now draw clipping objects
|
||||
float left = onLine(uv, _SrcRectLeft) ||
|
||||
onDrag(uv, i.leftDragX.x, i.leftDragY.x) ||
|
||||
onDrag(uv, i.leftDragX.y, i.leftDragY.y) ||
|
||||
onDrag(uv, i.leftDragX.z, i.leftDragY.z) ||
|
||||
onDrag(uv, i.leftDragX.w, i.leftDragY.w);
|
||||
|
||||
float right = onLine(uv, _SrcRectRight) ||
|
||||
onDrag(uv, i.rightDragX.x, i.rightDragY.x) ||
|
||||
onDrag(uv, i.rightDragX.y, i.rightDragY.y) ||
|
||||
onDrag(uv, i.rightDragX.z, i.rightDragY.z) ||
|
||||
onDrag(uv, i.rightDragX.w, i.rightDragY.w);
|
||||
|
||||
return lerp(col, fixed4(left, right, 0, 1), left || right);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 589b36d0aa66c7349bcff8750b670434
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
68
Assets/Oculus/VR/Scripts/Editor/OVRPassthroughLayerEditor.cs
Normal file
68
Assets/Oculus/VR/Scripts/Editor/OVRPassthroughLayerEditor.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using ColorMapEditorType = OVRPassthroughLayer.ColorMapEditorType;
|
||||
|
||||
[CustomEditor(typeof(OVRPassthroughLayer))]
|
||||
public class OVRPassthroughLayerEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
OVRPassthroughLayer layer = (OVRPassthroughLayer)target;
|
||||
|
||||
layer.projectionSurfaceType = (OVRPassthroughLayer.ProjectionSurfaceType)EditorGUILayout.EnumPopup(
|
||||
new GUIContent("Projection Surface", "The type of projection surface for this Passthrough layer"),
|
||||
layer.projectionSurfaceType);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Compositing", EditorStyles.boldLabel);
|
||||
layer.overlayType = (OVROverlay.OverlayType)EditorGUILayout.EnumPopup(new GUIContent("Placement", "Whether this overlay should layer behind the scene or in front of it"), layer.overlayType);
|
||||
layer.compositionDepth = EditorGUILayout.IntField(new GUIContent("Composition Depth", "Depth value used to sort layers in the scene, smaller value appears in front"), layer.compositionDepth);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Style", EditorStyles.boldLabel);
|
||||
|
||||
layer.textureOpacity = EditorGUILayout.Slider("Opacity", layer.textureOpacity, 0, 1);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
layer.edgeRenderingEnabled = EditorGUILayout.Toggle(
|
||||
new GUIContent("Edge Rendering", "Highlight salient edges in the camera images in a specific color"),
|
||||
layer.edgeRenderingEnabled);
|
||||
layer.edgeColor = EditorGUILayout.ColorField("Edge Color", layer.edgeColor);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
System.Func<System.Enum, bool> hideCustomColorMapOption = option => (ColorMapEditorType)option != ColorMapEditorType.Custom;
|
||||
layer.colorMapEditorType = (ColorMapEditorType)EditorGUILayout.EnumPopup(
|
||||
new GUIContent("Color Map"),
|
||||
layer.colorMapEditorType,
|
||||
hideCustomColorMapOption,
|
||||
false);
|
||||
|
||||
if (layer.colorMapEditorType == ColorMapEditorType.Controls)
|
||||
{
|
||||
layer.colorMapEditorContrast = EditorGUILayout.Slider("Contrast", layer.colorMapEditorContrast, -1, 1);
|
||||
layer.colorMapEditorBrightness = EditorGUILayout.Slider("Brightness", layer.colorMapEditorBrightness, -1, 1);
|
||||
layer.colorMapEditorPosterize = EditorGUILayout.Slider("Posterize", layer.colorMapEditorPosterize, 0, 1);
|
||||
layer.colorMapEditorGradient = EditorGUILayout.GradientField("Colorize", layer.colorMapEditorGradient);
|
||||
}
|
||||
|
||||
if (GUI.changed)
|
||||
{
|
||||
EditorUtility.SetDirty(layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f49479bb47dde564680a2a5bdf5a6dfe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/Oculus/VR/Scripts/Editor/OVRProfilerDeprecated.cs
Normal file
33
Assets/Oculus/VR/Scripts/Editor/OVRProfilerDeprecated.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections.Generic;
|
||||
using Assets.OVR.Scripts;
|
||||
|
||||
public class OVRProfilerDeprecated : EditorWindow
|
||||
{
|
||||
[MenuItem("Oculus/Tools/(Deprecated) OVR Profiler", false, 200000)]
|
||||
static void Init()
|
||||
{
|
||||
Debug.LogWarning("OVR Profiler has been replaced by OVR Performance Lint Tool");
|
||||
// Get existing open window or if none, make a new one:
|
||||
EditorWindow.GetWindow(typeof(OVRLint));
|
||||
OVRPlugin.SendEvent("perf_lint", "activated");
|
||||
OVRLint.RunCheck();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad582af7c1f87bf4b99ef951b26ec465
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
188
Assets/Oculus/VR/Scripts/Editor/OVRProjectConfigEditor.cs
Normal file
188
Assets/Oculus/VR/Scripts/Editor/OVRProjectConfigEditor.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(OVRProjectConfig))]
|
||||
public class OVRProjectConfigEditor : Editor
|
||||
{
|
||||
override public void OnInspectorGUI()
|
||||
{
|
||||
OVRProjectConfig projectConfig = (OVRProjectConfig)target;
|
||||
DrawTargetDeviceInspector(projectConfig);
|
||||
EditorGUILayout.Space();
|
||||
DrawProjectConfigInspector(projectConfig);
|
||||
}
|
||||
|
||||
public static void DrawTargetDeviceInspector(OVRProjectConfig projectConfig)
|
||||
{
|
||||
// Target Devices
|
||||
EditorGUILayout.LabelField("Target Devices", EditorStyles.boldLabel);
|
||||
#if PRIORITIZE_OCULUS_XR_SETTINGS
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Configure Target Devices in Oculus XR Plugin Settings.", GUILayout.Width(320));
|
||||
GUILayout.FlexibleSpace();
|
||||
if (GUILayout.Button("Open Settings"))
|
||||
SettingsService.OpenProjectSettings("Project/XR Plug-in Management/Oculus");
|
||||
EditorGUILayout.EndHorizontal();
|
||||
#else
|
||||
bool hasModified = false;
|
||||
|
||||
foreach (OVRProjectConfig.DeviceType deviceType in System.Enum.GetValues(typeof(OVRProjectConfig.DeviceType)))
|
||||
{
|
||||
bool oldSupportsDevice = projectConfig.targetDeviceTypes.Contains(deviceType);
|
||||
bool newSupportsDevice = oldSupportsDevice;
|
||||
OVREditorUtil.SetupBoolField(projectConfig, ObjectNames.NicifyVariableName(deviceType.ToString()), ref newSupportsDevice, ref hasModified);
|
||||
|
||||
if (newSupportsDevice && !oldSupportsDevice)
|
||||
{
|
||||
projectConfig.targetDeviceTypes.Add(deviceType);
|
||||
}
|
||||
else if (oldSupportsDevice && !newSupportsDevice)
|
||||
{
|
||||
projectConfig.targetDeviceTypes.Remove(deviceType);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasModified)
|
||||
{
|
||||
OVRProjectConfig.CommitProjectConfig(projectConfig);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
enum eProjectConfigTab
|
||||
{
|
||||
General = 0,
|
||||
BuildSettings,
|
||||
Security,
|
||||
Experimental,
|
||||
}
|
||||
static eProjectConfigTab selectedTab = 0;
|
||||
static string[] projectConfigTabStrs = null;
|
||||
|
||||
public static void DrawProjectConfigInspector(OVRProjectConfig projectConfig)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
EditorGUILayout.LabelField("Quest Features", EditorStyles.boldLabel);
|
||||
|
||||
if (projectConfigTabStrs == null)
|
||||
{
|
||||
projectConfigTabStrs = Enum.GetNames(typeof(eProjectConfigTab));
|
||||
for (int i = 0; i < projectConfigTabStrs.Length; ++i)
|
||||
projectConfigTabStrs[i] = ObjectNames.NicifyVariableName(projectConfigTabStrs[i]);
|
||||
}
|
||||
|
||||
selectedTab = (eProjectConfigTab)GUILayout.SelectionGrid((int)selectedTab, projectConfigTabStrs, 3, GUI.skin.button);
|
||||
EditorGUILayout.Space(5);
|
||||
bool hasModified = false;
|
||||
switch (selectedTab)
|
||||
{
|
||||
case eProjectConfigTab.General:
|
||||
|
||||
// Show overlay support option
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.Toggle(new GUIContent("Focus Aware (Required)",
|
||||
"If checked, the new overlay will be displayed when the user presses the home button. The game will not be paused, but will now receive InputFocusLost and InputFocusAcquired events."), true);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
// Hand Tracking Support
|
||||
OVREditorUtil.SetupEnumField(projectConfig, "Hand Tracking Support", ref projectConfig.handTrackingSupport, ref hasModified);
|
||||
|
||||
OVREditorUtil.SetupEnumField(projectConfig, new GUIContent("Hand Tracking Frequency",
|
||||
"Note that a higher tracking frequency will reserve some performance headroom from the application's budget."),
|
||||
ref projectConfig.handTrackingFrequency, ref hasModified, "https://developer.oculus.com/documentation/unity/unity-handtracking/#enable-hand-tracking");
|
||||
|
||||
// Enable Render Model Support
|
||||
OVREditorUtil.SetupEnumField(projectConfig, new GUIContent("Render Model Support",
|
||||
"If enabled, the application will be able to load render models from the runtime."),
|
||||
ref projectConfig.renderModelSupport, ref hasModified);
|
||||
|
||||
// System Keyboard Support
|
||||
OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Requires System Keyboard",
|
||||
"If checked, the Oculus System keyboard will be enabled for Unity input fields and any calls to open/close the Unity TouchScreenKeyboard."),
|
||||
ref projectConfig.requiresSystemKeyboard, ref hasModified);
|
||||
|
||||
// Tracked Keyboard Support
|
||||
var trackedKeyboardSetting = projectConfig.trackedKeyboardSupport;
|
||||
OVREditorUtil.SetupEnumField(projectConfig, "Tracked Keyboard Support", ref projectConfig.trackedKeyboardSupport, ref hasModified);
|
||||
if (trackedKeyboardSetting != projectConfig.trackedKeyboardSupport && projectConfig.trackedKeyboardSupport > OVRProjectConfig.TrackedKeyboardSupport.None)
|
||||
projectConfig.renderModelSupport = OVRProjectConfig.RenderModelSupport.Enabled;
|
||||
if (projectConfig.trackedKeyboardSupport > OVRProjectConfig.TrackedKeyboardSupport.None && projectConfig.renderModelSupport == OVRProjectConfig.RenderModelSupport.Disabled)
|
||||
EditorGUILayout.LabelField("Render model support is required to load keyboard models from the runtime.");
|
||||
|
||||
// System Splash Screen
|
||||
OVREditorUtil.SetupTexture2DField(projectConfig, new GUIContent("System Splash Screen",
|
||||
"If set, the Splash Screen will be presented by the Operating System as a high quality composition layer at launch time."),
|
||||
ref projectConfig.systemSplashScreen, ref hasModified,
|
||||
"https://developer.oculus.com/documentation/unity/unity-splash-screen/");
|
||||
|
||||
// Allow optional 3-dof head-tracking
|
||||
OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Allow Optional 3DoF Head Tracking",
|
||||
"If checked, application can work in both 6DoF and 3DoF modes. It's highly recommended to keep it unchecked unless your project strongly needs the 3DoF head tracking."),
|
||||
ref projectConfig.allowOptional3DofHeadTracking, ref hasModified);
|
||||
|
||||
// Enable passthrough capability
|
||||
OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Passthrough Capability Enabled",
|
||||
"If checked, this application can use passthrough functionality. This option must be enabled at build time, otherwise initializing passthrough and creating passthrough layers in application scenes will fail."),
|
||||
ref projectConfig.insightPassthroughEnabled, ref hasModified);
|
||||
|
||||
break;
|
||||
|
||||
case eProjectConfigTab.BuildSettings:
|
||||
|
||||
OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Skip Unneeded Shaders",
|
||||
"If checked, prevent building shaders that are not used by default to reduce time spent when building."),
|
||||
ref projectConfig.skipUnneededShaders, ref hasModified,
|
||||
"https://developer.oculus.com/documentation/unity/unity-strip-shaders/");
|
||||
|
||||
break;
|
||||
|
||||
case eProjectConfigTab.Security:
|
||||
|
||||
OVREditorUtil.SetupBoolField(projectConfig, "Disable Backups", ref projectConfig.disableBackups, ref hasModified,
|
||||
"https://developer.android.com/guide/topics/data/autobackup#EnablingAutoBackup");
|
||||
OVREditorUtil.SetupBoolField(projectConfig, "Enable NSC Configuration", ref projectConfig.enableNSCConfig, ref hasModified,
|
||||
"https://developer.android.com/training/articles/security-config");
|
||||
EditorGUI.BeginDisabledGroup(!projectConfig.enableNSCConfig);
|
||||
++EditorGUI.indentLevel;
|
||||
OVREditorUtil.SetupInputField(projectConfig, "Custom Security XML Path", ref projectConfig.securityXmlPath, ref hasModified);
|
||||
--EditorGUI.indentLevel;
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
break;
|
||||
|
||||
case eProjectConfigTab.Experimental:
|
||||
|
||||
// Experimental Features Enabled
|
||||
OVREditorUtil.SetupBoolField(projectConfig, new GUIContent("Experimental Features Enabled",
|
||||
"If checked, this application can use experimental features. Note that such features are for developer use only. This option must be disabled when submitting to the Oculus Store."),
|
||||
ref projectConfig.experimentalFeaturesEnabled, ref hasModified);
|
||||
|
||||
// Spatial Anchors Support
|
||||
OVREditorUtil.SetupEnumField(projectConfig, "Spatial Anchors Support", ref projectConfig.spatialAnchorsSupport, ref hasModified);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
// apply any pending changes to project config
|
||||
if (hasModified)
|
||||
{
|
||||
OVRProjectConfig.CommitProjectConfig(projectConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 950d95332920b814ea41df294856f96a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "Oculus.VR.Scripts.Editor",
|
||||
"references": [
|
||||
"Oculus.VR",
|
||||
"Oculus.VR.Editor"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.xr.management",
|
||||
"expression": "",
|
||||
"define": "USING_XR_MANAGEMENT"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.xr.oculus",
|
||||
"expression": "",
|
||||
"define": "USING_XR_SDK_OCULUS"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.xr.oculus",
|
||||
"expression": "1.7.0",
|
||||
"define": "PRIORITIZE_OCULUS_XR_SETTINGS"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7305c54a43f3814439df347c7519653e
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user