Implements abstract Effect
Example #1
0
        /// <summary>
        /// Begins the clipped rendering with custom effect
        /// </summary>
        /// <param name="clipRect">The clip rect.</param>
        /// <param name="effect">The effect.</param>
        public override void BeginClipped(Rect clipRect, EffectBase effect)
        {
            clipRectangle.X = (int)clipRect.X;
            clipRectangle.Y = (int)clipRect.Y;
            clipRectangle.Width = (int)clipRect.Width;
            clipRectangle.Height = (int)clipRect.Height;

            UpdateCurrentEffect(effect);

            BeginClipped(clipRectangle);
        }
Example #2
0
        private void UpdateCurrentEffect(EffectBase effect)
        {
            Effect effectInstance = effect != null ? effect.GetNativeEffect() as Effect : null;
            if (effectInstance != null)
            {
                if (currentActiveEffect != null)
                {
                    activeEffects.Push(currentActiveEffect);
                }

                currentActiveEffect = effectInstance;
            }

            if (currentActiveEffect == null && activeEffects.Count > 0)
            {
                currentActiveEffect = activeEffects.Pop();
            }
        }
Example #3
0
        /// <summary>
        /// Begins the rendering with custom effect
        /// </summary>
        /// <param name="effect">The effect.</param>
        public override void Begin(EffectBase effect)
        {
            isClipped = false;
            isSpriteRenderInProgress = true;
            UpdateCurrentEffect(effect);
            if (previousState != null)
            {
                spriteBatch.GraphicsDevice.RasterizerState = previousState;
                previousState = null;
            }

            if (clipRectanges.Count == 0)
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, currentActiveEffect);
            }
            else
            {
                Rectangle previousClip = clipRectanges.Pop();
                BeginClipped(previousClip);
            }
        }
Example #4
0
        /// <summary>
        /// Begins the rendering with custom effect
        /// </summary>
        /// <param name="effect"></param>
        public override void Begin(EffectBase effect)
        {
            isClipped = false;
            isSpriteRenderInProgress = true;
            UpdateCurrentEffect(effect);

            if (clipRectanges.Count == 0)
            {
                spriteBatch.Begin(graphicsContext, SpriteSortMode.Deferred, depthStencilState: DepthStencilStates.None, effect: currentActiveEffect);
            }
            else
            {
                Rectangle previousClip = clipRectanges.Pop();
                BeginClipped(previousClip);
            }
        }
Example #5
0
        /// <summary>
        /// Begins the rendering with custom effect
        /// </summary>
        /// <param name="effect">The effect.</param>
        public override void Begin(EffectBase effect)
        {
            isClipped = false;
            isSpriteRenderInProgress = true;
            UpdateCurrentEffect(effect);
            if (previousState != null)
            {
                spriteBatch.GraphicsDevice.RasterizerState = previousState;
                previousState = null;
            }

            if (clipRectanges.Count == 0)
            {
                spriteBatch.Begin(effect: currentActiveEffect);
            }
            else
            {
                Rectangle previousClip = clipRectanges.Pop();
                BeginClipped(previousClip);
            }
        }
Example #6
0
 /// <summary>
 /// Begins the clipped rendering with custom effect
 /// </summary>
 /// <param name="clipRect">The clip rect.</param>
 /// <param name="effect">The effect.</param>
 public abstract void BeginClipped(Rect clipRect, EffectBase effect);
Example #7
0
 /// <summary>
 /// Begins the rendering with custom effect
 /// </summary>
 /// <param name="effect">The effect.</param>
 public abstract void Begin(EffectBase effect);