The center point of the viewport.
Computes a rectangle that is scaled correctly to be drawn within the viewport.
The image to be drawn.
A rectangle.
Transforms a normalized device coordinate to a 2D point within the viewport.
A 2D point in NDC.
A 2D point in the coordinate space of the viewport.
Transforms a point in viewport coordinate space to a point in a frame's coordinate space.
A point in viewport coordinate space.
An image of a frame.
A point in the coordinate space of the frame.
Transforms a point in viewport coordinates to a ray.
For perspective cameras, the returned ray will have an origin that is at the position of the camera with a direction that is pointing into world space away from the camera.
For orthographic cameras, the returned ray will have an origin that is at the world point of viewport coordinate with a direction that is pointing into world space away from the camera.
A point in viewport coordinates.
An image of a frame.
A camera used to determine orientation of the scene.
A ray
Transforms a point in viewport coordinates to a point in world space coordinates. This method expects a depth buffer in order to compute a value for the Z axis.
A point in viewport coordinates.
A depth buffer for computing the Z axis.
A fallback value if the depth is the max depth value, or cannot be determined.
Maps a screen point to normalized device coordinates (NDC). A screen point at 0,0 represents the top-left of the viewport.
A screen point.
Transforms a normalized device coordinate to a 2D point within the viewport.
A 3D point in NDC.
A 2D point in the coordinate space of the viewport.
Transforms a world point to 2D point in viewport space.
The world point to transform.
The projection matrix to transform a 3D point to 2D point.
A point in viewport space.
Returns a new viewport with the given dimensions.
The dimensions of the viewport
A new viewport.
A
Viewport
represents the drawing area in the viewer.When a frame is received from the rendering pipeline, it might not be the same dimensions of the viewport because of an interactive frame or because of bandwidth limitations or other performance reasons.
The viewport contains methods to scale an image to the viewport, as well as translate 2D coordinates between the viewport and the frame.