Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 //
 void OnEnable()
 {
     EndOfFrame.AddListener(OnEndOfFrame);
 }