Struct ViewportF
- Namespace
- HelixToolkit.Maths
- Assembly
- HelixToolkit.Maths.dll
Defines the viewport dimensions using float coordinates for (X,Y,Width,Height).
public struct ViewportF : IEquatable<ViewportF>
- Implements
- Inherited Members
- Extension Methods
Constructors
ViewportF(RectangleF)
Initializes a new instance of the ViewportF struct.
public ViewportF(RectangleF bounds)
Parameters
boundsRectangleFA bounding box that defines the location and size of the viewport in a render target.
ViewportF(float, float, float, float)
Initializes a new instance of the ViewportF struct.
public ViewportF(float x, float y, float width, float height)
Parameters
xfloatThe x coordinate of the upper-left corner of the viewport in pixels.
yfloatThe y coordinate of the upper-left corner of the viewport in pixels.
widthfloatThe width of the viewport in pixels.
heightfloatThe height of the viewport in pixels.
ViewportF(float, float, float, float, float, float)
Initializes a new instance of the ViewportF struct.
public ViewportF(float x, float y, float width, float height, float minDepth, float maxDepth)
Parameters
xfloatThe x coordinate of the upper-left corner of the viewport in pixels.
yfloatThe y coordinate of the upper-left corner of the viewport in pixels.
widthfloatThe width of the viewport in pixels.
heightfloatThe height of the viewport in pixels.
minDepthfloatThe minimum depth of the clip volume.
maxDepthfloatThe maximum depth of the clip volume.
Fields
Height
Height dimension of the viewport.
public float Height
Field Value
MaxDepth
Gets or sets the maximum depth of the clip volume.
public float MaxDepth
Field Value
MinDepth
Gets or sets the minimum depth of the clip volume.
public float MinDepth
Field Value
Width
Width dimension of the viewport.
public float Width
Field Value
X
Position of the pixel coordinate of the upper-left corner of the viewport.
public float X
Field Value
Y
Position of the pixel coordinate of the upper-left corner of the viewport.
public float Y
Field Value
Properties
AspectRatio
Gets the aspect ratio used by the viewport.
public readonly float AspectRatio { get; }
Property Value
- float
The aspect ratio.
Bounds
Gets the size of this resource.
public RectangleF Bounds { readonly get; set; }
Property Value
- RectangleF
The bounds.
Methods
Equals(ViewportF)
Determines whether the specified ViewportF is equal to this instance.
public readonly bool Equals(ViewportF other)
Parameters
Returns
Equals(ref ViewportF)
Determines whether the specified ViewportF is equal to this instance.
public readonly bool Equals(ref ViewportF other)
Parameters
Returns
Equals(object?)
Determines whether the specified object is equal to this instance.
public override readonly bool Equals(object? obj)
Parameters
objobjectThe object to compare with this instance.
Returns
- bool
trueif the specified object is equal to this instance; otherwise,false.
GetHashCode()
Returns a hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Project(Vector3, Matrix4x4, Matrix4x4, Matrix4x4)
Projects a 3D vector from object space into screen space.
public readonly Vector3 Project(Vector3 source, Matrix4x4 projection, Matrix4x4 view, Matrix4x4 world)
Parameters
sourceVector3The vector to project.
projectionMatrix4x4The projection matrix.
viewMatrix4x4The view matrix.
worldMatrix4x4The world matrix.
Returns
- Vector3
The projected vector.
Project(ref Vector3, ref Matrix4x4, out Vector3)
Projects a 3D vector from object space into screen space.
public readonly void Project(ref Vector3 source, ref Matrix4x4 matrix, out Vector3 vector)
Parameters
sourceVector3The vector to project.
matrixMatrix4x4A combined WorldViewProjection matrix.
vectorVector3The projected vector.
ToString()
Retrieves a string representation of this object.
public override readonly string ToString()
Returns
Unproject(Vector3, Matrix4x4, Matrix4x4, Matrix4x4)
Converts a screen space point into a corresponding point in world space.
public readonly Vector3 Unproject(Vector3 source, Matrix4x4 projection, Matrix4x4 view, Matrix4x4 world)
Parameters
sourceVector3The vector to project.
projectionMatrix4x4The projection matrix.
viewMatrix4x4The view matrix.
worldMatrix4x4The world matrix.
Returns
- Vector3
The unprojected Vector.
Unproject(ref Vector3, ref Matrix4x4, out Vector3)
Converts a screen space point into a corresponding point in world space.
public readonly void Unproject(ref Vector3 source, ref Matrix4x4 matrix, out Vector3 vector)
Parameters
sourceVector3The vector to project.
matrixMatrix4x4An inverted combined WorldViewProjection matrix.
vectorVector3The unprojected vector.
Operators
operator ==(ViewportF, ViewportF)
Implements the operator ==.
public static bool operator ==(ViewportF left, ViewportF right)
Parameters
Returns
- bool
The result of the operator.
implicit operator ViewportF(Viewport)
public static implicit operator ViewportF(Viewport value)
Parameters
valueViewportThe value.
Returns
- ViewportF
The result of the conversion.
operator !=(ViewportF, ViewportF)
Implements the operator !=.
public static bool operator !=(ViewportF left, ViewportF right)
Parameters
Returns
- bool
The result of the operator.