Struct Viewport
Abstracts a viewport used to define rendering regions.
Namespace: Evergine.Common.Graphics
Assembly: Evergine.Common.dll
Syntax
public struct Viewport
Constructors
Viewport(Rectangle, float, float)
Initializes a new instance of the Viewport struct.
Declaration
public Viewport(Rectangle rectangle, float minDepth = 0, float maxDepth = 1)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle | The viewport rectangle. |
float | minDepth | The minimum depth range. |
float | maxDepth | The maximum depth range. |
Viewport(float, float, float, float, float, float)
Initializes a new instance of the Viewport struct.
Declaration
public Viewport(float x, float y, float width, float height, float minDepth = 0, float maxDepth = 1)
Parameters
Type | Name | Description |
---|---|---|
float | x | The x-coordinate. |
float | y | The y-coordinate. |
float | width | The width. |
float | height | The height. |
float | minDepth | The minimum depth range. |
float | maxDepth | The maximum depth range. |
Fields
DefaultHeight
The default height of the viewport.
Declaration
public static float DefaultHeight
Field Value
Type | Description |
---|---|
float |
DefaultWidth
The default viewport width.
Declaration
public static float DefaultWidth
Field Value
Type | Description |
---|---|
float |
Empty
Represents an empty value for an undefined viewport.
Declaration
public static readonly Viewport Empty
Field Value
Type | Description |
---|---|
Viewport |
Height
Gets or sets the height of the viewport.
Declaration
public float Height
Field Value
Type | Description |
---|---|
float |
MaxDepth
Gets or sets the maximum depth range.
Declaration
public float MaxDepth
Field Value
Type | Description |
---|---|
float |
MinDepth
Gets or sets the minimum depth range.
Declaration
public float MinDepth
Field Value
Type | Description |
---|---|
float |
Width
Gets or sets the width of the viewport.
Declaration
public float Width
Field Value
Type | Description |
---|---|
float |
X
Gets or sets the X origin of the viewport.
Declaration
public float X
Field Value
Type | Description |
---|---|
float |
Y
Gets or sets the Y origin of the viewport.
Declaration
public float Y
Field Value
Type | Description |
---|---|
float |
Properties
AspectRatio
Gets the aspect ratio used for this viewport.
Declaration
public float AspectRatio { get; }
Property Value
Type | Description |
---|---|
float |
Bounds
Gets the rectangle of the viewport.
Declaration
public Rectangle Bounds { get; }
Property Value
Type | Description |
---|---|
Rectangle |
Size
Gets the size of the viewport.
Declaration
public Vector2 Size { get; }
Property Value
Type | Description |
---|---|
Vector2 |
Methods
Equals(Viewport)
Returns a hash code for this instance.
Declaration
public bool Equals(Viewport other)
Parameters
Type | Name | Description |
---|---|---|
Viewport | other | Instance used for comparison. |
Returns
Type | Description |
---|---|
bool | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Equals(object)
Determines whether the specified object is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with this instance. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for this instance, suitable for use in hashing algorithms and data structures such as a hash table. |
Overrides
Operators
operator ==(Viewport, Viewport)
Implements the operator ==.
Declaration
public static bool operator ==(Viewport value1, Viewport value2)
Parameters
Type | Name | Description |
---|---|---|
Viewport | value1 | The first value. |
Viewport | value2 | The second value. |
Returns
Type | Description |
---|---|
bool | The result of the operation. |
operator !=(Viewport, Viewport)
Implements the operator ==.
Declaration
public static bool operator !=(Viewport value1, Viewport value2)
Parameters
Type | Name | Description |
---|---|---|
Viewport | value1 | The first value. |
Viewport | value2 | The second value. |
Returns
Type | Description |
---|---|
bool | The result of the operation. |