コード例 #1
0
        protected virtual void TryCheckSustainedChildrens(bool p_force = false)
        {
            if (_isChildrensDirty || p_force)
            {
                _isChildrensDirty = false;

                //Invalidate constant repaint based in childrens
                var v_requireConstantRepaint = false;
                foreach (var _sustainedElement in _sustainedChildrenElements)
                {
                    if (!_sustainedElement.IsDestroyed())
                    {
                        v_requireConstantRepaint = v_requireConstantRepaint || _sustainedElement.RequiresConstantRepaint;
                        if (v_requireConstantRepaint)
                        {
                            break;
                        }
                    }
                }

                _childrenNeedsConstantRepaint = v_requireConstantRepaint;

                //We must invalidate all SustainedCanvas Parents
                var v_sustainedParent = FindSustainedCanvasParent(this);
                if (v_sustainedParent != null)
                {
                    v_sustainedParent.TryCheckSustainedChildrens(true);
                }
                else
                {
                    SustainedPerformanceManager.MarkDynamicElementsDirty();
                }
            }
        }
コード例 #2
0
 //Canvas Rebuild Listener for WorldSpace Canvas
 public void OnCanvasRebuild()
 {
     //We must invalidate buffer when in WorldSpace
     if (!IsScreenCanvasMember())
     {
         SustainedPerformanceManager.Invalidate(this);
     }
 }
コード例 #3
0
 protected override void OnEnable()
 {
     FindRootCanvasParent();
     if (m_autoCalculateCullingMask)
     {
         RecalculateCullingMask();
     }
     SustainedPerformanceManager.RegisterDynamicElement(this);
     base.OnEnable();
 }
コード例 #4
0
        /*protected virtual void HandleOnAfterWaitingToPrepareRenderBuffer(int p_invalidCullingMask)
         * {
         *  SetViewActive(SustainedPerformanceManager.IsCameraViewInvalid(this, p_invalidCullingMask));
         * }*/

        protected virtual void HandleOnAfterDrawBuffer(Dictionary <int, RenderTexture> p_renderBuffersDict)
        {
            if (m_useRenderBuffer && !SustainedPerformanceManager.IsCameraViewInvalid(this))
            {
                var v_camera = Camera;
                if (v_camera != null)
                {
                    v_camera.enabled = false;
                }
            }
        }
コード例 #5
0
 protected override void OnBeforeTransformHasChanged()
 {
     if (m_forceInvalidateWhenChanged || !IsScreenCanvasMember())
     {
         SustainedPerformanceManager.Invalidate(this);
     }
     else
     {
         SustainedPerformanceManager.Refresh(this);
     }
 }
コード例 #6
0
 protected virtual void Start()
 {
     _started = true;
     if (SustainedPerformanceManager.IsHighPerformanceActive())
     {
         HandleOnSetHighPerformance(true);
     }
     else
     {
         HandleOnSetLowPerformance();
     }
 }
コード例 #7
0
        protected virtual void OnDisable()
        {
            if (IsScreenCanvasMember())
            {
                SustainedPerformanceManager.Refresh();
            }
            else
            {
                SustainedPerformanceManager.Invalidate(this);
            }

            SustainedPerformanceManager.UnregisterDynamicElement(this);
            UnregisterEvents();
            SetViewActive(!Application.isPlaying);
        }
コード例 #8
0
 protected virtual void OnEnable()
 {
     SustainedPerformanceManager.RegisterDynamicElement(this);
     RegisterEvents();
     if (_started)
     {
         if (SustainedPerformanceManager.IsHighPerformanceActive())
         {
             HandleOnSetHighPerformance(true);
         }
         else
         {
             HandleOnSetLowPerformance();
         }
     }
 }
コード例 #9
0
 protected virtual void TryInitRenderBuffer()
 {
     if (Application.isPlaying)
     {
         if (m_useRenderBuffer)
         {
             var v_bufferCamera = Camera;
             if (v_bufferCamera != null)
             {
                 var v_renderTexture = SustainedPerformanceManager.GetRenderBuffer(m_renderBufferIndex);
                 if (v_bufferCamera.targetTexture != v_renderTexture)
                 {
                     v_bufferCamera.targetTexture = v_renderTexture;
                 }
             }
         }
     }
 }
コード例 #10
0
        public virtual void MarkDynamicElementDirty()
        {
            var v_executed = false;

            if (IsScreenCanvasMember())
            {
                var v_canvasView = GetSustainedCanvasParent();
                if (v_canvasView != null)
                {
                    v_executed = true;
                    v_canvasView.MarkDynamicElementDirty();
                }
            }
            if (!v_executed)
            {
                SustainedPerformanceManager.MarkDynamicElementsDirty();
            }
        }
コード例 #11
0
        protected virtual void ApplyRenderBufferImmediate()
        {
            TryCreateClearTexture();

            var v_renderBuffer = SustainedPerformanceManager.GetRenderBuffer(m_renderBufferIndex);

            //Setup RenderBuffer
            if (v_renderBuffer != null)
            {
                if (v_renderBuffer != texture)
                {
                    texture = v_renderBuffer;
                }
            }
            //Apply clear texture
            else
            {
                ClearTexture();
            }

            RecalculateRectUV(m_uvBasedOnScreenRect);
        }
コード例 #12
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     ClearRenderBuffer();
     SustainedPerformanceManager.Invalidate(this);
 }
コード例 #13
0
        protected override void HandleOnSetHighPerformance(bool p_invalidateBuffer)
        {
            //We only want to invalidate this canvas if is SelfRequired Constant Repaint
            TryCheckSustainedChildrens();

            if (IsScreenCanvasMember())
            {
                /*if (SustainedPerformanceManager.IsWaitingRenderBuffer)
                 * {
                 *  //Register to invalidate After DrawBuffer
                 *  RegisterBufferEvents();
                 * }*/
                var v_viewIsActive = SustainedPerformanceManager.UseSafeRefreshMode;
                if (!v_viewIsActive)
                {
                    v_viewIsActive = p_invalidateBuffer || SustainedPerformanceManager.RequiresConstantRepaint || SustainedPerformanceManager.IsCanvasViewInvalid(this);
                }
                SetViewActive(v_viewIsActive);
            }
            //WorldSpace Canvas
            else
            {
                var v_isViewActive = p_invalidateBuffer || SustainedPerformanceManager.RequiresConstantBufferRepaint;
                if (!v_isViewActive)
                {
                    v_isViewActive = !UseRenderBuffer;
                }

                SetViewActive(v_isViewActive);
            }
        }
コード例 #14
0
 public virtual void MarkDynamicElementDirty()
 {
     SustainedPerformanceManager.MarkDynamicElementsDirty();
 }
コード例 #15
0
 protected override void OnDisable()
 {
     SustainedCanvasView.UnregisterDynamicElement(this);
     SustainedPerformanceManager.UnregisterDynamicElement(this);
     base.OnDisable();
 }
コード例 #16
0
 protected override void HandleOnSetLowPerformance()
 {
     SetViewActive(SustainedPerformanceManager.RequiresConstantBufferRepaint && SustainedPerformanceManager.IsCameraViewInvalid(this));
 }
コード例 #17
0
        protected override void HandleOnSetHighPerformance(bool p_invalidateBuffer)
        {
            var v_isViewActive = (p_invalidateBuffer || SustainedPerformanceManager.RequiresConstantBufferRepaint) && SustainedPerformanceManager.IsCameraViewInvalid(this);

            if (!v_isViewActive)
            {
                v_isViewActive = !m_useRenderBuffer;
            }

            SetViewActive(v_isViewActive);
        }
コード例 #18
0
 protected virtual void Awake()
 {
     _isViewActive = SustainedPerformanceManager.IsHighPerformanceActive();
     RegisterRenderView();
 }