-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
com.unity.render-pipelines.core@5.0.0-preview
## [5.0.0-preview] - 2018-09-28 ### Changed - XRGraphicConfig has been changed from a read-write control of XRSettings to XRGraphics, a read-only accessor to XRSettings. This improves consistency of XR behavior between the legacy render pipeline and SRP. - XRGraphics members have been renamed to match XRSettings, and XRGraphics has been modified to only contain accessors potentially useful to SRP - You can now have up to 16 additional shadow-casting lights. ### Fixed - LWRP no longer executes shadow passes when there are no visible shadow casters in a Scene. Previously, this made the Scene render as too dark, overall.
- Loading branch information
Unity Technologies
committed
Sep 27, 2018
1 parent
6a72128
commit bfa51d6
Showing
29 changed files
with
640 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
using System; | ||
using UnityEditor; | ||
#if UNITY_2017_2_OR_NEWER | ||
using UnityEngine.XR; | ||
using XRSettings = UnityEngine.XR.XRSettings; | ||
#elif UNITY_5_6_OR_NEWER | ||
using UnityEngine.VR; | ||
using XRSettings = UnityEngine.VR.VRSettings; | ||
#endif | ||
|
||
namespace UnityEngine.Experimental.Rendering | ||
{ | ||
[Serializable] | ||
public class XRGraphics | ||
{ // XRGraphics insulates SRP from API changes across platforms, Editor versions, and as XR transitions into XR SDK | ||
|
||
public enum StereoRenderingMode | ||
{ | ||
MultiPass = 0, | ||
SinglePass, | ||
SinglePassInstanced, | ||
SinglePassMultiView | ||
}; | ||
|
||
public static float eyeTextureResolutionScale | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
return 1.0f; | ||
else | ||
return XRSettings.eyeTextureResolutionScale; | ||
} | ||
} | ||
|
||
public static float renderViewportScale | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
return 1.0f; | ||
else | ||
return XRSettings.renderViewportScale; | ||
} | ||
} | ||
|
||
#if UNITY_EDITOR | ||
public static bool tryEnable | ||
{ // TryEnable gets updated before "play" is pressed- we use this for updating GUI only. | ||
get { return PlayerSettings.virtualRealitySupported; } | ||
} | ||
#endif | ||
|
||
public static bool enabled | ||
{ // SRP should use this to safely determine whether XR is enabled at runtime. | ||
get | ||
{ | ||
#if ENABLE_VR | ||
return XRSettings.enabled; | ||
#else | ||
return false; | ||
#endif | ||
} | ||
} | ||
|
||
public static bool isDeviceActive | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
return false; | ||
return XRSettings.isDeviceActive; | ||
} | ||
} | ||
|
||
public static string loadedDeviceName | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
return "No XR device loaded"; | ||
return XRSettings.loadedDeviceName; | ||
} | ||
} | ||
|
||
public static string[] supportedDevices | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
return new string[1]; | ||
return XRSettings.supportedDevices; | ||
} | ||
} | ||
|
||
public static StereoRenderingMode stereoRenderingMode | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
return StereoRenderingMode.SinglePass; | ||
#if UNITY_2018_3_OR_NEWER | ||
return (StereoRenderingMode)XRSettings.stereoRenderingMode; | ||
#else // Reverse engineer it | ||
if (!enabled) | ||
return StereoRenderingMode.SinglePassMultiView; | ||
if (eyeTextureDesc.vrUsage == VRTextureUsage.TwoEyes) | ||
{ | ||
if (eyeTextureDesc.dimension == UnityEngine.Rendering.TextureDimension.Tex2DArray) | ||
return StereoRenderingMode.SinglePassInstanced; | ||
return StereoRenderingMode.SinglePassDoubleWide; | ||
} | ||
else | ||
return StereoRenderingMode.MultiPass; | ||
#endif | ||
} | ||
} | ||
public static uint GetPixelOffset(uint eye) | ||
{ | ||
if (!enabled || stereoRenderingMode != StereoRenderingMode.SinglePass) | ||
return 0; | ||
return (uint)(Mathf.CeilToInt((eye * XRSettings.eyeTextureWidth) / 2)); | ||
} | ||
|
||
public static RenderTextureDescriptor eyeTextureDesc | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
{ | ||
return new RenderTextureDescriptor(0, 0); | ||
} | ||
|
||
return XRSettings.eyeTextureDesc; | ||
} | ||
} | ||
|
||
public static int eyeTextureWidth | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
{ | ||
return 0; | ||
} | ||
|
||
return XRSettings.eyeTextureWidth; | ||
} | ||
} | ||
public static int eyeTextureHeight | ||
{ | ||
get | ||
{ | ||
if (!enabled) | ||
{ | ||
return 0; | ||
} | ||
|
||
return XRSettings.eyeTextureHeight; | ||
} | ||
} | ||
|
||
} | ||
} |
File renamed without changes.
Oops, something went wrong.