//
        protected virtual void OnEnable()
        {
            hb = target as HighlightingBase;

            LoadPresets();
            presetIndex = FindCurrentPreset();
        }
Exemple #2
0
        //
        protected virtual void OnRenderImage(RenderTexture src, RenderTexture dst)
        {
            bool oddEven = true;

            for (int i = 0; i < renderers.Count; i++)
            {
                HighlightingBase renderer = renderers[i];
                if (oddEven)
                {
                    renderer.Blit(src, dst);
                }
                else
                {
                    renderer.Blit(dst, src);
                }

                oddEven = !oddEven;
            }

            // Additional blit because final result should be in dst RenderTexture
            if (oddEven)
            {
                Graphics.Blit(src, dst);
            }
        }
Exemple #3
0
        //
        public virtual void Register(HighlightingBase renderer)
        {
            if (!renderers.Contains(renderer))
            {
                renderers.Add(renderer);
            }

            enabled = renderers.Count > 0;
        }
Exemple #4
0
        //
        public virtual void Unregister(HighlightingBase renderer)
        {
            int index = renderers.IndexOf(renderer);

            if (index != -1)
            {
                renderers.RemoveAt(index);
            }

            enabled = renderers.Count > 0;
        }
        // Called once (before OnPreRender) for each camera if the object is visible
        void OnWillRenderObject()
        {
            Camera cam = Camera.current;

            // Another camera may intercept rendering and send it's own OnWillRenderObject events (i.e. water rendering),
            // so we're caching currently rendering camera only if it has HighlighterBase component
            if (HighlightingBase.IsHighlightingCamera(cam))
            {
                // VR Camera renders twice per frame (once for each eye), but OnWillRenderObject is called once so we have to cache reference to the camera
                lastCamera = cam;
            }
        }