Struct Viewport
Abstracts a viewport used for defining rendering regions.
Implements
Inherited Members
Namespace: Evergine.Common.Graphics
Assembly: Evergine.Common.dll
Syntax
public struct Viewport : IEquatable<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 minimun depth range. |
float | maxDepth | The maximun 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. |
float | y | The y. |
float | width | The width. |
float | height | The height. |
float | minDepth | The minimun depth range. |
float | maxDepth | The maximun depth range. |
Fields
DefaultHeight
The default viewport height.
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
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 max depth range.
Declaration
public float MaxDepth
Field Value
Type | Description |
---|---|
float |
MinDepth
Gets or sets the min 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 of 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 | Other used to compare. |
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 like 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 value1. |
Viewport | value2 | The value2. |
Returns
Type | Description |
---|---|
bool | The result of the operator. |
operator !=(Viewport, Viewport)
Implements the operator ==.
Declaration
public static bool operator !=(Viewport value1, Viewport value2)
Parameters
Type | Name | Description |
---|---|---|
Viewport | value1 | The value1. |
Viewport | value2 | The value2. |
Returns
Type | Description |
---|---|
bool | The result of the operator. |