//this method shouldn't be called `OnPreRender` to prevent a name clash with `MonoBehaviour.OnPreRender` since that is used when this script is attached to a camera protected virtual void OnCamPreRender(Camera cam) { if (cam.gameObject.transform == VRTK_SDK_Bridge.GetHeadsetCamera()) { Follow(); } }
// Token: 0x06001B8C RID: 7052 RVA: 0x0008FF43 File Offset: 0x0008E143 private void OnCameraPreCull(Camera camera) { if (camera.transform != VRTK_SDK_Bridge.GetHeadsetCamera()) { return; } this.UpdateMSAALevel(); }
private void OnCameraPreCull(Camera camera) { if (camera.transform != VRTK_SDK_Bridge.GetHeadsetCamera()) { return; } #if !(UNITY_5_4_1 || UNITY_5_4_2 || UNITY_5_4_3 || UNITY_5_5_OR_NEWER) UpdateRenderScale(); #endif UpdateMSAALevel(); }
/// <summary> /// The HeadsetCamera method is used to retrieve the transform for the VR Camera in the scene. /// </summary> /// <returns>The transform of the VR Camera component.</returns> public static Transform HeadsetCamera() { return(VRTK_SDK_Bridge.GetHeadsetCamera()); }
public override void OnInspectorGUI() { serializedObject.Update(); var adaptiveQuality = (VRTK_AdaptiveQuality)target; if (VRTK_SDK_Bridge.GetHeadsetCamera() == null) { EditorGUILayout.HelpBox(NoSteamVR_CameraFoundHelpBoxText, MessageType.Error); return; } EditorGUILayout.HelpBox(DontDisableHelpBoxText, adaptiveQuality.enabled ? MessageType.Warning : MessageType.Error); EditorGUILayout.Space(); EditorGUILayout.PropertyField(serializedObject.FindProperty("active")); EditorGUILayout.PropertyField(serializedObject.FindProperty("drawDebugVisualization")); EditorGUILayout.PropertyField(serializedObject.FindProperty("respondsToKeyboardShortcuts")); EditorGUILayout.PropertyField(serializedObject.FindProperty("respondsToCommandLineArguments")); EditorGUILayout.PropertyField(serializedObject.FindProperty("msaaLevel")); float minimumRenderScale = adaptiveQuality.minimumRenderScale; float maximumRenderScale = adaptiveQuality.maximumRenderScale; AddHeader(adaptiveQuality, "minimumRenderScale"); EditorGUILayout.BeginHorizontal(); { var fieldInfo = adaptiveQuality.GetType().GetField("minimumRenderScale"); var rangeAttribute = (RangeAttribute)Attribute.GetCustomAttribute(fieldInfo, typeof(RangeAttribute)); EditorGUI.BeginChangeCheck(); { float maxFloatWidth = GUI.skin.textField.CalcSize(new GUIContent(1.23f.ToString(CultureInfo.InvariantCulture))).x; minimumRenderScale = EditorGUILayout.FloatField(minimumRenderScale, GUILayout.MaxWidth(maxFloatWidth)); EditorGUILayout.MinMaxSlider( ref minimumRenderScale, ref maximumRenderScale, rangeAttribute.min, rangeAttribute.max); maximumRenderScale = EditorGUILayout.FloatField(maximumRenderScale, GUILayout.MaxWidth(maxFloatWidth)); } if (EditorGUI.EndChangeCheck()) { serializedObject.FindProperty("minimumRenderScale").floatValue = Mathf.Clamp((float)Math.Round(minimumRenderScale, 2), rangeAttribute.min, rangeAttribute.max); serializedObject.FindProperty("maximumRenderScale").floatValue = Mathf.Clamp((float)Math.Round(maximumRenderScale, 2), rangeAttribute.min, rangeAttribute.max); } } EditorGUILayout.EndHorizontal(); if (maximumRenderScale > adaptiveQuality.BiggestAllowedMaximumRenderScale()) { EditorGUILayout.HelpBox(MaximumRenderScaleTooBigHelpBoxText, MessageType.Error); } EditorGUILayout.PropertyField(serializedObject.FindProperty("maximumRenderTargetDimension")); EditorGUILayout.PropertyField(serializedObject.FindProperty("renderScaleFillRateStepSizeInPercent")); int maxRenderScaleLevel = Mathf.Max(adaptiveQuality.renderScales.Count - 1, 0); bool disabled = maxRenderScaleLevel == 0 || !Application.isPlaying; EditorGUI.BeginDisabledGroup(disabled); { AddHeader(adaptiveQuality, "overrideRenderScale"); if (disabled) { EditorGUI.EndDisabledGroup(); { EditorGUILayout.HelpBox(NoRenderScaleLevelsYetHelpBoxText, MessageType.Info); } EditorGUI.BeginDisabledGroup(true); } adaptiveQuality.overrideRenderScale = EditorGUILayout.Toggle( VRTK_EditorUtilities.BuildGUIContent <VRTK_AdaptiveQuality>("overrideRenderScale"), adaptiveQuality.overrideRenderScale); EditorGUI.BeginDisabledGroup(!adaptiveQuality.overrideRenderScale); { adaptiveQuality.overrideRenderScaleLevel = EditorGUILayout.IntSlider( VRTK_EditorUtilities.BuildGUIContent <VRTK_AdaptiveQuality>("overrideRenderScaleLevel"), adaptiveQuality.overrideRenderScaleLevel, 0, maxRenderScaleLevel); } EditorGUI.EndDisabledGroup(); } EditorGUI.EndDisabledGroup(); serializedObject.ApplyModifiedProperties(); }