diff --git a/Assets/SteamVR/Editor/SteamVR_Settings.cs b/Assets/SteamVR/Editor/SteamVR_Settings.cs index ef4278b..4688f54 100644 --- a/Assets/SteamVR/Editor/SteamVR_Settings.cs +++ b/Assets/SteamVR/Editor/SteamVR_Settings.cs @@ -28,16 +28,16 @@ public class SteamVR_Settings : EditorWindow const string visibleInBackground = "Visible In Background"; const string renderingPath = "Rendering Path"; const string colorSpace = "Color Space"; -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) const string gpuSkinning = "GPU Skinning"; #endif -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false // skyboxes are currently broken +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false // skyboxes are currently broken const string singlePassStereoRendering = "Single-Pass Stereo Rendering"; #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) const string stereoscopicRendering = "Stereoscopic Rendering"; #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1) const string virtualRealitySupported = "Virtual Reality Support"; #endif const BuildTarget recommended_BuildTarget = BuildTarget.StandaloneWindows64; @@ -52,16 +52,16 @@ public class SteamVR_Settings : EditorWindow const bool recommended_VisibleInBackground = true; const RenderingPath recommended_RenderPath = RenderingPath.Forward; const ColorSpace recommended_ColorSpace = ColorSpace.Linear; -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) const bool recommended_GpuSkinning = true; #endif -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false const bool recommended_SinglePassStereoRendering = true; #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) const bool recommended_StereoscopicRendering = false; #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1) const bool recommended_VirtualRealitySupported = false; #endif static SteamVR_Settings window; @@ -97,19 +97,19 @@ static void Update() PlayerSettings.renderingPath != recommended_RenderPath) || (!EditorPrefs.HasKey(ignore + colorSpace) && PlayerSettings.colorSpace != recommended_ColorSpace) || -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) (!EditorPrefs.HasKey(ignore + gpuSkinning) && PlayerSettings.gpuSkinning != recommended_GpuSkinning) || #endif -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) && PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) || #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) (!EditorPrefs.HasKey(ignore + stereoscopicRendering) && PlayerSettings.stereoscopic3D != recommended_StereoscopicRendering) || #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1) (!EditorPrefs.HasKey(ignore + virtualRealitySupported) && PlayerSettings.virtualRealitySupported != recommended_VirtualRealitySupported) || #endif @@ -122,7 +122,7 @@ static void Update() //window.title = "SteamVR"; } -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // Switch to native OpenVR support. var updated = false; @@ -475,7 +475,7 @@ public void OnGUI() GUILayout.EndHorizontal(); } -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (!EditorPrefs.HasKey(ignore + gpuSkinning) && PlayerSettings.gpuSkinning != recommended_GpuSkinning) { @@ -500,7 +500,7 @@ public void OnGUI() GUILayout.EndHorizontal(); } #endif -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) && PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) { @@ -525,7 +525,7 @@ public void OnGUI() GUILayout.EndHorizontal(); } #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (!EditorPrefs.HasKey(ignore + stereoscopicRendering) && PlayerSettings.stereoscopic3D != recommended_StereoscopicRendering) { @@ -550,7 +550,7 @@ public void OnGUI() GUILayout.EndHorizontal(); } #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1) if (!EditorPrefs.HasKey(ignore + virtualRealitySupported) && PlayerSettings.virtualRealitySupported != recommended_VirtualRealitySupported) { @@ -592,16 +592,16 @@ public void OnGUI() EditorPrefs.DeleteKey(ignore + visibleInBackground); EditorPrefs.DeleteKey(ignore + renderingPath); EditorPrefs.DeleteKey(ignore + colorSpace); -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) EditorPrefs.DeleteKey(ignore + gpuSkinning); #endif -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false EditorPrefs.DeleteKey(ignore + singlePassStereoRendering); #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) EditorPrefs.DeleteKey(ignore + stereoscopicRendering); #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1) EditorPrefs.DeleteKey(ignore + virtualRealitySupported); #endif } @@ -644,19 +644,19 @@ public void OnGUI() PlayerSettings.renderingPath = recommended_RenderPath; if (!EditorPrefs.HasKey(ignore + colorSpace)) PlayerSettings.colorSpace = recommended_ColorSpace; -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (!EditorPrefs.HasKey(ignore + gpuSkinning)) PlayerSettings.gpuSkinning = recommended_GpuSkinning; #endif -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false if (!EditorPrefs.HasKey(ignore + singlePassStereoRendering)) PlayerSettings.singlePassStereoRendering = recommended_SinglePassStereoRendering; #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (!EditorPrefs.HasKey(ignore + stereoscopicRendering)) PlayerSettings.stereoscopic3D = recommended_StereoscopicRendering; #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1) if (!EditorPrefs.HasKey(ignore + virtualRealitySupported)) PlayerSettings.virtualRealitySupported = recommended_VirtualRealitySupported; #endif @@ -693,19 +693,19 @@ public void OnGUI() EditorPrefs.SetBool(ignore + renderingPath, true); if (PlayerSettings.colorSpace != recommended_ColorSpace) EditorPrefs.SetBool(ignore + colorSpace, true); -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (PlayerSettings.gpuSkinning != recommended_GpuSkinning) EditorPrefs.SetBool(ignore + gpuSkinning, true); #endif -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false if (PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) EditorPrefs.SetBool(ignore + singlePassStereoRendering, true); #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (PlayerSettings.stereoscopic3D != recommended_StereoscopicRendering) EditorPrefs.SetBool(ignore + stereoscopicRendering, true); #endif -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1) if (PlayerSettings.virtualRealitySupported != recommended_VirtualRealitySupported) EditorPrefs.SetBool(ignore + virtualRealitySupported, true); #endif diff --git a/Assets/SteamVR/Scripts/SteamVR.cs b/Assets/SteamVR/Scripts/SteamVR.cs index c246a8c..e218c05 100644 --- a/Assets/SteamVR/Scripts/SteamVR.cs +++ b/Assets/SteamVR/Scripts/SteamVR.cs @@ -56,7 +56,7 @@ public static bool usingNativeSupport { get { -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) return UnityEngine.VR.VRDevice.GetNativePtr() != System.IntPtr.Zero; #else return false; @@ -71,7 +71,7 @@ static SteamVR CreateInstance() var error = EVRInitError.None; if (!SteamVR.usingNativeSupport) { -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) Debug.Log("OpenVR initialization failed. Ensure 'Virtual Reality Supported' is checked in Player Settings, and OpenVR is added to the list of Virtual Reality SDKs."); return null; #else @@ -301,7 +301,7 @@ private SteamVR() textureBounds[1].vMin = 0.5f - 0.5f * r_bottom / tanHalfFov.y; textureBounds[1].vMax = 0.5f - 0.5f * r_top / tanHalfFov.y; -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) SteamVR.Unity.SetSubmitParams(textureBounds[0], textureBounds[1], EVRSubmitFlags.Submit_Default); #endif // Grow the recommended size to account for the overlapping fov @@ -352,7 +352,7 @@ private void Dispose(bool disposing) private static void ShutdownSystems() { -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) OpenVR.Shutdown(); #endif } @@ -364,7 +364,7 @@ public static void SafeDispose() _instance.Dispose(); } -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // Unityhooks in openvr_api. public class Unity { diff --git a/Assets/SteamVR/Scripts/SteamVR_Camera.cs b/Assets/SteamVR/Scripts/SteamVR_Camera.cs index d041257..1dcf5db 100644 --- a/Assets/SteamVR/Scripts/SteamVR_Camera.cs +++ b/Assets/SteamVR/Scripts/SteamVR_Camera.cs @@ -36,7 +36,7 @@ public Ray GetRay() static public Material blitMaterial; -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // Using a single shared offscreen buffer to render the scene. This needs to be larger // than the backbuffer to account for distortion correction. The default resolution // gives us 1:1 sized pixels in the center of view, but quality can be adjusted up or @@ -112,7 +112,7 @@ void OnEnable() enabled = false; return; } -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // Convert camera rig for native OpenVR integration. var t = transform; if (head != t) @@ -223,7 +223,7 @@ public void ForceLast() components = GetComponents(); -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (this != components[components.Length - 1]) { #else @@ -379,7 +379,7 @@ public void Collapse() #endregion -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) #region Render callbacks diff --git a/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs b/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs index e16205d..575dbfe 100644 --- a/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs +++ b/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs @@ -27,7 +27,7 @@ void Awake() mr.material = material; mr.shadowCastingMode = ShadowCastingMode.Off; mr.receiveShadows = false; -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) mr.lightProbeUsage = LightProbeUsage.Off; #else mr.useLightProbes = false; diff --git a/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs b/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs index 48c3ae8..adaf1b1 100644 --- a/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs +++ b/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs @@ -149,7 +149,7 @@ public void AttachToCamera(SteamVR_Camera vrcam) clipRenderer.material = clipMaterial; clipRenderer.shadowCastingMode = ShadowCastingMode.Off; clipRenderer.receiveShadows = false; -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) clipRenderer.lightProbeUsage = LightProbeUsage.Off; #else clipRenderer.useLightProbes = false; diff --git a/Assets/SteamVR/Scripts/SteamVR_GameView.cs b/Assets/SteamVR/Scripts/SteamVR_GameView.cs index b06a945..3b43d6d 100644 --- a/Assets/SteamVR/Scripts/SteamVR_GameView.cs +++ b/Assets/SteamVR/Scripts/SteamVR_GameView.cs @@ -9,7 +9,7 @@ [RequireComponent(typeof(Camera))] public class SteamVR_GameView : MonoBehaviour { -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // DEPRECATED in Unity 5.4+ +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // DEPRECATED in Unity 5.4+ public float scale = 1.5f; public bool drawOverlay = true; diff --git a/Assets/SteamVR/Scripts/SteamVR_Render.cs b/Assets/SteamVR/Scripts/SteamVR_Render.cs index c24cc47..fe6b278 100644 --- a/Assets/SteamVR/Scripts/SteamVR_Render.cs +++ b/Assets/SteamVR/Scripts/SteamVR_Render.cs @@ -16,7 +16,7 @@ public class SteamVR_Render : MonoBehaviour public SteamVR_ExternalCamera externalCamera; public string externalCameraConfigPath = "externalcamera.cfg"; -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) public LayerMask leftMask, rightMask; SteamVR_CameraMask cameraMask; @@ -94,7 +94,7 @@ void AddInternal(SteamVR_Camera vrcam) cameras = sorted; -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) enabled = true; #endif } @@ -142,7 +142,7 @@ static public bool pauseRendering set { _pauseRendering = value; -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) var compositor = OpenVR.Compositor; if (compositor != null) compositor.SuspendRendering(value); @@ -168,7 +168,7 @@ private IEnumerator RenderLoop() trackingSpace = compositor.GetTrackingSpace(); compositor.SetTrackingSpace(trackingSpace); -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (cameras.Length == 0) continue; SteamVR_Utils.QueueEventOnRenderThread(SteamVR.Unity.k_nRenderEventID_WaitGetPoses); // Hack to flush render event that was queued in Update (this ensures WaitGetPoses has returned before we grab the new values). @@ -188,7 +188,7 @@ private IEnumerator RenderLoop() RenderExternalCamera(); -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) var vr = SteamVR.instance; RenderEye(vr, EVREye.Eye_Left); RenderEye(vr, EVREye.Eye_Right); @@ -206,7 +206,7 @@ private IEnumerator RenderLoop() } } -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) void RenderEye(SteamVR vr, EVREye eye) { int i = (int)eye; @@ -321,7 +321,7 @@ void OnDisable() void Awake() { -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) var go = new GameObject("cameraMask"); go.transform.parent = transform; cameraMask = go.AddComponent(); @@ -340,19 +340,19 @@ void Awake() void FixedUpdate() { -#if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if (UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // We want to call this as soon after Present as possible. SteamVR_Utils.QueueEventOnRenderThread(SteamVR.Unity.k_nRenderEventID_PostPresentHandoff); #endif } -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) private SteamVR_UpdatePoses poseUpdater; #endif void Update() { -#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) +#if !(UNITY_5_3_OR_NEWER || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (poseUpdater == null) { var go = new GameObject("poseUpdater"); diff --git a/Assets/SteamVR/Scripts/SteamVR_Utils.cs b/Assets/SteamVR/Scripts/SteamVR_Utils.cs index 7f1d182..b4eaee3 100644 --- a/Assets/SteamVR/Scripts/SteamVR_Utils.cs +++ b/Assets/SteamVR/Scripts/SteamVR_Utils.cs @@ -484,7 +484,7 @@ public static void QueueEventOnRenderThread(int eventID) { #if (UNITY_5_0 || UNITY_5_1) GL.IssuePluginEvent(eventID); -#elif (UNITY_5_2 || UNITY_5_3) +#elif (UNITY_5_2 || UNITY_5_3_OR_NEWER) GL.IssuePluginEvent(SteamVR.Unity.GetRenderEventFunc(), eventID); #endif }