浏览代码

Fixed polarity of disables. Currently updates UI to updated XR enabled

value only in Play mode.
/main
Nerites 6 年前
当前提交
407e6c5d
共有 2 个文件被更改,包括 27 次插入23 次删除
  1. 45
      com.unity.render-pipelines.core/CoreRP/XR/XRGConfig.cs
  2. 5
      com.unity.render-pipelines.lightweight/LWRP/Editor/LightweightPipelineAssetEditor.cs

45
com.unity.render-pipelines.core/CoreRP/XR/XRGConfig.cs


XRSettings.showDeviceView = showDeviceView;
XRSettings.gameViewRenderMode = gameViewRenderMode;
}
public void SetViewportScale(float viewportScale)
{ // If XR is enabled, sets XRSettings from our saved config
if (!Enabled)
return;
XRSettings.renderViewportScale = viewportScale;
}
public float renderScale;
public float viewportScale;

private float k_MaxRenderScale = 4.0f;
internal class Styles
{
public static GUIContent XRSettingsLabel = new GUIContent("XR Settings");
public static GUIContent XRSettingsLabel = new GUIContent("XR Config", "Enable XR in Player Settings. Then SetConfig can be used to set this configuration to XRSettings.");
public static GUIContent XREnabledLabel = new GUIContent("Enable XR", "Enables stereo rendering");
public static GUIContent renderScaleLabel = new GUIContent("Render Scale", "Scales (and reallocates) the camera render target allowing the game to render at a resolution different than native resolution. UI is always rendered at native resolution.");
public static GUIContent viewportScaleLabel = new GUIContent("Viewport Scale", "Scales the section of the render target being rendered. Use for dynamic resolution adjustments.");

// Draw the property inside the given rect
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (XRGConfig.Enabled)
{
var m_RenderScale = property.FindPropertyRelative("renderScale");
var m_ViewportScale = property.FindPropertyRelative("viewportScale");
var m_ShowDeviceView = property.FindPropertyRelative("showDeviceView");
var m_GameViewRenderMode = property.FindPropertyRelative("gameViewRenderMode");
var m_UseOcclusionMesh = property.FindPropertyRelative("useOcclusionMesh");
var m_OcclusionMaskScale = property.FindPropertyRelative("occlusionMaskScale");
var m_RenderScale = property.FindPropertyRelative("renderScale");
var m_ViewportScale = property.FindPropertyRelative("viewportScale");
var m_ShowDeviceView = property.FindPropertyRelative("showDeviceView");
var m_GameViewRenderMode = property.FindPropertyRelative("gameViewRenderMode");
var m_UseOcclusionMesh = property.FindPropertyRelative("useOcclusionMesh");
var m_OcclusionMaskScale = property.FindPropertyRelative("occlusionMaskScale");
EditorGUILayout.LabelField(Styles.XRSettingsLabel, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
m_RenderScale.floatValue = EditorGUILayout.Slider(Styles.renderScaleLabel, m_RenderScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
m_ViewportScale.floatValue = EditorGUILayout.Slider(Styles.viewportScaleLabel, m_ViewportScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
EditorGUILayout.PropertyField(m_UseOcclusionMesh, Styles.useOcclusionMeshLabel);
EditorGUILayout.PropertyField(m_OcclusionMaskScale, Styles.occlusionScaleLabel);
EditorGUILayout.PropertyField(m_ShowDeviceView, Styles.showDeviceViewLabel);
EditorGUILayout.PropertyField(m_GameViewRenderMode, Styles.gameViewRenderModeLabel);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
EditorGUI.BeginDisabledGroup(!XRGConfig.Enabled);
EditorGUILayout.LabelField(Styles.XRSettingsLabel, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
m_RenderScale.floatValue = EditorGUILayout.Slider(Styles.renderScaleLabel, m_RenderScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
m_ViewportScale.floatValue = EditorGUILayout.Slider(Styles.viewportScaleLabel, m_ViewportScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
EditorGUILayout.PropertyField(m_UseOcclusionMesh, Styles.useOcclusionMeshLabel);
EditorGUILayout.PropertyField(m_OcclusionMaskScale, Styles.occlusionScaleLabel);
EditorGUILayout.PropertyField(m_ShowDeviceView, Styles.showDeviceViewLabel);
EditorGUILayout.PropertyField(m_GameViewRenderMode, Styles.gameViewRenderModeLabel);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUI.EndDisabledGroup();
}
}
}

5
com.unity.render-pipelines.lightweight/LWRP/Editor/LightweightPipelineAssetEditor.cs


public static GUIContent localShadowLabel = new GUIContent("Local Shadows");
public static GUIContent capabilitiesLabel = new GUIContent("Capabilities");
public static GUIContent renderScaleLabel = new GUIContent("Target Scale", "Scales the camera render target allowing the game to render at a resolution different than native resolution. UI is always rendered at native resolution. When in VR mode, uses value set in XRGraphicsConfig instead.");
public static GUIContent renderScaleLabel = new GUIContent("Render Scale", "Scales the camera render target allowing the game to render at a resolution different than native resolution. UI is always rendered at native resolution. When in VR mode, uses value set in XRGraphicsConfig instead.");
public static GUIContent maxPixelLightsLabel = new GUIContent("Pixel Lights",
"Controls the amount of pixel lights that run in fragment light loop. Lights are sorted and culled per-object.");

AnimBool m_ShowSoftParticles = new AnimBool();
AnimBool m_ShowOpaqueTextureScale = new AnimBool();
AnimBool m_ShowXREnabled = new AnimBool();
int k_MaxSupportedPixelLights = 8;
float k_MinRenderScale = 0.1f;

{
EditorGUILayout.LabelField(Styles.generalSettingsLabel, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUI.BeginDisabledGroup(!XRGConfig.Enabled);
EditorGUI.BeginDisabledGroup(XRGConfig.Enabled);
m_RenderScale.floatValue = EditorGUILayout.Slider(Styles.renderScaleLabel, m_RenderScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
EditorGUI.EndDisabledGroup();
m_MaxPixelLights.intValue = EditorGUILayout.IntSlider(Styles.maxPixelLightsLabel, m_MaxPixelLights.intValue, 0, k_MaxSupportedPixelLights);

正在加载...
取消
保存