Esempio n. 1
0
        /// <summary>
        /// Applies the filter on a certain display object, rendering the output into the current render
        /// target. This method is called automatically by Sparrow's rendering system for the object the
        /// filter is attached to.
        /// </summary>
        public void RenderObject(DisplayObject obj, RenderSupport support)
        {
            // bottom layer
            if (Mode == FragmentFilterMode.Above)
            {
                obj.Render(support);
            }

            // center layer
            if (_cacheRequested)
            {
                _cacheRequested = false;
                _cache          = RenderPasses(obj, support, true);
                DisposePassTextures();
            }

            if (_cache != null)
            {
                _cache.Render(support);
            }
            else
            {
                RenderPasses(obj, support, false);
            }

            // top layer
            if (Mode == FragmentFilterMode.Below)
            {
                obj.Render(support);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Renders the current quad batch and resets it.
        /// </summary>
        public void FinishQuadBatch()
        {
            if (_quadBatchTop.NumQuads != 0)
            {
                _quadBatchTop.Render(_projectionMatrix);
                _quadBatchTop.Reset();

                if (_quadBatchSize == _quadBatchIndex + 1)
                {
                    _quadBatches.Add(new QuadBatch());
                    _quadBatchSize++;
                }

                _numDrawCalls++;
                _quadBatchTop = _quadBatches[++_quadBatchIndex];
            }
        }