예제 #1
0
파일: VRView.cs 프로젝트: timkulp/EditorVR
        void OnGUI()
        {
            if (beforeOnGUI != null)
            {
                beforeOnGUI(this);
            }

            SceneViewUtilities.ResetOnGUIState();

            var rect = guiRect;

            rect.x      = 0;
            rect.y      = 0;
            rect.width  = position.width;
            rect.height = position.height;
            guiRect     = rect;
            var cameraRect = EditorGUIUtility.PointsToPixels(guiRect);

            PrepareCameraTargetTexture(cameraRect);

            m_Camera.cullingMask = m_CullingMask.HasValue ? m_CullingMask.Value.value : UnityEditor.Tools.visibleLayers;

            // Draw camera
            bool pushedGUIClip;

            DoDrawCamera(guiRect, out pushedGUIClip);

            if (m_ShowDeviceView)
            {
                SceneViewUtilities.DrawTexture(customPreviewCamera && customPreviewCamera.targetTexture ? customPreviewCamera.targetTexture : m_SceneTargetTexture, guiRect, pushedGUIClip);
            }

            GUILayout.BeginArea(guiRect);
            {
                if (GUILayout.Button("Toggle Device View", EditorStyles.toolbarButton))
                {
                    m_ShowDeviceView = !m_ShowDeviceView;
                }

                if (m_CustomPreviewCamera)
                {
                    GUILayout.FlexibleSpace();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.FlexibleSpace();
                        m_UseCustomPreviewCamera = GUILayout.Toggle(m_UseCustomPreviewCamera, "Use Presentation Camera");
                    }
                    GUILayout.EndHorizontal();
                }
            }
            GUILayout.EndArea();

            if (afterOnGUI != null)
            {
                afterOnGUI(this);
            }
        }
예제 #2
0
파일: VRView.cs 프로젝트: monigarr/EditorVR
        private void OnGUI()
        {
            if (onGUIDelegate != null)
            {
                onGUIDelegate(this);
            }

            var e = Event.current;

            if (e.type != EventType.ExecuteCommand && e.type != EventType.used)
            {
                SceneViewUtilities.ResetOnGUIState();

                var guiRect    = new Rect(0, 0, position.width, position.height);
                var cameraRect = EditorGUIUtility.PointsToPixels(guiRect);
                PrepareCameraTargetTexture(cameraRect);

                m_Camera.cullingMask = m_CullingMask.HasValue ? m_CullingMask.Value.value : UnityEditor.Tools.visibleLayers;

                // Draw camera
                bool pushedGUIClip;
                DoDrawCamera(guiRect, out pushedGUIClip);

                if (m_ShowDeviceView)
                {
                    SceneViewUtilities.DrawTexture(customPreviewCamera && customPreviewCamera.targetTexture ? customPreviewCamera.targetTexture : m_SceneTargetTexture, guiRect, pushedGUIClip);
                }

                GUILayout.BeginArea(guiRect);
                {
                    if (GUILayout.Button("Toggle Device View", EditorStyles.toolbarButton))
                    {
                        m_ShowDeviceView = !m_ShowDeviceView;
                    }

                    if (m_CustomPreviewCamera)
                    {
                        GUILayout.FlexibleSpace();
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.FlexibleSpace();
                            m_UseCustomPreviewCamera = GUILayout.Toggle(m_UseCustomPreviewCamera, "Use Presentation Camera");
                        }
                        GUILayout.EndHorizontal();
                    }
                }
                GUILayout.EndArea();
            }
        }
예제 #3
0
        private void OnGUI()
        {
            onGUIDelegate(this);
            SceneViewUtilities.ResetOnGUIState();

            SetupCamera();

            Rect guiRect    = new Rect(0, 0, position.width, position.height);
            Rect cameraRect = EditorGUIUtility.PointsToPixels(guiRect);

            PrepareCameraTargetTexture(cameraRect);
            Handles.ClearCamera(cameraRect, m_Camera);

            m_Camera.cullingMask = Tools.visibleLayers;

            // Draw camera
            bool pushedGUIClip;

            DoDrawCamera(guiRect, out pushedGUIClip);

            SceneViewUtilities.BlitRT(m_SceneTargetTexture, guiRect, pushedGUIClip);
        }