private void Draw(EditorWindow caller, float listElementWidth)
        {
            Rect rect = new Rect(0.0f, 0.0f, listElementWidth, 16f);

            this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sShadedHeader);
            for (int index = 0; index < SceneRenderModeWindow.sRenderModeCount; ++index)
            {
                DrawCameraMode drawCameraMode = (DrawCameraMode)index;
                switch (drawCameraMode)
                {
                case DrawCameraMode.ShadowCascades:
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sMiscellaneous);
                    break;

                case DrawCameraMode.DeferredDiffuse:
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sDeferredHeader);
                    break;

                case DrawCameraMode.Charting:
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sGlobalIlluminationHeader);
                    break;
                }
                EditorGUI.BeginDisabledGroup(this.IsModeDisabled(drawCameraMode));
                this.DoOneMode(caller, ref rect, drawCameraMode);
                EditorGUI.EndDisabledGroup();
            }
            bool disabled = this.m_SceneView.renderMode < DrawCameraMode.Charting || this.IsModeDisabled(this.m_SceneView.renderMode);

            this.DoResolutionToggle(rect, disabled);
        }
예제 #2
0
        private void Draw(EditorWindow caller, float listElementWidth)
        {
            Rect rect = new Rect(0f, 0f, listElementWidth, 16f);

            this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sShadedHeader);
            for (int i = 0; i < SceneRenderModeWindow.sRenderModeCount; i++)
            {
                DrawCameraMode drawCameraMode = SceneRenderModeWindow.Styles.sRenderModeUIOrder[i];
                switch (drawCameraMode)
                {
                case DrawCameraMode.Systems:
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sGlobalIlluminationHeader);
                    goto IL_10D;

                case DrawCameraMode.RealtimeAlbedo:
                case DrawCameraMode.RealtimeEmissive:
                case DrawCameraMode.RealtimeDirectionality:
IL_56:
                    if (drawCameraMode == DrawCameraMode.ShadowCascades)
                    {
                        this.DrawSeparator(ref rect);
                        this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sMiscellaneous);
                        goto IL_10D;
                    }
                    if (drawCameraMode == DrawCameraMode.DeferredDiffuse)
                    {
                        this.DrawSeparator(ref rect);
                        this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sDeferredHeader);
                        goto IL_10D;
                    }
                    if (drawCameraMode != DrawCameraMode.ValidateAlbedo)
                    {
                        goto IL_10D;
                    }
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sMaterialValidationHeader);
                    goto IL_10D;

                case DrawCameraMode.RealtimeIndirect:
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sRealtimeGIHeader);
                    goto IL_10D;

                case DrawCameraMode.BakedLightmap:
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sBakedGIHeader);
                    goto IL_10D;
                }
                goto IL_56;
IL_10D:
                using (new EditorGUI.DisabledScope(this.IsModeDisabled(drawCameraMode)))
                {
                    this.DoOneMode(caller, ref rect, drawCameraMode);
                }
            }
            bool disabled = this.m_SceneView.renderMode < DrawCameraMode.RealtimeCharting || this.IsModeDisabled(this.m_SceneView.renderMode);

            this.DoResolutionToggle(rect, disabled);
        }
 internal static SceneView.CameraMode GetBuiltinCameraMode(DrawCameraMode drawMode)
 {
     if (drawMode == DrawCameraMode.Normal)
     {
         drawMode = DrawCameraMode.Textured;
     }
     return(Styles.sBuiltinCameraModes.Single(mode => mode.drawMode == drawMode));
 }
 public static GUIContent GetGUIContent(DrawCameraMode drawCameraMode)
 {
     if (drawCameraMode == DrawCameraMode.UserDefined)
     {
         return(GUIContent.none);
     }
     return(EditorGUIUtility.TextContent(Styles.sBuiltinCameraModes.Single(mode => mode.drawMode == drawCameraMode).name));
 }
 static ShadowCascadeSplitGUI()
 {
     GUIStyle style = new GUIStyle(EditorStyles.whiteMiniLabel) {
         alignment = TextAnchor.MiddleCenter
     };
     s_TextCenteredStyle = style;
     s_CascadeSliderId = "s_CascadeSliderId".GetHashCode();
     s_OldSceneDrawMode = DrawCameraMode.Textured;
 }
        public void SetupPreview()
        {
            previewIsSetUp = true;

            // Create preview camera
            GameObject camObj = new GameObject("Shader Forge Camera");

            camObj.hideFlags = HideFlags.HideAndDontSave;
            cam = camObj.AddComponent <Camera>();
            cam.targetTexture       = render;
            cam.clearFlags          = CameraClearFlags.SolidColor;
            cam.renderingPath       = RenderingPath.Forward;
            cam.enabled             = false;
            cam.useOcclusionCulling = false;
            cam.cameraType          = CameraType.Preview;
            cam.fieldOfView         = targetFOV;
            DrawCameraMode cam_mode = DrawCameraMode.Normal;

            // Make sure it only renders using DrawMesh, to make ignore the scene. This is a bit risky, due to using reflection :(
            BindingFlags bfs = BindingFlags.Static | BindingFlags.NonPublic;

            Type[] args = new Type[]
            {
                typeof(Camera),
                typeof(DrawCameraMode)
            };

            //mSetCameraOnlyDrawMesh = typeof( Handles ).GetMethod("Internal_DrawCamera", bfs, null, args, null ); //Internal_DoDrawGizmos Internal_DrawCamera
            //mSetCameraOnlyDrawMesh.Invoke( null, new object[]{ cam, cam_mode } );

            // Create pivot/transform to hold it
            camPivot = new GameObject("Shader Forge Camera Pivot").transform;
            camPivot.gameObject.hideFlags = HideFlags.HideAndDontSave;
            cam.clearFlags       = CameraClearFlags.Skybox;
            cam.transform.parent = camPivot;

            // Create custom light sources
            lights = new Light[] {
                new GameObject("Light 0").AddComponent <Light>(),
                new GameObject("Light 1").AddComponent <Light>()
            };
            for (int i = 0; i < lights.Length; i++)
            {
                lights[i].gameObject.hideFlags = HideFlags.HideAndDontSave;
                lights[i].type             = LightType.Directional;
                lights[i].lightmapBakeType = LightmapBakeType.Realtime;
                lights[i].enabled          = false;
            }

            lights[0].intensity          = 1f;
            lights[0].transform.rotation = Quaternion.Euler(30f, 30f, 0f);
            lights[1].intensity          = 0.75f;
            lights[1].color = new Color(1f, 0.5f, 0.25f);
            lights[1].transform.rotation = Quaternion.Euler(340f, 218f, 177f);
        }
예제 #7
0
        static ShadowCascadeSplitGUI()
        {
            GUIStyle style = new GUIStyle(EditorStyles.whiteMiniLabel)
            {
                alignment = TextAnchor.MiddleCenter
            };

            s_TextCenteredStyle = style;
            s_CascadeSliderId   = "s_CascadeSliderId".GetHashCode();
            s_OldSceneDrawMode  = DrawCameraMode.Textured;
        }
        internal static bool DrawCameraModeExists(DrawCameraMode drawMode)
        {
            foreach (var mode in Styles.sBuiltinCameraModes)
            {
                if (mode.drawMode == drawMode)
                {
                    return(true);
                }
            }

            return(false);
        }
 private bool IsModeDisabled(DrawCameraMode mode)
 {
     if (!this.m_EnableBakedGI.boolValue && mode == DrawCameraMode.Baked)
     {
         return(true);
     }
     if (!this.m_EnableRealtimeGI.boolValue && !this.m_EnableBakedGI.boolValue)
     {
         return(mode >= DrawCameraMode.Charting);
     }
     return(false);
 }
예제 #10
0
 private void DoOneMode(EditorWindow caller, ref Rect rect, DrawCameraMode drawCameraMode)
 {
     EditorGUI.BeginDisabledGroup(!this.m_SceneView.CheckDrawModeForRenderingPath(drawCameraMode));
     EditorGUI.BeginChangeCheck();
     GUI.Toggle(rect, this.m_SceneView.renderMode == drawCameraMode, GetGUIContent(drawCameraMode), Styles.sMenuItem);
     if (EditorGUI.EndChangeCheck())
     {
         this.m_SceneView.renderMode = drawCameraMode;
         this.m_SceneView.Repaint();
         GUIUtility.ExitGUI();
     }
     rect.y += 16f;
     EditorGUI.EndDisabledGroup();
 }
예제 #11
0
        public static GUIContent GetGUIContent(DrawCameraMode drawCameraMode)
        {
            GUIContent result;

            if (drawCameraMode == DrawCameraMode.UserDefined)
            {
                result = GUIContent.none;
            }
            else
            {
                result = EditorGUIUtility.TextContent(SceneRenderModeWindow.Styles.sBuiltinCameraModes.Single((SceneView.CameraMode mode) => mode.drawMode == drawCameraMode).name);
            }
            return(result);
        }
예제 #12
0
 private void DoOneMode(EditorWindow caller, ref Rect rect, DrawCameraMode drawCameraMode)
 {
     EditorGUI.BeginDisabledGroup(!this.m_SceneView.CheckDrawModeForRenderingPath(drawCameraMode));
     EditorGUI.BeginChangeCheck();
     GUI.Toggle(rect, this.m_SceneView.renderMode == drawCameraMode, GetGUIContent(drawCameraMode), Styles.sMenuItem);
     if (EditorGUI.EndChangeCheck())
     {
         this.m_SceneView.renderMode = drawCameraMode;
         this.m_SceneView.Repaint();
         GUIUtility.ExitGUI();
     }
     rect.y += 16f;
     EditorGUI.EndDisabledGroup();
 }
예제 #13
0
        public static void Focus(Object target, DrawCameraMode mode = DrawCameraMode.Wireframe, bool autoSelect = true)
        {
            EditorWindow.GetWindow <SceneView>("", typeof(SceneView));

            if (autoSelect)
            {
                Selection.activeObject = target;
            }

            if (SceneView.lastActiveSceneView != null)
            {
                SceneView.lastActiveSceneView.FrameSelected();
            }
        }
예제 #14
0
        private void Draw(EditorWindow caller, float listElementWidth)
        {
            Rect rect = new Rect(0f, 0f, listElementWidth, 16f);

            this.DrawHeader(ref rect, Styles.sShadedHeader);
            for (int i = 0; i < sRenderModeCount; i++)
            {
                DrawCameraMode mode  = (DrawCameraMode)i;
                DrawCameraMode mode2 = mode;
                if (mode2 != DrawCameraMode.ShadowCascades)
                {
                    if (mode2 == DrawCameraMode.DeferredDiffuse)
                    {
                        goto Label_0068;
                    }
                    if (mode2 == DrawCameraMode.Charting)
                    {
                        goto Label_0082;
                    }
                }
                else
                {
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, Styles.sMiscellaneous);
                }
                goto Label_009C;
Label_0068:
                this.DrawSeparator(ref rect);
                this.DrawHeader(ref rect, Styles.sDeferredHeader);
                goto Label_009C;
Label_0082:
                this.DrawSeparator(ref rect);
                this.DrawHeader(ref rect, Styles.sGlobalIlluminationHeader);
Label_009C:
                EditorGUI.BeginDisabledGroup(this.IsModeDisabled(mode));
                this.DoOneMode(caller, ref rect, mode);
                EditorGUI.EndDisabledGroup();
            }
            bool disabled = (this.m_SceneView.renderMode < DrawCameraMode.Charting) || this.IsModeDisabled(this.m_SceneView.renderMode);

            this.DoResolutionToggle(rect, disabled);
        }
예제 #15
0
        private void Draw(EditorWindow caller, float listElementWidth)
        {
            Rect rect = new Rect(0f, 0f, listElementWidth, 16f);

            this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sShadedHeader);
            for (int i = 0; i < SceneRenderModeWindow.sRenderModeCount; i++)
            {
                DrawCameraMode drawCameraMode  = (DrawCameraMode)i;
                DrawCameraMode drawCameraMode2 = drawCameraMode;
                if (drawCameraMode2 != DrawCameraMode.ShadowCascades)
                {
                    if (drawCameraMode2 != DrawCameraMode.DeferredDiffuse)
                    {
                        if (drawCameraMode2 == DrawCameraMode.Charting)
                        {
                            this.DrawSeparator(ref rect);
                            this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sGlobalIlluminationHeader);
                        }
                    }
                    else
                    {
                        this.DrawSeparator(ref rect);
                        this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sDeferredHeader);
                    }
                }
                else
                {
                    this.DrawSeparator(ref rect);
                    this.DrawHeader(ref rect, SceneRenderModeWindow.Styles.sMiscellaneous);
                }
                using (new EditorGUI.DisabledScope(this.IsModeDisabled(drawCameraMode)))
                {
                    this.DoOneMode(caller, ref rect, drawCameraMode);
                }
            }
            bool disabled = this.m_SceneView.renderMode < DrawCameraMode.Charting || this.IsModeDisabled(this.m_SceneView.renderMode);

            this.DoResolutionToggle(rect, disabled);
        }
 bool IsModeEnabled(DrawCameraMode mode)
 {
     return(m_SceneView.IsCameraDrawModeEnabled(GetBuiltinCameraMode(mode)));
 }
예제 #17
0
 internal static void DrawCameraImpl(Rect position, Camera camera, DrawCameraMode drawMode, bool drawGrid, DrawGridParameters gridParam, bool finish)
 {
   if (Event.current.type == EventType.Repaint)
   {
     if ((UnityEngine.Object) camera.targetTexture == (UnityEngine.Object) null)
     {
       Rect pixels = EditorGUIUtility.PointsToPixels(GUIClip.Unclip(position));
       camera.pixelRect = new Rect(pixels.xMin, (float) Screen.height - pixels.yMax, pixels.width, pixels.height);
     }
     else
       camera.rect = new Rect(0.0f, 0.0f, 1f, 1f);
     if (drawMode == DrawCameraMode.Normal)
     {
       RenderTexture targetTexture = camera.targetTexture;
       camera.targetTexture = RenderTexture.active;
       camera.Render();
       camera.targetTexture = targetTexture;
     }
     else
     {
       if (drawGrid)
         Handles.Internal_DrawCameraWithGrid(camera, (int) drawMode, ref gridParam);
       else
         Handles.Internal_DrawCamera(camera, (int) drawMode);
       if (!finish)
         return;
       Handles.Internal_FinishDrawingCamera(camera);
     }
   }
   else
     Handles.Internal_SetCurrentCamera(camera);
 }
예제 #18
0
 internal static bool DoesCameraDrawModeSupportDeferred(DrawCameraMode mode)
 {
   if (mode != DrawCameraMode.Normal && mode != DrawCameraMode.Textured && (mode != DrawCameraMode.ShadowCascades && mode != DrawCameraMode.RenderPaths) && (mode != DrawCameraMode.AlphaChannel && mode != DrawCameraMode.DeferredDiffuse && (mode != DrawCameraMode.DeferredSpecular && mode != DrawCameraMode.DeferredSmoothness)) && (mode != DrawCameraMode.DeferredNormal && mode != DrawCameraMode.Charting && (mode != DrawCameraMode.Systems && mode != DrawCameraMode.Albedo) && (mode != DrawCameraMode.Emissive && mode != DrawCameraMode.Irradiance && (mode != DrawCameraMode.Directionality && mode != DrawCameraMode.Baked))) && mode != DrawCameraMode.Clustering)
     return mode == DrawCameraMode.LitClustering;
   return true;
 }
예제 #19
0
 static extern void Internal_DrawCameraWithGrid(Camera cam, DrawCameraMode renderMode, ref DrawGridParameters gridParam);
예제 #20
0
 static extern void Internal_DrawCamera([NotNull("NullExceptionObject")] Camera cam, DrawCameraMode renderMode, bool drawGizmos, bool drawSelection);
예제 #21
0
 static extern void Internal_DrawCamera(Camera cam, DrawCameraMode renderMode, bool drawGizmos);
예제 #22
0
 internal static extern bool IsCameraDrawModeEnabled([NotNull("NullExceptionObject")] Camera camera, DrawCameraMode drawMode);
예제 #23
0
 internal static bool DoesCameraDrawModeSupportHDR(DrawCameraMode mode)
 {
     return ((mode == DrawCameraMode.Textured) || (mode == DrawCameraMode.TexturedWire));
 }
예제 #24
0
    private static void OnScene(SceneView sceneview)
    {
        UnityEditor.SceneView sceneView;
        Vector3    eulerAngles;
        Event      current;
        Quaternion rotHelper;

        current = Event.current;

        if (!current.isKey || current.type != EventType.keyDown)
        {
            return;
        }

        sceneView = UnityEditor.SceneView.lastActiveSceneView;

        eulerAngles = sceneView.camera.transform.rotation.eulerAngles;
        rotHelper   = sceneView.camera.transform.rotation;


        switch (current.keyCode)
        {
        case KeyCode.Keypad1:
            if (current.control == false)
            {
                sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, Quaternion.Euler(new Vector3(0f, 360f, 0f)));
            }
            else
            {
                sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, Quaternion.Euler(new Vector3(0f, 180f, 0f)));
            }
            break;

        case KeyCode.Keypad2:
            sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, rotHelper * Quaternion.Euler(new Vector3(-15f, 0f, 0f)));
            break;

        case KeyCode.Keypad3:
            if (current.control == false)
            {
                sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, Quaternion.Euler(new Vector3(0f, 270f, 0f)));
            }
            else
            {
                sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, Quaternion.Euler(new Vector3(0f, 90f, 0f)));
            }
            break;

        case KeyCode.Keypad4:
            sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, Quaternion.Euler(new Vector3(eulerAngles.x, eulerAngles.y + 15f, eulerAngles.z)));
            break;

        case KeyCode.Keypad5:
            sceneView.orthographic = !sceneView.orthographic;
            break;

        case KeyCode.Keypad6:
            sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, Quaternion.Euler(new Vector3(eulerAngles.x, eulerAngles.y - 15f, eulerAngles.z)));
            break;

        case KeyCode.Keypad7:
            if (current.control == false)
            {
                sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, Quaternion.Euler(new Vector3(90f, 0f, 0f)));
            }
            else
            {
                sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, Quaternion.Euler(new Vector3(270f, 0f, 0f)));
            }
            break;

        case KeyCode.Keypad8:
            sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, rotHelper * Quaternion.Euler(new Vector3(15f, 0f, 0f)));
            break;

        case KeyCode.KeypadPeriod:
            if (Selection.transforms.Length == 1)
            {
                sceneView.LookAtDirect(Selection.activeTransform.position, sceneView.camera.transform.rotation);
            }
            else
            if (Selection.transforms.Length > 1)
            {
                Vector3 tempVec = new Vector3();
                for (int i = 0; i < Selection.transforms.Length; i++)
                {
                    tempVec += Selection.transforms [i].position;
                }
                sceneView.LookAtDirect((tempVec / Selection.transforms.Length), sceneView.camera.transform.rotation);
            }
            break;

        case KeyCode.KeypadMinus:
            SceneView.RepaintAll();
            sceneView.size *= 1.1f;
            break;

        case KeyCode.KeypadPlus:
            SceneView.RepaintAll();
            sceneView.size /= 1.1f;
            break;

        case KeyCode.Z:
            if (lastCameraModeSaved == false)
            {
                oldCameraMode        = sceneView.renderMode;
                lastCameraModeSaved  = true;
                sceneview.renderMode = DrawCameraMode.Wireframe;
            }
            else
            {
                sceneview.renderMode = oldCameraMode;
                lastCameraModeSaved  = false;
            }
            break;

        case KeyCode.H:
            ToggleVisibility();
            if (current.control)
            {
                ClearVisibility();
            }
            break;

        case KeyCode.Slash:
            //case KeyCode.KeypadDivide:
            KeepFocus();
            break;
        }
    }
예제 #25
0
 internal bool CheckDrawModeForRenderingPath(DrawCameraMode mode)
 {
     RenderingPath actualRenderingPath = this.m_Camera.actualRenderingPath;
     if (((mode == DrawCameraMode.DeferredDiffuse) || (mode == DrawCameraMode.DeferredSpecular)) || ((mode == DrawCameraMode.DeferredSmoothness) || (mode == DrawCameraMode.DeferredNormal)))
     {
         return (actualRenderingPath == RenderingPath.DeferredShading);
     }
     return true;
 }
예제 #26
0
 internal bool CheckDrawModeForRenderingPath(DrawCameraMode mode)
 {
   RenderingPath actualRenderingPath = this.m_Camera.actualRenderingPath;
   if (mode == DrawCameraMode.DeferredDiffuse || mode == DrawCameraMode.DeferredSpecular || (mode == DrawCameraMode.DeferredSmoothness || mode == DrawCameraMode.DeferredNormal))
     return actualRenderingPath == RenderingPath.DeferredShading;
   return true;
 }
예제 #27
0
		internal bool CheckDrawModeForRenderingPath(DrawCameraMode mode)
		{
			RenderingPath actualRenderingPath = this.m_Camera.actualRenderingPath;
			return (mode != DrawCameraMode.DeferredDiffuse && mode != DrawCameraMode.DeferredSpecular && mode != DrawCameraMode.DeferredSmoothness && mode != DrawCameraMode.DeferredNormal) || actualRenderingPath == RenderingPath.DeferredShading;
		}
 internal static SceneView.CameraMode GetBuiltinCameraMode(DrawCameraMode drawMode)
 {
     return(Styles.sBuiltinCameraModes.Single(mode => mode.drawMode == drawMode));
 }
예제 #29
0
        private void SetupCamera()
        {
            if (this.m_RenderMode == DrawCameraMode.Overdraw)
            {
                this.m_Camera.backgroundColor = Color.black;
            }
            else
            {
                this.m_Camera.backgroundColor = (Color) kSceneViewBackground;
            }
            EditorUtility.SetCameraAnimateMaterials(this.m_Camera, this.m_SceneViewState.showMaterialUpdate);
            this.ResetIfNaN();
            this.m_Camera.transform.rotation = this.m_Rotation.value;
            float aspectNeutralFOV = this.m_Ortho.Fade(90f, 0f);
            if (aspectNeutralFOV > 3f)
            {
                this.m_Camera.orthographic = false;
                this.m_Camera.fieldOfView = this.GetVerticalFOV(aspectNeutralFOV);
            }
            else
            {
                this.m_Camera.orthographic = true;
                this.m_Camera.orthographicSize = this.GetVerticalOrthoSize();
            }
            this.m_Camera.transform.position = this.m_Position.value + (this.m_Camera.transform.rotation * new Vector3(0f, 0f, -this.cameraDistance));
            float num2 = Mathf.Max((float) 1000f, (float) (2000f * this.size));
            this.m_Camera.nearClipPlane = num2 * 5E-06f;
            this.m_Camera.farClipPlane = num2;
            this.m_Camera.renderingPath = GetSceneViewRenderingPath();
            if (!this.CheckDrawModeForRenderingPath(this.m_RenderMode))
            {
                this.m_RenderMode = DrawCameraMode.Textured;
            }
            this.SetSceneCameraHDRAndDepthModes();
            Handles.EnableCameraFlares(this.m_Camera, this.m_SceneViewState.showFlares);
            Handles.EnableCameraSkybox(this.m_Camera, this.m_SceneViewState.showSkybox);
            this.m_Light[0].transform.position = this.m_Camera.transform.position;
            this.m_Light[0].transform.rotation = this.m_Camera.transform.rotation;
            if (this.m_AudioPlay)
            {
                AudioUtil.SetListenerTransform(this.m_Camera.transform);
                AudioUtil.UpdateAudio();
            }
            if (this.m_ViewIsLockedToObject && (Selection.gameObjects.Length > 0))
            {
                switch (this.m_DraggingLockedState)
                {
                    case DraggingLockedState.NotDragging:
                        this.m_Position.value = Selection.activeGameObject.transform.position;
                        break;

                    case DraggingLockedState.LookAt:
                        if (!this.m_Position.value.Equals(Selection.activeGameObject.transform.position))
                        {
                            if (!EditorApplication.isPlaying)
                            {
                                this.m_Position.target = Selection.activeGameObject.transform.position;
                            }
                            else
                            {
                                this.m_Position.value = Selection.activeGameObject.transform.position;
                            }
                        }
                        else
                        {
                            this.m_DraggingLockedState = DraggingLockedState.NotDragging;
                        }
                        break;
                }
            }
        }
예제 #30
0
		internal static bool DoesCameraDrawModeSupportHDR(DrawCameraMode mode)
		{
			return mode != DrawCameraMode.Overdraw && mode != DrawCameraMode.Mipmaps;
		}
예제 #31
0
 internal bool CheckDrawModeForRenderingPath(DrawCameraMode mode)
 {
     RenderingPath actualRenderingPath = this.m_Camera.actualRenderingPath;
     return ((((mode != DrawCameraMode.DeferredDiffuse) && (mode != DrawCameraMode.DeferredSpecular)) && ((mode != DrawCameraMode.DeferredSmoothness) && (mode != DrawCameraMode.DeferredNormal))) || (actualRenderingPath == RenderingPath.DeferredShading));
 }
예제 #32
0
 static extern void Internal_DrawCameraWithGrid([NotNull("NullExceptionObject")] Camera cam, DrawCameraMode renderMode, ref DrawGridParameters gridParam, bool drawGizmos, bool drawSelection);
예제 #33
0
 internal static bool DoesCameraDrawModeSupportDeferred(DrawCameraMode mode)
 {
     return (((((((mode == DrawCameraMode.Normal) || (mode == DrawCameraMode.Textured)) || ((mode == DrawCameraMode.ShadowCascades) || (mode == DrawCameraMode.RenderPaths))) || (((mode == DrawCameraMode.AlphaChannel) || (mode == DrawCameraMode.DeferredDiffuse)) || ((mode == DrawCameraMode.DeferredSpecular) || (mode == DrawCameraMode.DeferredSmoothness)))) || ((((mode == DrawCameraMode.DeferredNormal) || (mode == DrawCameraMode.Charting)) || ((mode == DrawCameraMode.Systems) || (mode == DrawCameraMode.Albedo))) || (((mode == DrawCameraMode.Emissive) || (mode == DrawCameraMode.Irradiance)) || ((mode == DrawCameraMode.Directionality) || (mode == DrawCameraMode.Baked))))) || (mode == DrawCameraMode.Clustering)) || (mode == DrawCameraMode.LitClustering));
 }
예제 #34
0
 static extern void Internal_DrawCameraWithFilter([NotNull("NullExceptionObject")] Camera cam, DrawCameraMode renderMode, bool drawGizmos, bool drawSelection, GameObject[] filter);
 private bool IsModeDisabled(DrawCameraMode mode)
 {
   if (!this.m_EnableBakedGI.boolValue && mode == DrawCameraMode.Baked)
     return true;
   if (!this.m_EnableRealtimeGI.boolValue && !this.m_EnableBakedGI.boolValue)
     return mode >= DrawCameraMode.Charting;
   return false;
 }
예제 #36
0
 internal static extern bool IsCameraDrawModeEnabled(Camera camera, DrawCameraMode drawMode);
예제 #37
0
 private bool IsModeDisabled(DrawCameraMode mode)
 {
     return((!this.m_EnableBakedGI.boolValue && (mode == DrawCameraMode.Baked)) || ((!this.m_EnableRealtimeGI.boolValue && !this.m_EnableBakedGI.boolValue) && (mode >= DrawCameraMode.Charting)));
 }
예제 #38
0
 static extern void Internal_DrawCamera(Camera cam, DrawCameraMode renderMode);
예제 #39
0
 internal static bool DoesCameraDrawModeSupportHDR(DrawCameraMode mode)
 {
   if (mode != DrawCameraMode.Wireframe && mode != DrawCameraMode.TexturedWire && mode != DrawCameraMode.Overdraw)
     return mode != DrawCameraMode.Mipmaps;
   return false;
 }
예제 #40
0
 public static GUIContent GetGUIContent(DrawCameraMode drawCameraMode)
 {
     return(Styles.sRenderModeOptions[(int)drawCameraMode]);
 }
예제 #41
0
		internal static void DrawCameraStep1(Rect position, Camera camera, DrawCameraMode drawMode, DrawGridParameters gridParam)
		{
			Handles.DrawCameraImpl(position, camera, drawMode, true, gridParam, false);
		}
예제 #42
0
 internal static bool DoesCameraDrawModeSupportHDR(DrawCameraMode mode)
 {
     return ((((mode != DrawCameraMode.Wireframe) && (mode != DrawCameraMode.TexturedWire)) && (mode != DrawCameraMode.Overdraw)) && (mode != DrawCameraMode.Mipmaps));
 }
예제 #43
0
        public static void HandleCascadeSliderGUI(ref float[] normalizedCascadePartitions)
        {
            GUILayout.Label("Cascade splits", new GUILayoutOption[0]);
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(28f), GUILayout.ExpandWidth(true) };
            Rect position             = GUILayoutUtility.GetRect(GUIContent.none, s_CascadeSliderBG, options);

            GUI.Box(position, GUIContent.none);
            float x               = position.x;
            float y               = position.y + 2f;
            float num3            = position.width - (normalizedCascadePartitions.Length * 2);
            Color color           = GUI.color;
            Color backgroundColor = GUI.backgroundColor;
            int   index           = -1;

            float[] destinationArray = new float[normalizedCascadePartitions.Length + 1];
            Array.Copy(normalizedCascadePartitions, destinationArray, normalizedCascadePartitions.Length);
            destinationArray[destinationArray.Length - 1] = 1f - normalizedCascadePartitions.Sum();
            int   controlID       = GUIUtility.GetControlID(s_CascadeSliderId, FocusType.Passive);
            Event current         = Event.current;
            int   activePartition = -1;

            for (int i = 0; i < destinationArray.Length; i++)
            {
                float num8 = destinationArray[i];
                index = (index + 1) % kCascadeColors.Length;
                GUI.backgroundColor = kCascadeColors[index];
                float width = num3 * num8;
                Rect  rect2 = new Rect(x, y, width, 24f);
                GUI.Box(rect2, GUIContent.none, s_CascadeSliderBG);
                x        += width;
                GUI.color = Color.white;
                Rect   rect3 = rect2;
                string t     = string.Format("{0}\n{1:F1}%", i, num8 * 100f);
                GUI.Label(rect3, GUIContent.Temp(t, t), s_TextCenteredStyle);
                if (i == (destinationArray.Length - 1))
                {
                    break;
                }
                GUI.backgroundColor = Color.black;
                Rect rect4 = rect2;
                rect4.x     = x;
                rect4.width = 2f;
                GUI.Box(rect4, GUIContent.none, s_CascadeSliderBG);
                Rect rect5 = rect4;
                rect5.xMin -= 2f;
                rect5.xMax += 2f;
                if (rect5.Contains(current.mousePosition))
                {
                    activePartition = i;
                }
                if (s_DragCache == null)
                {
                    EditorGUIUtility.AddCursorRect(rect5, MouseCursor.ResizeHorizontal, controlID);
                }
                x += 2f;
            }
            GUI.color           = color;
            GUI.backgroundColor = backgroundColor;
            switch (current.GetTypeForControl(controlID))
            {
            case EventType.MouseDown:
                if (activePartition >= 0)
                {
                    s_DragCache = new DragCache(activePartition, normalizedCascadePartitions[activePartition], current.mousePosition);
                    if (GUIUtility.hotControl == 0)
                    {
                        GUIUtility.hotControl = controlID;
                    }
                    current.Use();
                    if (s_RestoreSceneView == null)
                    {
                        s_RestoreSceneView = SceneView.lastActiveSceneView;
                        if (s_RestoreSceneView != null)
                        {
                            s_OldSceneDrawMode            = s_RestoreSceneView.renderMode;
                            s_OldSceneLightingMode        = s_RestoreSceneView.m_SceneLighting;
                            s_RestoreSceneView.renderMode = DrawCameraMode.ShadowCascades;
                        }
                    }
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlID)
                {
                    GUIUtility.hotControl = 0;
                    current.Use();
                }
                s_DragCache = null;
                if (s_RestoreSceneView != null)
                {
                    s_RestoreSceneView.renderMode      = s_OldSceneDrawMode;
                    s_RestoreSceneView.m_SceneLighting = s_OldSceneLightingMode;
                    s_RestoreSceneView = null;
                }
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    Vector2 vector = current.mousePosition - s_DragCache.m_LastCachedMousePosition;
                    float   num10  = vector.x / num3;
                    bool    flag   = (destinationArray[s_DragCache.m_ActivePartition] + num10) > 0f;
                    bool    flag2  = (destinationArray[s_DragCache.m_ActivePartition + 1] - num10) > 0f;
                    if (flag && flag2)
                    {
                        s_DragCache.m_NormalizedPartitionSize += num10;
                        normalizedCascadePartitions[s_DragCache.m_ActivePartition] = s_DragCache.m_NormalizedPartitionSize;
                        if (s_DragCache.m_ActivePartition < (normalizedCascadePartitions.Length - 1))
                        {
                            normalizedCascadePartitions[s_DragCache.m_ActivePartition + 1] -= num10;
                        }
                    }
                    s_DragCache.m_LastCachedMousePosition = current.mousePosition;
                    current.Use();
                    break;
                }
                break;
            }
        }
예제 #44
0
		internal static void DrawCameraImpl(Rect position, Camera camera, DrawCameraMode drawMode, bool drawGrid, DrawGridParameters gridParam, bool finish)
		{
			Event current = Event.current;
			if (current.type == EventType.Repaint)
			{
				if (camera.targetTexture == null)
				{
					Rect rect = GUIClip.Unclip(position);
					camera.pixelRect = new Rect(rect.xMin, (float)Screen.height - rect.yMax, rect.width, rect.height);
				}
				else
				{
					camera.rect = new Rect(0f, 0f, 1f, 1f);
				}
				if (drawMode == DrawCameraMode.Normal)
				{
					RenderTexture targetTexture = camera.targetTexture;
					camera.targetTexture = RenderTexture.active;
					camera.Render();
					camera.targetTexture = targetTexture;
				}
				else
				{
					if (drawGrid)
					{
						Handles.Internal_DrawCameraWithGrid(camera, (int)drawMode, ref gridParam);
					}
					else
					{
						Handles.Internal_DrawCamera(camera, (int)drawMode);
					}
					if (finish)
					{
						Handles.Internal_FinishDrawingCamera(camera);
					}
				}
			}
			else
			{
				Handles.Internal_SetCurrentCamera(camera);
			}
		}
 public static GUIContent GetGUIContent(DrawCameraMode drawCameraMode)
 {
     return Styles.sRenderModeOptions[(int) drawCameraMode];
 }
예제 #46
0
		internal static void DrawCameraStep2(Camera camera, DrawCameraMode drawMode)
		{
			if (Event.current.type == EventType.Repaint && drawMode != DrawCameraMode.Normal)
			{
				Handles.Internal_FinishDrawingCamera(camera);
			}
		}
 public static void HandleCascadeSliderGUI(ref float[] normalizedCascadePartitions)
 {
     GUILayout.Label("Cascade splits", new GUILayoutOption[0]);
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(28f), GUILayout.ExpandWidth(true) };
     Rect position = GUILayoutUtility.GetRect(GUIContent.none, s_CascadeSliderBG, options);
     GUI.Box(position, GUIContent.none);
     float x = position.x;
     float y = position.y + 2f;
     float num3 = position.width - (normalizedCascadePartitions.Length * 2);
     Color color = GUI.color;
     Color backgroundColor = GUI.backgroundColor;
     int index = -1;
     float[] destinationArray = new float[normalizedCascadePartitions.Length + 1];
     Array.Copy(normalizedCascadePartitions, destinationArray, normalizedCascadePartitions.Length);
     destinationArray[destinationArray.Length - 1] = 1f - Enumerable.Sum(normalizedCascadePartitions);
     int controlID = GUIUtility.GetControlID(s_CascadeSliderId, FocusType.Passive);
     Event current = Event.current;
     int activePartition = -1;
     for (int i = 0; i < destinationArray.Length; i++)
     {
         float num8 = destinationArray[i];
         index = (index + 1) % kCascadeColors.Length;
         GUI.backgroundColor = kCascadeColors[index];
         float width = num3 * num8;
         Rect rect2 = new Rect(x, y, width, 24f);
         GUI.Box(rect2, GUIContent.none, s_CascadeSliderBG);
         x += width;
         GUI.color = Color.white;
         Rect rect3 = rect2;
         string t = string.Format("{0}\n{1:F1}%", i, num8 * 100f);
         GUI.Label(rect3, GUIContent.Temp(t, t), s_TextCenteredStyle);
         if (i == (destinationArray.Length - 1))
         {
             break;
         }
         GUI.backgroundColor = Color.black;
         Rect rect4 = rect2;
         rect4.x = x;
         rect4.width = 2f;
         GUI.Box(rect4, GUIContent.none, s_CascadeSliderBG);
         Rect rect5 = rect4;
         rect5.xMin -= 2f;
         rect5.xMax += 2f;
         if (rect5.Contains(current.mousePosition))
         {
             activePartition = i;
         }
         if (s_DragCache == null)
         {
             EditorGUIUtility.AddCursorRect(rect5, MouseCursor.ResizeHorizontal, controlID);
         }
         x += 2f;
     }
     GUI.color = color;
     GUI.backgroundColor = backgroundColor;
     EventType typeForControl = current.GetTypeForControl(controlID);
     if (typeForControl == EventType.MouseDown)
     {
         if (activePartition >= 0)
         {
             s_DragCache = new DragCache(activePartition, normalizedCascadePartitions[activePartition], current.mousePosition);
             if (GUIUtility.hotControl == 0)
             {
                 GUIUtility.hotControl = controlID;
             }
             current.Use();
             if (s_RestoreSceneView == null)
             {
                 s_RestoreSceneView = SceneView.lastActiveSceneView;
                 if (s_RestoreSceneView != null)
                 {
                     s_OldSceneDrawMode = s_RestoreSceneView.renderMode;
                     s_OldSceneLightingMode = s_RestoreSceneView.m_SceneLighting;
                     s_RestoreSceneView.renderMode = DrawCameraMode.ShadowCascades;
                 }
             }
         }
     }
     else if (typeForControl == EventType.MouseUp)
     {
         if (GUIUtility.hotControl == controlID)
         {
             GUIUtility.hotControl = 0;
             current.Use();
         }
         s_DragCache = null;
         if (s_RestoreSceneView != null)
         {
             s_RestoreSceneView.renderMode = s_OldSceneDrawMode;
             s_RestoreSceneView.m_SceneLighting = s_OldSceneLightingMode;
             s_RestoreSceneView = null;
         }
     }
     else if ((typeForControl == EventType.MouseDrag) && (GUIUtility.hotControl == controlID))
     {
         Vector2 vector = current.mousePosition - s_DragCache.m_LastCachedMousePosition;
         float num10 = vector.x / num3;
         bool flag = (destinationArray[s_DragCache.m_ActivePartition] + num10) > 0f;
         bool flag2 = (destinationArray[s_DragCache.m_ActivePartition + 1] - num10) > 0f;
         if (flag && flag2)
         {
             s_DragCache.m_NormalizedPartitionSize += num10;
             normalizedCascadePartitions[s_DragCache.m_ActivePartition] = s_DragCache.m_NormalizedPartitionSize;
             if (s_DragCache.m_ActivePartition < (normalizedCascadePartitions.Length - 1))
             {
                 normalizedCascadePartitions[s_DragCache.m_ActivePartition + 1] -= num10;
             }
             GUI.changed = true;
         }
         s_DragCache.m_LastCachedMousePosition = current.mousePosition;
         current.Use();
     }
 }
예제 #48
0
    public static void HandleCascadeSliderGUI(ref float[] normalizedCascadePartitions)
    {
        //GUILayout.Label("Cascade splits");

        lastP0 = normalizedCascadePartitions[0];
        lastP1 = normalizedCascadePartitions[1];

        Rect rect = GUILayoutUtility.GetRect(GUIContent.none, MultiRangeSlider.s_CascadeSliderBG, new GUILayoutOption[2]
        {
            GUILayout.Height(28f),
            GUILayout.ExpandWidth(true)
        });

        GUI.Box(rect, GUIContent.none);
        float x               = rect.x;
        float y               = rect.y + 2f;
        float num1            = rect.width - (float)(normalizedCascadePartitions.Length * 2);
        Color color           = GUI.color;
        Color backgroundColor = GUI.backgroundColor;
        int   index1          = -1;

        float[] numArray = new float[normalizedCascadePartitions.Length + 1];
        Array.Copy((Array)normalizedCascadePartitions, (Array)numArray, normalizedCascadePartitions.Length);
        numArray[numArray.Length - 1] = 1f - Enumerable.Sum((IEnumerable <float>)normalizedCascadePartitions);
        int   controlId       = GUIUtility.GetControlID(MultiRangeSlider.s_CascadeSliderId, FocusType.Passive);
        Event current         = Event.current;
        int   activePartition = -1;

        for (int index2 = 0; index2 < numArray.Length; ++index2)
        {
            float num2 = numArray[index2];
            index1 = (index1 + 1) % MultiRangeSlider.kCascadeColors.Length;
            GUI.backgroundColor = MultiRangeSlider.kCascadeColors[index1];
            float width     = num1 * num2;
            Rect  position1 = new Rect(x, y, width, 24f);
            GUI.Box(position1, GUIContent.none, MultiRangeSlider.s_CascadeSliderBG);
            float num3 = x + width;
            GUI.color = Color.white;
            Rect   position2 = position1;
            string str       = string.Format("{0}\n{1:F1}%", (object)index2, (object)(float)((double)num2 * 100.0));

            //GUI.Label(position2, GUIContent.Temp(str, str), MultiRangeSlider.s_TextCenteredStyle);
            GUI.Label(position2, str, MultiRangeSlider.s_TextCenteredStyle);

            if (index2 != numArray.Length - 1)
            {
                GUI.backgroundColor = Color.black;
                Rect position3 = position1;
                position3.x     = num3;
                position3.width = 2f;
                GUI.Box(position3, GUIContent.none, MultiRangeSlider.s_CascadeSliderBG);
                Rect position4 = position3;
                position4.xMin -= 2f;
                position4.xMax += 2f;
                if (position4.Contains(current.mousePosition))
                {
                    activePartition = index2;
                }
                if (MultiRangeSlider.s_DragCache == null)
                {
                    EditorGUIUtility.AddCursorRect(position4, MouseCursor.ResizeHorizontal, controlId);
                }
                x = num3 + 2f;
            }
            else
            {
                break;
            }
        }
        GUI.color           = color;
        GUI.backgroundColor = backgroundColor;
        switch (current.GetTypeForControl(controlId))
        {
        case EventType.MouseDown:
            mouseDragging = true;

            if (activePartition < 0)
            {
                break;
            }
            MultiRangeSlider.s_DragCache = new MultiRangeSlider.DragCache(activePartition, normalizedCascadePartitions[activePartition], current.mousePosition);
            if (GUIUtility.hotControl == 0)
            {
                GUIUtility.hotControl = controlId;
            }
            current.Use();
            if (!((UnityEngine.Object)MultiRangeSlider.s_RestoreSceneView == (UnityEngine.Object)null))
            {
                break;
            }
            MultiRangeSlider.s_RestoreSceneView = SceneView.lastActiveSceneView;
            if (!((UnityEngine.Object)MultiRangeSlider.s_RestoreSceneView != (UnityEngine.Object)null))
            {
                break;
            }
            MultiRangeSlider.s_OldSceneDrawMode            = MultiRangeSlider.s_RestoreSceneView.renderMode;
            MultiRangeSlider.s_OldSceneLightingMode        = MultiRangeSlider.s_RestoreSceneView.m_SceneLighting;
            MultiRangeSlider.s_RestoreSceneView.renderMode = DrawCameraMode.ShadowCascades;
            break;

        case EventType.MouseUp:
            mouseDragging = false;

            if (GUIUtility.hotControl == controlId)
            {
                GUIUtility.hotControl = 0;
                current.Use();
            }
            MultiRangeSlider.s_DragCache = (MultiRangeSlider.DragCache)null;
            if (!((UnityEngine.Object)MultiRangeSlider.s_RestoreSceneView != (UnityEngine.Object)null))
            {
                break;
            }
            MultiRangeSlider.s_RestoreSceneView.renderMode      = MultiRangeSlider.s_OldSceneDrawMode;
            MultiRangeSlider.s_RestoreSceneView.m_SceneLighting = MultiRangeSlider.s_OldSceneLightingMode;
            MultiRangeSlider.s_RestoreSceneView = (SceneView)null;
            break;

        case EventType.MouseDrag:
            mouseDragging = true;

            if (GUIUtility.hotControl != controlId)
            {
                break;
            }
            float num4 = (current.mousePosition - MultiRangeSlider.s_DragCache.m_LastCachedMousePosition).x / num1;
            if ((double)numArray[MultiRangeSlider.s_DragCache.m_ActivePartition] + (double)num4 > 0.0 && (double)numArray[MultiRangeSlider.s_DragCache.m_ActivePartition + 1] - (double)num4 > 0.0)
            {
                MultiRangeSlider.s_DragCache.m_NormalizedPartitionSize += num4;
                normalizedCascadePartitions[MultiRangeSlider.s_DragCache.m_ActivePartition] = MultiRangeSlider.s_DragCache.m_NormalizedPartitionSize;
                if (MultiRangeSlider.s_DragCache.m_ActivePartition < normalizedCascadePartitions.Length - 1)
                {
                    normalizedCascadePartitions[MultiRangeSlider.s_DragCache.m_ActivePartition + 1] -= num4;
                }
            }
            MultiRangeSlider.s_DragCache.m_LastCachedMousePosition = current.mousePosition;
            current.Use();
            break;
        }
    }
    public static void HandleCascadeSliderGUI(ref float[] normalizedCascadePartitions)
    {
        //GUILayout.Label("Cascade splits");

        lastP0 = normalizedCascadePartitions[0];
        lastP1 = normalizedCascadePartitions[1];

        Rect rect = GUILayoutUtility.GetRect(GUIContent.none, MultiRangeSlider.s_CascadeSliderBG, new GUILayoutOption[2]
        {
        GUILayout.Height(28f),
        GUILayout.ExpandWidth(true)
        });
        GUI.Box(rect, GUIContent.none);
        float x = rect.x;
        float y = rect.y + 2f;
        float num1 = rect.width - (float)(normalizedCascadePartitions.Length * 2);
        Color color = GUI.color;
        Color backgroundColor = GUI.backgroundColor;
        int index1 = -1;
        float[] numArray = new float[normalizedCascadePartitions.Length + 1];
        Array.Copy((Array)normalizedCascadePartitions, (Array)numArray, normalizedCascadePartitions.Length);
        numArray[numArray.Length - 1] = 1f - Enumerable.Sum((IEnumerable<float>)normalizedCascadePartitions);
        int controlId = GUIUtility.GetControlID(MultiRangeSlider.s_CascadeSliderId, FocusType.Passive);
        Event current = Event.current;
        int activePartition = -1;
        for (int index2 = 0; index2 < numArray.Length; ++index2)
        {
            float num2 = numArray[index2];
            index1 = (index1 + 1) % MultiRangeSlider.kCascadeColors.Length;
            GUI.backgroundColor = MultiRangeSlider.kCascadeColors[index1];
            float width = num1 * num2;
            Rect position1 = new Rect(x, y, width, 24f);
            GUI.Box(position1, GUIContent.none, MultiRangeSlider.s_CascadeSliderBG);
            float num3 = x + width;
            GUI.color = Color.white;
            Rect position2 = position1;
            string str = string.Format("{0}\n{1:F1}%", (object)index2, (object)(float)((double)num2 * 100.0));

            //GUI.Label(position2, GUIContent.Temp(str, str), MultiRangeSlider.s_TextCenteredStyle);
            GUI.Label(position2, str, MultiRangeSlider.s_TextCenteredStyle);

            if (index2 != numArray.Length - 1)
            {
                GUI.backgroundColor = Color.black;
                Rect position3 = position1;
                position3.x = num3;
                position3.width = 2f;
                GUI.Box(position3, GUIContent.none, MultiRangeSlider.s_CascadeSliderBG);
                Rect position4 = position3;
                position4.xMin -= 2f;
                position4.xMax += 2f;
                if (position4.Contains(current.mousePosition))
                    activePartition = index2;
                if (MultiRangeSlider.s_DragCache == null)
                    EditorGUIUtility.AddCursorRect(position4, MouseCursor.ResizeHorizontal, controlId);
                x = num3 + 2f;
            }
            else
                break;
        }
        GUI.color = color;
        GUI.backgroundColor = backgroundColor;
        switch (current.GetTypeForControl(controlId))
        {
            case EventType.MouseDown:
                mouseDragging = true;

                if (activePartition < 0)
                    break;
                MultiRangeSlider.s_DragCache = new MultiRangeSlider.DragCache(activePartition, normalizedCascadePartitions[activePartition], current.mousePosition);
                if (GUIUtility.hotControl == 0)
                    GUIUtility.hotControl = controlId;
                current.Use();
                if (!((UnityEngine.Object)MultiRangeSlider.s_RestoreSceneView == (UnityEngine.Object)null))
                    break;
                MultiRangeSlider.s_RestoreSceneView = SceneView.lastActiveSceneView;
                if (!((UnityEngine.Object)MultiRangeSlider.s_RestoreSceneView != (UnityEngine.Object)null))
                    break;
                MultiRangeSlider.s_OldSceneDrawMode = MultiRangeSlider.s_RestoreSceneView.renderMode;
                MultiRangeSlider.s_OldSceneLightingMode = MultiRangeSlider.s_RestoreSceneView.m_SceneLighting;
                MultiRangeSlider.s_RestoreSceneView.renderMode = DrawCameraMode.ShadowCascades;
                break;
            case EventType.MouseUp:
                mouseDragging = false;

                if (GUIUtility.hotControl == controlId)
                {
                    GUIUtility.hotControl = 0;
                    current.Use();
                }
                MultiRangeSlider.s_DragCache = (MultiRangeSlider.DragCache)null;
                if (!((UnityEngine.Object)MultiRangeSlider.s_RestoreSceneView != (UnityEngine.Object)null))
                    break;
                MultiRangeSlider.s_RestoreSceneView.renderMode = MultiRangeSlider.s_OldSceneDrawMode;
                MultiRangeSlider.s_RestoreSceneView.m_SceneLighting = MultiRangeSlider.s_OldSceneLightingMode;
                MultiRangeSlider.s_RestoreSceneView = (SceneView)null;
                break;
            case EventType.MouseDrag:
                mouseDragging = true;

                if (GUIUtility.hotControl != controlId)
                    break;
                float num4 = (current.mousePosition - MultiRangeSlider.s_DragCache.m_LastCachedMousePosition).x / num1;
                if ((double)numArray[MultiRangeSlider.s_DragCache.m_ActivePartition] + (double)num4 > 0.0 && (double)numArray[MultiRangeSlider.s_DragCache.m_ActivePartition + 1] - (double)num4 > 0.0)
                {
                    MultiRangeSlider.s_DragCache.m_NormalizedPartitionSize += num4;
                    normalizedCascadePartitions[MultiRangeSlider.s_DragCache.m_ActivePartition] = MultiRangeSlider.s_DragCache.m_NormalizedPartitionSize;
                    if (MultiRangeSlider.s_DragCache.m_ActivePartition < normalizedCascadePartitions.Length - 1)
                        normalizedCascadePartitions[MultiRangeSlider.s_DragCache.m_ActivePartition + 1] -= num4;
                }
                MultiRangeSlider.s_DragCache.m_LastCachedMousePosition = current.mousePosition;
                current.Use();
                break;
        }
    }
        public static void HandleCascadeSliderGUI(ref float[] normalizedCascadePartitions)
        {
            GUILayout.Label("Cascade splits", new GUILayoutOption[0]);
            Rect rect = GUILayoutUtility.GetRect(GUIContent.none, ShadowCascadeSplitGUI.s_CascadeSliderBG, new GUILayoutOption[]
            {
                GUILayout.Height(28f),
                GUILayout.ExpandWidth(true)
            });

            GUI.Box(rect, GUIContent.none);
            float num             = rect.x;
            float y               = rect.y + 2f;
            float num2            = rect.width - (float)(normalizedCascadePartitions.Length * 2);
            Color color           = GUI.color;
            Color backgroundColor = GUI.backgroundColor;
            int   num3            = -1;

            float[] array = new float[normalizedCascadePartitions.Length + 1];
            Array.Copy(normalizedCascadePartitions, array, normalizedCascadePartitions.Length);
            array[array.Length - 1] = 1f - normalizedCascadePartitions.Sum();
            int   controlID = GUIUtility.GetControlID(ShadowCascadeSplitGUI.s_CascadeSliderId, FocusType.Passive);
            Event current   = Event.current;
            int   num4      = -1;

            for (int i = 0; i < array.Length; i++)
            {
                float num5 = array[i];
                num3 = (num3 + 1) % ShadowCascadeSplitGUI.kCascadeColors.Length;
                GUI.backgroundColor = ShadowCascadeSplitGUI.kCascadeColors[num3];
                float num6  = num2 * num5;
                Rect  rect2 = new Rect(num, y, num6, 24f);
                GUI.Box(rect2, GUIContent.none, ShadowCascadeSplitGUI.s_CascadeSliderBG);
                num      += num6;
                GUI.color = Color.white;
                Rect   position = rect2;
                string text     = string.Format("{0}\n{1:F1}%", i, num5 * 100f);
                GUI.Label(position, GUIContent.Temp(text, text), ShadowCascadeSplitGUI.s_TextCenteredStyle);
                if (i == array.Length - 1)
                {
                    break;
                }
                GUI.backgroundColor = Color.black;
                Rect rect3 = rect2;
                rect3.x     = num;
                rect3.width = 2f;
                GUI.Box(rect3, GUIContent.none, ShadowCascadeSplitGUI.s_CascadeSliderBG);
                Rect position2 = rect3;
                position2.xMin -= 2f;
                position2.xMax += 2f;
                if (position2.Contains(current.mousePosition))
                {
                    num4 = i;
                }
                if (ShadowCascadeSplitGUI.s_DragCache == null)
                {
                    EditorGUIUtility.AddCursorRect(position2, MouseCursor.ResizeHorizontal, controlID);
                }
                num += 2f;
            }
            GUI.color           = color;
            GUI.backgroundColor = backgroundColor;
            EventType typeForControl = current.GetTypeForControl(controlID);

            if (typeForControl != EventType.MouseDown)
            {
                if (typeForControl != EventType.MouseUp)
                {
                    if (typeForControl == EventType.MouseDrag)
                    {
                        if (GUIUtility.hotControl == controlID)
                        {
                            float num7  = (current.mousePosition - ShadowCascadeSplitGUI.s_DragCache.m_LastCachedMousePosition).x / num2;
                            bool  flag  = array[ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition] + num7 > 0f;
                            bool  flag2 = array[ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition + 1] - num7 > 0f;
                            if (flag && flag2)
                            {
                                ShadowCascadeSplitGUI.s_DragCache.m_NormalizedPartitionSize += num7;
                                normalizedCascadePartitions[ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition] = ShadowCascadeSplitGUI.s_DragCache.m_NormalizedPartitionSize;
                                if (ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition < normalizedCascadePartitions.Length - 1)
                                {
                                    normalizedCascadePartitions[ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition + 1] -= num7;
                                }
                                GUI.changed = true;
                            }
                            ShadowCascadeSplitGUI.s_DragCache.m_LastCachedMousePosition = current.mousePosition;
                            current.Use();
                        }
                    }
                }
                else
                {
                    if (GUIUtility.hotControl == controlID)
                    {
                        GUIUtility.hotControl = 0;
                        current.Use();
                    }
                    ShadowCascadeSplitGUI.s_DragCache = null;
                    if (ShadowCascadeSplitGUI.s_RestoreSceneView != null)
                    {
                        ShadowCascadeSplitGUI.s_RestoreSceneView.renderMode      = ShadowCascadeSplitGUI.s_OldSceneDrawMode;
                        ShadowCascadeSplitGUI.s_RestoreSceneView.m_SceneLighting = ShadowCascadeSplitGUI.s_OldSceneLightingMode;
                        ShadowCascadeSplitGUI.s_RestoreSceneView = null;
                    }
                }
            }
            else if (num4 >= 0)
            {
                ShadowCascadeSplitGUI.s_DragCache = new ShadowCascadeSplitGUI.DragCache(num4, normalizedCascadePartitions[num4], current.mousePosition);
                if (GUIUtility.hotControl == 0)
                {
                    GUIUtility.hotControl = controlID;
                }
                current.Use();
                if (ShadowCascadeSplitGUI.s_RestoreSceneView == null)
                {
                    ShadowCascadeSplitGUI.s_RestoreSceneView = SceneView.lastActiveSceneView;
                    if (ShadowCascadeSplitGUI.s_RestoreSceneView != null)
                    {
                        ShadowCascadeSplitGUI.s_OldSceneDrawMode            = ShadowCascadeSplitGUI.s_RestoreSceneView.renderMode;
                        ShadowCascadeSplitGUI.s_OldSceneLightingMode        = ShadowCascadeSplitGUI.s_RestoreSceneView.m_SceneLighting;
                        ShadowCascadeSplitGUI.s_RestoreSceneView.renderMode = DrawCameraMode.ShadowCascades;
                    }
                }
            }
        }
예제 #51
0
 public SceneCamera()
 {
     Camera   = Camera.main;
     DrawMode = DrawCameraMode.Normal;
 }
예제 #52
0
 internal static void DrawCamera(Rect position, Camera camera, DrawCameraMode drawMode, DrawGridParameters gridParam)
 {
     DrawCameraImpl(position, camera, drawMode, true, gridParam, true);
 }
예제 #53
0
		internal static bool DoesCameraDrawModeSupportDeferred(DrawCameraMode mode)
		{
			return mode == DrawCameraMode.Normal || mode == DrawCameraMode.Textured || mode == DrawCameraMode.ShadowCascades || mode == DrawCameraMode.RenderPaths || mode == DrawCameraMode.AlphaChannel || mode == DrawCameraMode.DeferredDiffuse || mode == DrawCameraMode.DeferredSpecular || mode == DrawCameraMode.DeferredSmoothness || mode == DrawCameraMode.DeferredNormal;
		}
 private bool IsModeDisabled(DrawCameraMode mode)
 {
     return ((!this.m_EnableBakedGI.boolValue && (mode == DrawCameraMode.Baked)) || ((!this.m_EnableRealtimeGI.boolValue && !this.m_EnableBakedGI.boolValue) && (mode >= DrawCameraMode.Charting)));
 }
		public static void HandleCascadeSliderGUI(ref float[] normalizedCascadePartitions)
		{
			GUILayout.Label("Cascade splits", new GUILayoutOption[0]);
			Rect rect = GUILayoutUtility.GetRect(GUIContent.none, ShadowCascadeSplitGUI.s_CascadeSliderBG, new GUILayoutOption[]
			{
				GUILayout.Height(28f),
				GUILayout.ExpandWidth(true)
			});
			GUI.Box(rect, GUIContent.none);
			float num = rect.x;
			float top = rect.y + 2f;
			float num2 = rect.width - (float)(normalizedCascadePartitions.Length * 2);
			Color color = GUI.color;
			Color backgroundColor = GUI.backgroundColor;
			int num3 = -1;
			float[] array = new float[normalizedCascadePartitions.Length + 1];
			Array.Copy(normalizedCascadePartitions, array, normalizedCascadePartitions.Length);
			array[array.Length - 1] = 1f - normalizedCascadePartitions.Sum();
			int controlID = GUIUtility.GetControlID(ShadowCascadeSplitGUI.s_CascadeSliderId, FocusType.Passive);
			Event current = Event.current;
			int num4 = -1;
			for (int i = 0; i < array.Length; i++)
			{
				float num5 = array[i];
				num3 = (num3 + 1) % ShadowCascadeSplitGUI.kCascadeColors.Length;
				GUI.backgroundColor = ShadowCascadeSplitGUI.kCascadeColors[num3];
				float num6 = num2 * num5;
				Rect rect2 = new Rect(num, top, num6, 24f);
				GUI.Box(rect2, GUIContent.none, ShadowCascadeSplitGUI.s_CascadeSliderBG);
				num += num6;
				GUI.color = Color.white;
				Rect position = rect2;
				string text = string.Format("{0}\n{1:F1}%", i, num5 * 100f);
				GUI.Label(position, GUIContent.Temp(text, text), ShadowCascadeSplitGUI.s_TextCenteredStyle);
				if (i == array.Length - 1)
				{
					break;
				}
				GUI.backgroundColor = Color.black;
				Rect rect3 = rect2;
				rect3.x = num;
				rect3.width = 2f;
				GUI.Box(rect3, GUIContent.none, ShadowCascadeSplitGUI.s_CascadeSliderBG);
				Rect position2 = rect3;
				position2.xMin -= 2f;
				position2.xMax += 2f;
				if (position2.Contains(current.mousePosition))
				{
					num4 = i;
				}
				if (ShadowCascadeSplitGUI.s_DragCache == null)
				{
					EditorGUIUtility.AddCursorRect(position2, MouseCursor.ResizeHorizontal, controlID);
				}
				num += 2f;
			}
			GUI.color = color;
			GUI.backgroundColor = backgroundColor;
			switch (current.GetTypeForControl(controlID))
			{
			case EventType.MouseDown:
				if (num4 >= 0)
				{
					ShadowCascadeSplitGUI.s_DragCache = new ShadowCascadeSplitGUI.DragCache(num4, normalizedCascadePartitions[num4], current.mousePosition);
					if (GUIUtility.hotControl == 0)
					{
						GUIUtility.hotControl = controlID;
					}
					current.Use();
					if (ShadowCascadeSplitGUI.s_RestoreSceneView == null)
					{
						ShadowCascadeSplitGUI.s_RestoreSceneView = SceneView.lastActiveSceneView;
						if (ShadowCascadeSplitGUI.s_RestoreSceneView != null)
						{
							ShadowCascadeSplitGUI.s_OldSceneDrawMode = ShadowCascadeSplitGUI.s_RestoreSceneView.renderMode;
							ShadowCascadeSplitGUI.s_OldSceneLightingMode = ShadowCascadeSplitGUI.s_RestoreSceneView.m_SceneLighting;
							ShadowCascadeSplitGUI.s_RestoreSceneView.renderMode = DrawCameraMode.ShadowCascades;
						}
					}
				}
				break;
			case EventType.MouseUp:
				if (GUIUtility.hotControl == controlID)
				{
					GUIUtility.hotControl = 0;
					current.Use();
				}
				ShadowCascadeSplitGUI.s_DragCache = null;
				if (ShadowCascadeSplitGUI.s_RestoreSceneView != null)
				{
					ShadowCascadeSplitGUI.s_RestoreSceneView.renderMode = ShadowCascadeSplitGUI.s_OldSceneDrawMode;
					ShadowCascadeSplitGUI.s_RestoreSceneView.m_SceneLighting = ShadowCascadeSplitGUI.s_OldSceneLightingMode;
					ShadowCascadeSplitGUI.s_RestoreSceneView = null;
				}
				break;
			case EventType.MouseDrag:
				if (GUIUtility.hotControl == controlID)
				{
					float num7 = (current.mousePosition - ShadowCascadeSplitGUI.s_DragCache.m_LastCachedMousePosition).x / num2;
					bool flag = array[ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition] + num7 > 0f;
					bool flag2 = array[ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition + 1] - num7 > 0f;
					if (flag && flag2)
					{
						ShadowCascadeSplitGUI.s_DragCache.m_NormalizedPartitionSize += num7;
						normalizedCascadePartitions[ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition] = ShadowCascadeSplitGUI.s_DragCache.m_NormalizedPartitionSize;
						if (ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition < normalizedCascadePartitions.Length - 1)
						{
							normalizedCascadePartitions[ShadowCascadeSplitGUI.s_DragCache.m_ActivePartition + 1] -= num7;
						}
					}
					ShadowCascadeSplitGUI.s_DragCache.m_LastCachedMousePosition = current.mousePosition;
					current.Use();
				}
				break;
			}
		}