private void NestedContextPassSetup( ref UIOperationContext context, ref RasterizePassSet passSet, ref ImperativeRenderer renderer, ref UIOperationContext passContext, out ImperativeRenderer contentRenderer, out RasterizePassSet childrenPassSet, out UIOperationContext contentContext, int previousStackDepth, ref int newStackDepth ) { renderer.Layer += 1; passContext.Clone(out contentContext); contentRenderer = renderer.MakeSubgroup(); if (ShouldClipContent) { newStackDepth = previousStackDepth + 1; contentRenderer.DepthStencilState = context.UIContext.GetStencilTest(newStackDepth); childrenPassSet = new RasterizePassSet(ref contentRenderer, newStackDepth, passSet.OverlayQueue); } else { contentRenderer.DepthStencilState = (previousStackDepth <= 0) ? DepthStencilState.None : context.UIContext.GetStencilTest(previousStackDepth); childrenPassSet = new RasterizePassSet(ref contentRenderer, newStackDepth, passSet.OverlayQueue); } renderer.Layer += 1; }
public override void Draw(GameTime gameTime, Frame frame) { using (var rtb = BatchGroup.ForRenderTarget(frame, -1, Rt)) { var ir = new ImperativeRenderer(rtb, Materials); ir.Clear(color: Color.Transparent); ir.SetViewport(new Rectangle(128, 128, 256, 256), true); ir.FillRectangle(new Rectangle(0, 0, 512, 512), Color.Black, customMaterial: Vpos); } { var ir = new ImperativeRenderer(frame, Materials) { AutoIncrementLayer = true }; ir.SetViewport(null, true); ir.Clear(color: Color.SteelBlue); const float scale = 0.65f; var pos = new Vector2(Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight) / 2f; ir.Draw( Texture, pos, origin: Vector2.One * 0.5f, scale: Vector2.One * scale, blendState: BlendState.Opaque, samplerState: SamplerState.LinearClamp ); ir.DrawString( Font, "Hello, World!", Vector2.Zero, blendState: BlendState.AlphaBlend, material: Materials.ScreenSpaceShadowedBitmap ); var sg = ir.MakeSubgroup(); sg.AutoIncrementLayer = true; sg.SetViewport(new Rectangle(128, 128, 512, 512), true); sg.FillRectangle(new Rectangle(0, 0, 1024, 1024), Color.Black, customMaterial: Vpos); sg.SetViewport(null, true); ir.Draw( Rt, new Vector2(1920 - 512, 0) ); } }
private void RasterizeAcceleratorOverlay(ref UIOperationContext context, ref ImperativeRenderer renderer) { var activeModal = ActiveModal; Control shiftTab = ResolveProxies(PickRotateFocusTarget(false, -1)), tab = ResolveProxies(PickRotateFocusTarget(false, 1)), ctrlShiftTab = (activeModal?.RetainFocus == true) ? null : ResolveProxies(PickRotateFocusTarget(true, -1)), ctrlTab = (activeModal?.RetainFocus == true) ? null : ResolveProxies(PickRotateFocusTarget(true, 1)); var targetGroup = renderer.MakeSubgroup(); var labelGroup = renderer.MakeSubgroup(); RasterizedOverlayBoxes.Clear(); if (Focused != null) { RasterizedOverlayBoxes.Add(new RasterizedOverlayBox { Control = Focused, ControlBox = Focused.GetRect(contentRect: true) }); } // FIXME: This looks confusing // RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, Focused, null); var topLevelSource = TopLevelFocused as IAcceleratorSource; if (topLevelSource != null) { labelGroup = renderer.MakeSubgroup(); foreach (var accel in topLevelSource.Accelerators) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, accel, true); } } RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, tab, FocusForward); if (shiftTab != tab) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, shiftTab, FocusBackward); } if ((ctrlTab != TopLevelFocused) || (ctrlShiftTab != TopLevelFocused)) { if (ctrlTab != tab) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, ctrlTab, WindowFocusForward); } if (ctrlTab != ctrlShiftTab) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, ctrlShiftTab, WindowFocusBackward); } } var focusedSource = Focused as IAcceleratorSource; if ((focusedSource != null) && (focusedSource != topLevelSource)) { labelGroup = renderer.MakeSubgroup(); foreach (var accel in focusedSource.Accelerators) { RasterizeAcceleratorOverlay(context, ref labelGroup, ref targetGroup, accel, true); } } }