예제 #1
0
        protected override void Render(Shader shader, string tag, Camera renderCam)
        {
            bool invertCulling = GL.invertCulling;

            GL.invertCulling            = true;
            renderCam.projectionMatrix *= Matrix4x4.Scale(new Vector3(1, -1, 1));
            renderCam.Render();
            GL.invertCulling = invertCulling;

            m_cache.Clear();
        }
예제 #2
0
        private void Update()
        {
            if (m_activeWindow == null || m_selectionComponent == null)
            {
                return;
            }

            Ray ray = new Ray(m_activeWindow.Camera.transform.position, m_activeWindow.Camera.transform.forward);

            if (m_prevRay.origin == ray.origin && m_prevRay.direction == ray.direction && !m_editor.Tools.IsViewing)
            {
                if (m_animatingCamera)
                {
                    m_updateRenderers = true;
                }

                m_animatingCamera = false;
            }
            else
            {
                m_prevRay         = ray;
                m_animatingCamera = true;
                return;
            }

            if (m_updateRenderers)
            {
                m_updateRenderers = false;
                m_renderers       = m_editor.Object.Get(true).SelectMany(go => go.GetComponentsInChildren <Renderer>()).ToArray();
                m_texPixels       = m_selectionComponent.BoxSelection.BeginPick(out m_texSize, m_renderers);
            }

            m_cache.Clear();

            BaseHandle handle = null;

            switch (m_editor.Tools.Current)
            {
            case RuntimeTool.Move:
                handle = m_selectionComponent.PositionHandle;
                break;

            case RuntimeTool.Rotate:
                handle = m_selectionComponent.RotationHandle;
                break;

            case RuntimeTool.Scale:
                handle = m_selectionComponent.ScaleHandle;
                break;

            case RuntimeTool.Rect:
                handle = m_selectionComponent.RectTool;
                break;

            case RuntimeTool.Custom:
                handle = m_selectionComponent.CustomHandle;
                break;
            }

            if (IsPointerOver(handle) || m_editor.Tools.ActiveTool == m_selectionComponent.BoxSelection && m_selectionComponent.BoxSelection != null)
            {
                return;
            }

            Renderer[] renderers = m_selectionComponent.BoxSelection.EndPick(m_texPixels, m_texSize, m_renderers);
            m_cache.Add(renderers, true, true);
        }