/// <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); }
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(); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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);
/// <summary> /// Begins the rendering with custom effect /// </summary> /// <param name="effect">The effect.</param> public abstract void Begin(EffectBase effect);