11 internal IDrawable Owner {
get; } = owner;
13 internal PointF Offset {
get; } = offset;
17 public Guid Id => Owner.Id;
21 public string? Nickname => Owner.Nickname;
25 public bool Visible => Owner.Visible;
29 public int ZOrder => Owner.ZOrder;
35 public RectangleF GetDrawLocationScreen(View view)
37 using var scope =
Enter(view);
38 return Owner.GetDrawLocationScreen(view);
45 public void Draw(BackbufferBase backbuffer, RectangleF destRectScreen) => Owner.Draw(backbuffer, destRectScreen);
47 [ThreadStatic]
private static WrappedDrawable? _current;
48 [ThreadStatic]
private static View? _view;
49 internal static PointF ScreenOffset(View view, SceneLayer layer)
51 if (_current is
null || !ReferenceEquals(_view, view) || !ReferenceEquals(_current.Layer, layer))
53 float zoom = Gondwana.Rendering.RenderContext.Current?.ViewportZoom ?? view.
Viewport.
Zoom;
54 return new(_current.Offset.X * zoom, _current.Offset.Y * zoom);
56 internal IDisposable
Enter(View view) =>
new Scope(
this, view);
57 private sealed class Scope : IDisposable
59 private readonly WrappedDrawable? _prior = _current;
60 private readonly
View? _priorView = _view;
61 internal Scope(WrappedDrawable instance, View view) { _current = instance; _view = view; }
65 public void Dispose() { _current = _prior; _view = _priorView; }
Viewport Viewport
Gets the viewport that defines the screen-space rectangle, zoom level, and other rendering parameters...
float Zoom
Zoom factor applied to the world when rendering this view. Values greater than 1 zoom in,...
Represents an object that can be drawn on a visual surface, with properties for visibility and stacki...
@ SceneLayer
Performs direct drawing within a scene layer using world-space coordinates.