Struct Viewport
Describes the viewport dimensions.
Assembly: FlaxEngine.dll
File: Engine/Core/Math/Viewport.h
Syntax
public struct Viewport
Constructors
Viewport()
Empty constructor.
Declaration
public Viewport() = default
Viewport(const Float2& size)
Initializes a new instance of the Viewport struct.
Declaration
public Viewport(const Float2& size)
Parameters
Float2
size
The viewport size. |
Viewport(const Rectangle& bounds)
Initializes a new instance of the Viewport struct.
Declaration
public Viewport(const Rectangle& bounds)
Parameters
Rectangle
bounds
A bounding rectangle that defines the location and size of the viewport in a render target. |
Viewport(float x, float y, float width, float height, float minDepth = 0.0f, float maxDepth=1.0f)
Initializes a new instance of the Viewport struct.
Declaration
public Viewport(float x, float y, float width, float height, float minDepth = 0.0f, float maxDepth=1.0f)
Parameters
float
x
The x coordinate of the upper-left corner of the viewport in pixels. |
float
y
The y coordinate of the upper-left corner of the viewport in pixels. |
float
width
The width of the viewport in pixels. |
float
height
The height of the viewport in pixels. |
float
minDepth
The minimum depth of the clip volume. |
float
maxDepth
The maximum depth of the clip volumes. |
Fields
Height
Declaration
public float Height
Field Value
float
|
Location
Declaration
public Float2 Location
Field Value
Float2
|
MaxDepth
Declaration
public float MaxDepth
Field Value
float
|
MinDepth
Declaration
public float MinDepth
Field Value
float
|
Size
Declaration
public Float2 Size
Field Value
Float2
|
Width
Declaration
public float Width
Field Value
float
|
X
Declaration
public float X
Field Value
float
|
Y
Declaration
public float Y
Field Value
float
|
Methods
GetAspectRatio()
Declaration
public float GetAspectRatio() const
Returns
float
|
GetBounds()
operator!=(const Viewport& other)
Declaration
public bool operator!=(const Viewport& other) const
Parameters
Viewport
other
|
Returns
bool
|
operator==(const Viewport& other)
Declaration
public bool operator==(const Viewport& other) const
Parameters
Viewport
other
|
Returns
bool
|
Project(const Vector3& source, const Matrix& vp, Vector3& result)
Projects a 3D vector from object space into screen space.
Declaration
public void Project(const Vector3& source, const Matrix& vp, Vector3& result) const
Parameters
Vector3
source
The vector to project. |
Matrix
vp
A combined WorldViewProjection matrix. |
Vector3
result
The projected vector. |
SetBounds(const Rectangle& bounds)
ToString()
Unproject(const Vector3& source, const Matrix& ivp, Vector3& result)
Converts a screen space point into a corresponding point in world space.
Declaration
public void Unproject(const Vector3& source, const Matrix& ivp, Vector3& result) const
Parameters
Vector3
source
The vector to un-project. |
Matrix
ivp
An inverted combined WorldViewProjection matrix. |
Vector3
result
The un-projected vector |