Represents a rendered view of a scene, combining a camera position with a viewport configuration to control what portion of the world is visible and how it is displayed on screen. Multiple views can be used to create split-screen, picture-in-picture, or other multi-viewport rendering scenarios.
More...
|
| void | ZoomAroundScreenPoint (SceneLayer layer, PointF screenPoint, float targetZoom, float durationSeconds) |
| | Zooms the view around a screen-space point while keeping the world point beneath that location fixed throughout the operation.
|
| PointF | ScreenPxToWorldPx (SceneLayer layer, PointF screenPx) |
| | Converts a screen-space pixel position into world-space coordinates for the specified scene layer, accounting for the view's camera position, viewport zoom, screen offsets, and the layer's parallax factor.
|
| PointF | WorldPxToScreenPx (SceneLayer layer, PointF worldPx) |
| | Converts a world-space pixel position into screen-space coordinates for this view, accounting for the camera position, viewport zoom, screen offsets, and the specified layer's parallax factor.
|
| PointF | ScreenPxToGrid (SceneLayer layer, PointF screenPx) |
| | Converts a point in screen-space into the grid coordinate on the specified SceneLayer by first mapping the screen pixel to world-space, then letting the layer's coordinate system resolve the corresponding tile.
|
| RectangleF | WorldRectToScreenRect (SceneLayer layer, RectangleF worldRect) |
| | Converts a world-space pixel rectangle into a screen-space rectangle for this View, using the specified layer's parallax factor.
|
| RectangleF | ScreenRectToWorldRect (SceneLayer layer, RectangleF screenRect) |
| | Converts a screen-space rectangle (on the logical Backbuffer) into a world-space rectangle for the given layer, respecting zoom, camera position, viewport offsets, and the layer's parallax factor.
|
|
| Guid | Id = Guid.NewGuid() [get] |
| | Gets the unique identifier for this view instance.
|
| Camera | Camera [get] |
| | Gets the camera that controls the world-space position and following behavior for this view. The camera determines which part of the world is visible.
|
| Viewport | Viewport [get] |
| | Gets the viewport that defines the screen-space rectangle, zoom level, and other rendering parameters for this view. The viewport controls how the camera's visible world region is mapped to screen pixels.
|
| int | ZOrder = 0 [get, set] |
| | Controls the draw order of this view relative to other views. Lower values are drawn first (behind); higher values are drawn later (in front).
|
| float | MinZoom = 0.1f [get, set] |
| | Gets or sets the minimum zoom level allowed for this View.
|
| float | MaxZoom = 8f [get, set] |
| | Gets or sets the maximum zoom level allowed for this View.
|
Represents a rendered view of a scene, combining a camera position with a viewport configuration to control what portion of the world is visible and how it is displayed on screen. Multiple views can be used to create split-screen, picture-in-picture, or other multi-viewport rendering scenarios.
Definition at line 13 of file View.cs.
◆ ScreenPxToGrid()
| PointF Gondwana.Rendering.Views.View.ScreenPxToGrid |
( |
SceneLayer | layer, |
|
|
PointF | screenPx ) |
Converts a point in screen-space into the grid coordinate on the specified SceneLayer by first mapping the screen pixel to world-space, then letting the layer's coordinate system resolve the corresponding tile.
- Parameters
-
| layer | The SceneLayer whose grid the point should be mapped onto. |
| screenPx | The pixel position relative to the RenderSurface. |
- Returns
- The grid coordinate (column/row or axial) under the screen pixel.
Definition at line 308 of file View.cs.
◆ ScreenPxToWorldPx()
| PointF Gondwana.Rendering.Views.View.ScreenPxToWorldPx |
( |
SceneLayer | layer, |
|
|
PointF | screenPx ) |
Converts a screen-space pixel position into world-space coordinates for the specified scene layer, accounting for the view's camera position, viewport zoom, screen offsets, and the layer's parallax factor.
- Parameters
-
| layer | The scene layer whose parallax factor should be used for the conversion. |
| screenPx | The screen-space pixel position relative to the render surface. |
- Returns
- The corresponding world-space pixel position.
The transformation formula is:
world = camera * parallax + (screen - offset) / zoom
This is commonly used for mouse picking and screen-to-world raycasting.
Definition at line 233 of file View.cs.
◆ ScreenRectToWorldRect()
| RectangleF Gondwana.Rendering.Views.View.ScreenRectToWorldRect |
( |
SceneLayer | layer, |
|
|
RectangleF | screenRect ) |
Converts a screen-space rectangle (on the logical Backbuffer) into a world-space rectangle for the given layer, respecting zoom, camera position, viewport offsets, and the layer's parallax factor.
Inverse of: screen = offset + (world - camera * p) * zoom
- Parameters
-
| layer | The layer. |
| screenRect | The rectangle in logical backbuffer screen pixels. |
- Returns
- The rectangle in the specified layer's world-pixel coordinate space.
Definition at line 371 of file View.cs.
◆ WorldPxToScreenPx()
| PointF Gondwana.Rendering.Views.View.WorldPxToScreenPx |
( |
SceneLayer | layer, |
|
|
PointF | worldPx ) |
Converts a world-space pixel position into screen-space coordinates for this view, accounting for the camera position, viewport zoom, screen offsets, and the specified layer's parallax factor.
- Parameters
-
| layer | The scene layer whose parallax factor should be used for the conversion. |
| worldPx | The world-space pixel position to convert. |
- Returns
- The corresponding screen-space pixel position on the render surface.
The transformation formula is:
screen = offset + (world - camera * parallax) * zoom
This is commonly used for rendering world objects to screen coordinates and for UI elements that track world positions.
Definition at line 278 of file View.cs.
◆ WorldRectToScreenRect()
| RectangleF Gondwana.Rendering.Views.View.WorldRectToScreenRect |
( |
SceneLayer | layer, |
|
|
RectangleF | worldRect ) |
Converts a world-space pixel rectangle into a screen-space rectangle for this View, using the specified layer's parallax factor.
Matches the render path: screen = offset + (world - camera * parallax) * zoom
- Parameters
-
| layer | Scene layer whose parallax should be applied. |
| worldRect | World-space rectangle (in pixels). |
- Returns
- Screen-space rectangle on the render surface.
Definition at line 324 of file View.cs.
◆ ZoomAroundScreenPoint()
| void Gondwana.Rendering.Views.View.ZoomAroundScreenPoint |
( |
SceneLayer | layer, |
|
|
PointF | screenPoint, |
|
|
float | targetZoom, |
|
|
float | durationSeconds ) |
Zooms the view around a screen-space point while keeping the world point beneath that location fixed throughout the operation.
- Parameters
-
| layer | Reference layer whose parallax factor is used for the world-space transform. Typically the main gameplay layer (parallax = 1). |
| screenPoint | Mouse position in logical Backbuffer ScreenPx, after adapter input normalization. |
| targetZoom | Desired zoom factor after the animation completes. |
| durationSeconds | Duration in seconds for the zoom animation. Values <= 0 snap immediately. |
During a smooth zoom, the viewport zoom is animated and the camera position is recomputed after every intermediate zoom update. This prevents the anchor point from drifting while zoom and camera movement are in progress.
Definition at line 110 of file View.cs.
◆ Camera
| Camera Gondwana.Rendering.Views.View.Camera |
|
get |
Gets the camera that controls the world-space position and following behavior for this view. The camera determines which part of the world is visible.
The Views.Camera instance associated with this view.
Definition at line 34 of file View.cs.
◆ Id
| Guid Gondwana.Rendering.Views.View.Id = Guid.NewGuid() |
|
get |
Gets the unique identifier for this view instance.
A GUID that uniquely identifies this view throughout its lifetime.
Definition at line 25 of file View.cs.
◆ MaxZoom
| float Gondwana.Rendering.Views.View.MaxZoom = 8f |
|
getset |
Gets or sets the maximum zoom level allowed for this View.
Definition at line 60 of file View.cs.
◆ MinZoom
| float Gondwana.Rendering.Views.View.MinZoom = 0.1f |
|
getset |
Gets or sets the minimum zoom level allowed for this View.
Definition at line 55 of file View.cs.
◆ Viewport
| Viewport Gondwana.Rendering.Views.View.Viewport |
|
get |
Gets the viewport that defines the screen-space rectangle, zoom level, and other rendering parameters for this view. The viewport controls how the camera's visible world region is mapped to screen pixels.
The Views.Viewport instance associated with this view.
Definition at line 44 of file View.cs.
◆ ZOrder
| int Gondwana.Rendering.Views.View.ZOrder = 0 |
|
getset |
Controls the draw order of this view relative to other views. Lower values are drawn first (behind); higher values are drawn later (in front).
Definition at line 50 of file View.cs.