コード例 #1
0
        //
        protected virtual void OnDisable()
        {
            if (renderBuffer != null)
            {
                cam.RemoveCommandBuffer(queue, renderBuffer);
                renderBuffer = null;
            }

            if (highlightingBuffer != null && highlightingBuffer.IsCreated())
            {
                highlightingBuffer.Release();
                highlightingBuffer = null;
            }

            if (_blitter != null)
            {
                _blitter.Unregister(this);
            }

            EndOfFrame.RemoveListener(OnEndOfFrame);
        }
コード例 #2
0
        //
        protected virtual void OnEnable()
        {
            Initialize();

            if (!CheckSupported(true))
            {
                enabled = false;
                Debug.LogError("HighlightingSystem : Highlighting System has been disabled due to unsupported Unity features on the current platform!");
                return;
            }

            blur1ID = new RenderTargetIdentifier(ShaderPropertyID._HighlightingBlur1);
            blur2ID = new RenderTargetIdentifier(ShaderPropertyID._HighlightingBlur2);

            blurMaterial = new Material(materials[BLUR]);
            cutMaterial  = new Material(materials[CUT]);
            compMaterial = new Material(materials[COMP]);

            // Set initial material properties
            blurMaterial.SetKeyword(keywordStraightDirections, _blurDirections == BlurDirections.Straight);
            blurMaterial.SetKeyword(keywordAllDirections, _blurDirections == BlurDirections.All);
            blurMaterial.SetFloat(ShaderPropertyID._HighlightingIntensity, _blurIntensity);
            cutMaterial.SetFloat(ShaderPropertyID._HighlightingFillAlpha, _fillAlpha);

            renderBuffer      = new CommandBuffer();
            renderBuffer.name = renderBufferName;

            cam = GetComponent <Camera>();

            cam.depthTextureMode |= DepthTextureMode.Depth;

            cam.AddCommandBuffer(queue, renderBuffer);

            if (_blitter != null)
            {
                _blitter.Register(this);
            }

            EndOfFrame.AddListener(OnEndOfFrame);
        }
コード例 #3
0
 //
 void OnDisable()
 {
     EndOfFrame.RemoveListener(OnEndOfFrame);
 }
コード例 #4
0
 //
 void OnEnable()
 {
     EndOfFrame.AddListener(OnEndOfFrame);
 }