コード例 #1
0
 protected virtual void OnCommandBufferRefresh(IRTECamera camera)
 {
     HandleProperties.SetColor("_Color", HandlesColor);
     LineProperties.SetColor("_Color", LineColor);
     SelectionProperties.SetColor("_Color", SelectionColor);
 }
コード例 #2
0
 private void OnCommandBufferRefresh(IRTECamera rteCamera)
 {
     Appearance.DoSceneGizmo(rteCamera.CommandBuffer, m_propertyBlocks, m_camera, GetGizmoPosition(), Quaternion.identity, m_selectedAxis, Appearance.SceneGizmoScale, m_textColor, m_xAlpha, m_yAlpha, m_zAlpha);
 }
コード例 #3
0
        private void Start()
        {
            BaseGizmoInput input = GetComponent <BaseGizmoInput>();

            if (input == null || input.Gizmo != this)
            {
                input       = gameObject.AddComponent <BaseGizmoInput>();
                input.Gizmo = this;
            }

            if (SceneCamera == null)
            {
                SceneCamera = Window.Camera;
            }

            if (SceneCamera == null)
            {
                SceneCamera = Camera.main;
            }

            if (Target == null)
            {
                Target = transform;
            }

            if (EnableUndo)
            {
                if (!RuntimeUndoInput.IsInitialized)
                {
                    GameObject runtimeUndo = new GameObject();
                    runtimeUndo.name = "RuntimeUndo";
                    runtimeUndo.AddComponent <RuntimeUndoInput>();
                }
            }

            IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>();

            if (graphicsLayer != null)
            {
                m_rteCamera = graphicsLayer.Camera;
            }

            if (m_rteCamera == null && SceneCamera != null)
            {
                IRTEGraphics graphics = IOC.Resolve <IRTEGraphics>();
                if (graphics != null)
                {
                    m_rteCamera = graphics.GetOrCreateCamera(SceneCamera, CameraEvent.AfterImageEffectsOpaque);
                }

                if (m_rteCamera == null)
                {
                    m_rteCamera       = SceneCamera.gameObject.AddComponent <RTECamera>();
                    m_rteCamera.Event = CameraEvent.AfterImageEffectsOpaque;
                }
            }

            if (m_rteCamera != null)
            {
                m_prevPosition = transform.position;
                m_prevRotation = transform.rotation;
                m_prevScale    = transform.localScale;

                m_prevCamPosition  = m_rteCamera.Camera.transform.position;
                m_prevCamRotation  = m_rteCamera.Camera.transform.rotation;
                m_prevOrthographic = m_rteCamera.Camera.orthographic;

                m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh;
                m_rteCamera.RefreshCommandBuffer();
            }

            StartOverride();
        }
コード例 #4
0
 protected override void RefreshCommandBuffer(IRTECamera camera)
 {
     Appearance.DoScaleHandle(camera.CommandBuffer, m_propertyBlocks, camera.Camera, m_roundedScale, Target.position, Rotation, SelectedAxis, LockObject);
 }
コード例 #5
0
        private void PrepareGraphicsLayerCamera()
        {
            bool wasActive = m_window.Camera.gameObject.activeSelf;

            m_window.Camera.gameObject.SetActive(false);

            if (m_window.Editor.IsVR && m_window.Camera.stereoEnabled && m_window.Camera.stereoTargetEye == StereoTargetEyeMask.Both)
            {
                m_camera = Instantiate(m_window.Camera, m_window.Camera.transform.parent);
                m_camera.transform.SetSiblingIndex(m_window.Camera.transform.GetSiblingIndex() + 1);
            }
            else
            {
                m_camera = Instantiate(m_window.Camera, m_window.Camera.transform);
            }

            for (int i = m_camera.transform.childCount - 1; i >= 0; i--)
            {
                Destroy(m_camera.transform.GetChild(i).gameObject);
            }

            Component[] components = m_camera.GetComponents <Component>();
            for (int i = 0; i < components.Length; ++i)
            {
                Component component = components[i];
                if (component is Transform)
                {
                    continue;
                }
                if (component is Camera)
                {
                    continue;
                }
                if (component is RenderTextureCamera)
                {
                    continue;
                }

                Destroy(component);
            }

            m_camera.transform.localPosition = Vector3.zero;
            m_camera.transform.localRotation = Quaternion.identity;
            m_camera.transform.localScale    = Vector3.one;
            m_camera.name        = "GraphicsLayerCamera";
            m_camera.depth       = m_window.Camera.depth + 1;
            m_camera.cullingMask = 0;

            m_graphicsCamera      = m_graphics.CreateCamera(m_camera);
            m_renderTextureCamera = m_camera.GetComponent <RenderTextureCamera>();
            if (m_renderTextureCamera == null)
            {
                if (RenderPipelineInfo.Type == RPType.Standard)
                {
                    if (m_window.RenderTextureUsage == RenderTextureUsage.On || m_window.RenderTextureUsage == RenderTextureUsage.UsePipelineSettings && RenderPipelineInfo.UseRenderTextures)
                    {
                        CreateRenderTextureCamera();
                    }
                    else
                    {
                        m_camera.clearFlags = CameraClearFlags.Depth;
                    }
                }
                else
                {
                    RenderPipelineManager.beginFrameRendering += OnBeginFrameRendering;
                    RenderPipelineManager.endFrameRendering   += OnEndFrameRendering;
                }
            }
            else
            {
                if (m_window.RenderTextureUsage == RenderTextureUsage.Off || m_window.RenderTextureUsage == RenderTextureUsage.UsePipelineSettings && !RenderPipelineInfo.UseRenderTextures)
                {
                    DestroyImmediate(m_renderTextureCamera);
                }
                else
                {
                    m_renderTextureCamera.OverlayMaterial = new Material(Shader.Find("Battlehub/RTCommon/RenderTextureOverlay"));
                    m_camera.clearFlags      = CameraClearFlags.SolidColor;
                    m_camera.backgroundColor = new Color(0, 0, 0, 0);
                }
            }

            m_camera.allowHDR         = false;                            //fix strange screen blinking bug...
            m_camera.projectionMatrix = m_window.Camera.projectionMatrix; //for ARCore

            m_window.Camera.gameObject.SetActive(wasActive);
            m_camera.gameObject.SetActive(true);
        }
コード例 #6
0
 protected virtual void RefreshCommandBuffer(IRTECamera camera)
 {
 }
コード例 #7
0
 protected override void RefreshCommandBuffer(IRTECamera camera)
 {
     Appearance.DoRotationHandle(camera.CommandBuffer, m_propertyBlocks, camera.Camera, Target.rotation * StartingRotationInv, Target.position, SelectedAxis, LockObject, Editor.IsVR);
 }