10internal sealed class RenderContext
12 [ThreadStatic]
private static RenderContext? _current;
13 private static long _nextPassId;
15 internal static RenderContext? Current => _current;
17 private readonly RenderContext? _prior;
19 private RenderContext(View view,
long tick, RenderContext? prior)
21 PassId = System.Threading.Interlocked.Increment(ref _nextPassId);
32 ViewEffectOffsetFactor = view.EffectOffsetFactor;
33 ViewEffectOffsetPx = view.EffectOffsetPx;
36 ViewportZoom = (z > 0f) ? z : 1f;
41 internal long PassId {
get; }
42 internal View View {
get; }
43 internal long Tick {
get; }
44 internal System.Drawing.PointF CameraPositionPx {
get; }
45 internal System.Drawing.Rectangle ViewportTargetRectPx {
get; }
46 internal System.Drawing.PointF ViewportScreenOffsetPx {
get; }
47 internal float ViewportZoom {
get; }
48 internal System.Drawing.PointF ViewEffectOffsetFactor {
get; }
49 internal System.Drawing.PointF ViewEffectOffsetPx {
get; }
51 internal static void Push(View view,
long tick)
53 _current =
new RenderContext(view, tick, _current);
56 internal static void Pop()
58 _current = _current?._prior;
PointF PositionPx
Gets or sets the camera's world-space position in pixels, interpreted as the upper-left corner of the...
Camera Camera
Gets the camera that controls the world-space position and following behavior for this view....
Viewport Viewport
Gets the viewport that defines the screen-space rectangle, zoom level, and other rendering parameters...
Rectangle TargetRectPx
Screen-space rectangle (in SCREEN / RenderSurface pixels) where this view is drawn....
PointF ScreenOffsetPx
Optional per-view HUD/safe-area offset in screen pixels.
float Zoom
Zoom factor applied to the world when rendering this view. Values greater than 1 zoom in,...