static void Drawer_FieldClippingPlanes(HDCameraUI s, SerializedHDCamera p, Editor owner) { _.DrawMultipleFields( "Clipping Planes", new[] { p.nearClippingPlane, p.farClippingPlane }, new[] { _.GetContent("Near|The closest point relative to the camera that drawing will occur."), _.GetContent("Far|The furthest point relative to the camera that drawing will occur.\n") }); }
static void Drawer_Projection(HDCameraUI s, SerializedHDCamera p, Editor owner) { ProjectionType projectionType = p.orthographic.boolValue ? ProjectionType.Orthographic : ProjectionType.Perspective; EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = p.orthographic.hasMultipleDifferentValues; projectionType = (ProjectionType)EditorGUILayout.EnumPopup(_.GetContent("Projection|How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective."), projectionType); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { p.orthographic.boolValue = (projectionType == ProjectionType.Orthographic); } if (!p.orthographic.hasMultipleDifferentValues) { if (projectionType == ProjectionType.Orthographic) { EditorGUILayout.PropertyField(p.orthographicSize, _.GetContent("Size")); } else { EditorGUILayout.Slider(p.fieldOfView, 1f, 179f, _.GetContent("Field of View|The width of the Camera’s view angle, measured in degrees along the local Y axis.")); } } }
static void Drawer_CameraWarnings(HDCameraUI s, SerializedHDCamera p, Editor owner) { foreach (Camera camera in p.serializedObject.targetObjects) { var warnings = GetCameraBufferWarnings(camera); if (warnings.Length > 0) { EditorGUILayout.HelpBox(string.Join("\n\n", warnings), MessageType.Warning, true); } } }
static void Drawer_SectionMultiDisplay(HDCameraUI s, SerializedHDCamera p, Editor owner) { if (ModuleManager_ShouldShowMultiDisplayOption()) { var prevDisplay = p.targetDisplay.intValue; EditorGUILayout.IntPopup(p.targetDisplay, DisplayUtility_GetDisplayNames(), DisplayUtility_GetDisplayIndices(), _.GetContent("Target Display")); if (prevDisplay != p.targetDisplay.intValue) { UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); } } }
static void Drawer_FieldClippingPlanes(HDCameraUI s, SerializedHDCamera p, Editor owner) { GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(_.GetContent("Clipping Planes")); GUILayout.BeginVertical(); var labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 45; EditorGUILayout.PropertyField(p.nearClippingPlane, _.GetContent("Near|The closest point relative to the camera that drawing will occur.")); EditorGUILayout.PropertyField(p.farClippingPlane, _.GetContent("Far|The furthest point relative to the camera that drawing will occur.\n")); GUILayout.EndVertical(); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = labelWidth; }
static void Drawer_FieldRenderTarget(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.targetTexture); // show warning if we have deferred but manual MSAA set // only do this if the m_TargetTexture has the same values across all target cameras if (!p.targetTexture.hasMultipleDifferentValues) { var targetTexture = p.targetTexture.objectReferenceValue as RenderTexture; if (targetTexture && targetTexture.antiAliasing > 1 && !p.frameSettings.enableForwardRenderingOnly.boolValue) { EditorGUILayout.HelpBox("Manual MSAA target set with deferred rendering. This will lead to undefined behavior.", MessageType.Warning, true); } } }
static void Drawer_FieldVR(HDCameraUI s, SerializedHDCamera p, Editor owner) { if (s.canOverrideRenderLoopSettings) { EditorGUILayout.PropertyField(p.frameSettings.enableStereo, _.GetContent("Enable Stereo")); } else { var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset; Assert.IsNotNull(hdrp, "This Editor is valid only for HDRP"); var enableStereo = hdrp.GetFrameSettings().enableStereo; GUI.enabled = false; EditorGUILayout.Toggle(_.GetContent("Enable Stereo (Set by HDRP)"), enableStereo); GUI.enabled = true; } EditorGUILayout.PropertyField(p.stereoSeparation, _.GetContent("Stereo Separation")); EditorGUILayout.PropertyField(p.stereoConvergence, _.GetContent("Stereo Convergence")); }
static void Drawer_FieldTargetEye(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.IntPopup(p.targetEye, k_TargetEyes, k_TargetEyeValues, _.GetContent("Target Eye")); }
static void Drawer_FieldAperture(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.aperture, _.GetContent("Aperture")); }
static void Drawer_FieldShutterSpeed(HDCameraUI s, SerializedHDCamera p, Editor owner) { p.shutterSpeed.floatValue = 1f / p.shutterSpeed.floatValue; EditorGUILayout.PropertyField(p.shutterSpeed, _.GetContent("Shutter Speed (1 / x)")); p.shutterSpeed.floatValue = 1f / p.shutterSpeed.floatValue; }
static void Drawer_FieldOcclusionCulling(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.occlusionCulling, _.GetContent("Occlusion Culling")); }
static void Drawer_FieldRenderingPath(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.renderingPath, _.GetContent("Rendering Path")); }
static void Drawer_FieldNormalizedViewPort(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.normalizedViewPortRect, _.GetContent("Viewport Rect|Four values that indicate where on the screen this camera view will be drawn. Measured in Viewport Coordinates (values 0–1).")); }
static void Drawer_FieldDepth(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.depth, _.GetContent("Depth")); }
static void Drawer_FieldBackgroundColorHDR(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.backgroundColorHDR, _.GetContent("Background Color|The BackgroundColor used to clear the screen when selecting BackgrounColor before rendering.")); }
static void Drawer_FieldIso(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.iso, _.GetContent("ISO")); }
static void Drawer_FieldCullingMask(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.cullingMask, _.GetContent("Culling Mask")); }
static void Drawer_FieldVolumeLayerMask(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.volumeLayerMask, _.GetContent("Volume Layer Mask")); }
static void Drawer_FieldBackgroundColor(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.backgroundColor, _.GetContent("Background Color|The Camera clears the screen to this color before rendering.")); }
static void Drawer_FieldClearDepth(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.clearDepth, _.GetContent("ClearDepth|The Camera clears the depth buffer before rendering.")); }
static void Drawer_FieldClearColorMode(HDCameraUI s, SerializedHDCamera p, Editor owner) { EditorGUILayout.PropertyField(p.clearColorMode, _.GetContent("Clear Mode|The Camera clears the screen to selected mode.")); }