Search Results for

    Show / Hide Table of Contents

    Class Viewport

    Defines the viewport dimensions using float coordinates for (X,Y,Width,Height).

    Inheritance
    System.Object
    Viewport
    Implements
    System.IEquatable<Viewport>
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    public sealed class Viewport : ValueType, IEquatable<Viewport>

    Constructors

    Viewport(Float2, Float2)

    Initializes a new instance of the Viewport struct.

    Declaration
    public Viewport(Float2 location, Float2 size)
    Parameters
    Float2 location

    The location of the upper-left corner of the viewport in pixels.

    Float2 size

    The size of the viewport in pixels.

    Viewport(Rectangle)

    Initializes a new instance of the Viewport struct.

    Declaration
    public Viewport(Rectangle bounds)
    Parameters
    Rectangle bounds

    A bounding box that defines the location and size of the viewport in a render target.

    Viewport(Single, Single, Single, Single)

    Initializes a new instance of the Viewport struct.

    Declaration
    public Viewport(float x, float y, float width, float height)
    Parameters
    System.Single x

    The x coordinate of the upper-left corner of the viewport in pixels.

    System.Single y

    The y coordinate of the upper-left corner of the viewport in pixels.

    System.Single width

    The width of the viewport in pixels.

    System.Single height

    The height of the viewport in pixels.

    Viewport(Single, Single, Single, Single, Single, Single)

    Initializes a new instance of the Viewport struct.

    Declaration
    public Viewport(float x, float y, float width, float height, float minDepth, float maxDepth)
    Parameters
    System.Single x

    The x coordinate of the upper-left corner of the viewport in pixels.

    System.Single y

    The y coordinate of the upper-left corner of the viewport in pixels.

    System.Single width

    The width of the viewport in pixels.

    System.Single height

    The height of the viewport in pixels.

    System.Single minDepth

    The minimum depth of the clip volume.

    System.Single maxDepth

    The maximum depth of the clip volume.

    Fields

    Height

    Height dimension of the viewport.

    Declaration
    public float Height
    Field Value
    System.Single

    MaxDepth

    Gets or sets the maximum depth of the clip volume.

    Declaration
    public float MaxDepth
    Field Value
    System.Single

    MinDepth

    Gets or sets the minimum depth of the clip volume.

    Declaration
    public float MinDepth
    Field Value
    System.Single

    Width

    Width dimension of the viewport.

    Declaration
    public float Width
    Field Value
    System.Single

    X

    Position of the pixel coordinate of the upper-left corner of the viewport.

    Declaration
    public float X
    Field Value
    System.Single

    Y

    Position of the pixel coordinate of the upper-left corner of the viewport.

    Declaration
    public float Y
    Field Value
    System.Single

    Properties

    AspectRatio

    Gets the aspect ratio used by the viewport.

    Declaration
    public float AspectRatio { get; }
    Property Value
    System.Single

    Bounds

    Gets the size of the viewport.

    Declaration
    public Rectangle Bounds { get; set; }
    Property Value
    Rectangle

    The bounds.

    Size

    Gets or sets the size of the viewport (width and height).

    Declaration
    public Float2 Size { get; set; }
    Property Value
    Float2

    Methods

    Equals(Viewport)

    Determines whether the specified Viewport is equal to this instance.

    Declaration
    public bool Equals(Viewport other)
    Parameters
    Viewport other

    The Viewport to compare with this instance.

    Returns
    System.Boolean

    true if the specified Viewport is equal to this instance; otherwise, false.

    Equals(ref Viewport)

    Determines whether the specified Viewport is equal to this instance.

    Declaration
    public bool Equals(ref Viewport other)
    Parameters
    Viewport other

    The Viewport to compare with this instance.

    Returns
    System.Boolean

    true if the specified Viewport is equal to this instance; otherwise, false.

    Equals(Object)

    Determines whether the specified object is equal to this instance.

    Declaration
    public override bool Equals(object obj)
    Parameters
    System.Object obj

    The object to compare with this instance.

    Returns
    System.Boolean

    true if the specified object is equal to this instance; otherwise, false.

    GetHashCode()

    Returns a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    System.Int32

    A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

    Project(Vector3, Matrix, Matrix, Matrix)

    Projects a 3D vector from object space into screen space.

    Declaration
    public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
    Parameters
    Vector3 source

    The vector to project.

    Matrix projection

    The projection matrix.

    Matrix view

    The view matrix.

    Matrix world

    The world matrix.

    Returns
    Vector3

    The projected vector.

    Project(ref Vector3, ref Matrix, out Vector3)

    Projects a 3D vector from object space into screen space.

    Declaration
    public void Project(ref Vector3 source, ref Matrix matrix, out Vector3 vector)
    Parameters
    Vector3 source

    The vector to project.

    Matrix matrix

    A combined WorldViewProjection matrix.

    Vector3 vector

    The projected vector.

    ToString()

    Retrieves a string representation of this object.

    Declaration
    public override string ToString()
    Returns
    System.String

    A System.String that represents this instance.

    Unproject(Vector3, Matrix, Matrix, Matrix)

    Converts a screen space point into a corresponding point in world space.

    Declaration
    public Vector3 Unproject(Vector3 source, Matrix projection, Matrix view, Matrix world)
    Parameters
    Vector3 source

    The vector to project.

    Matrix projection

    The projection matrix.

    Matrix view

    The view matrix.

    Matrix world

    The world matrix.

    Returns
    Vector3

    The unprojected Vector.

    Unproject(ref Vector3, ref Matrix, out Vector3)

    Converts a screen space point into a corresponding point in world space.

    Declaration
    public void Unproject(ref Vector3 source, ref Matrix matrix, out Vector3 vector)
    Parameters
    Vector3 source

    The vector to project.

    Matrix matrix

    An inverted combined WorldViewProjection matrix.

    Vector3 vector

    The unprojected vector.

    Operators

    Equality(Viewport, Viewport)

    Implements the operator ==.

    Declaration
    public static bool operator ==(Viewport left, Viewport right)
    Parameters
    Viewport left

    The left.

    Viewport right

    The right.

    Returns
    System.Boolean

    The result of the operator.

    Inequality(Viewport, Viewport)

    Implements the operator !=.

    Declaration
    public static bool operator !=(Viewport left, Viewport right)
    Parameters
    Viewport left

    The left.

    Viewport right

    The right.

    Returns
    System.Boolean

    The result of the operator.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat