Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions Assets/SteamVR/Editor/SteamVR_Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand All @@ -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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions Assets/SteamVR/Scripts/SteamVR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
{
Expand Down
8 changes: 4 additions & 4 deletions Assets/SteamVR/Scripts/SteamVR_Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -223,7 +223,7 @@ public void ForceLast()

components = GetComponents<Component>();

#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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Assets/SteamVR/Scripts/SteamVR_CameraMask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Assets/SteamVR/Scripts/SteamVR_GameView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
20 changes: 10 additions & 10 deletions Assets/SteamVR/Scripts/SteamVR_Render.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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);
Expand All @@ -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).
Expand All @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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<SteamVR_CameraMask>();
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion Assets/SteamVR/Scripts/SteamVR_Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down