Function directx_math::XMVector3Unproject[][src]

pub fn XMVector3Unproject(
    V: FXMVECTOR,
    ViewportX: f32,
    ViewportY: f32,
    ViewportWidth: f32,
    ViewportHeight: f32,
    ViewportMinZ: f32,
    ViewportMaxZ: f32,
    Projection: FXMMATRIX,
    View: CXMMATRIX<'_>,
    World: CXMMATRIX<'_>
) -> FXMVECTOR

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

Parameters

V 3D vector in screen space that will be projected into object space. X and Y are in pixels, while Z is 0.0 (at ViewportMinZ) to 1.0 (at ViewportMaxZ).

ViewportX Pixel coordinate of the upper-left corner of the viewport. Unless you want to render to a subset of the surface, this parameter can be set to 0.

ViewportY Pixel coordinate of the upper-left corner of the viewport on the render-target surface. Unless you want to render to a subset of the surface, this parameter can be set to 0.

ViewportWidth Width dimension of the clip volume, in pixels. Unless you are rendering only to a subset of the surface, this parameter should be set to the width dimension of the render-target surface.

ViewportHeight Height dimension of the clip volume, in pixels. Unless you are rendering only to a subset of the surface, this parameter should be set to the height dimension of the render-target surface.

ViewportMinZ Together with ViewportMaxZ, value describing the range of depth values into which a scene is to be rendered, the minimum and maximum values of the clip volume. Most applications set this value to 0.0. Clipping is performed after applying the projection matrix.

ViewportMaxZ Together with MinZ, value describing the range of depth values into which a scene is to be rendered, the minimum and maximum values of the clip volume. Most applications set this value to 1.0. Clipping is performed after applying the projection matrix.

Projection Projection matrix.

View View matrix.

World World matrix.

Return value

Returns a vector in object space.

Remarks

The ViewportX, ViewportY, ViewportWidth, and ViewportHeight parameters describe the position and dimensions of the viewport on the render-target surface. Usually, applications render to the entire target surface; when rendering on a 640*480surface, these parameters should be0, 0, 640, and 480, respectively. The ViewportMinZandViewportMaxZare typically set to0.0and1.0` but can be set to other values to achieve specific effects.

Reference

https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-XMVector3Unproject