XMVector3UnprojectStream function (directxmath.h)

Transforms a stream of 3D vectors from screen space to object space.

Syntax

XMFLOAT3 *XM_CALLCONV XMVector3UnprojectStream(
  [out] XMFLOAT3       *pOutputStream,
  [in]  size_t         OutputStride,
  [in]  const XMFLOAT3 *pInputStream,
  [in]  size_t         InputStride,
  [in]  size_t         VectorCount,
  [in]  float          ViewportX,
  [in]  float          ViewportY,
  [in]  float          ViewportWidth,
  [in]  float          ViewportHeight,
  [in]  float          ViewportMinZ,
  [in]  float          ViewportMaxZ,
  [in]  FXMMATRIX      Projection,
  [in]  CXMMATRIX      View,
  [in]  CXMMATRIX      World
) noexcept;

Parameters

[out] pOutputStream

Address of the first XMFLOAT3 in the destination stream.

[in] OutputStride

Stride, in bytes, between vectors in the destination stream.

[in] pInputStream

Address of the first XMFLOAT3 in the stream to be transformed. X,Y are in pixels, while Z is 0.0 (at ViewportMinZ) to 1.0 (at ViewportMaxZ).

[in] InputStride

Stride, in bytes, between vectors in the input stream.

[in] VectorCount

Number of vectors to transform.

[in] 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.

[in] 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.

[in] 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.

[in] 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.

[in] 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.0f. Clipping is performed after applying the projection matrix.

[in] 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.0f. Clipping is performed after applying the projection matrix.

[in] Projection

Projection matrix.

[in] View

View matrix.

[in] World

World matrix.

Return value

Returns the address of the first XMFLOAT3 in the destination stream.

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*480 surface, these parameters should be 0, 0, 640, and 480, respectively. The ViewportMinZ and ViewportMaxZ are typically set to 0.0f and 1.0f but can be set to other values to achieve specific effects.

Platform Requirements

Microsoft Visual Studio 2010 or Microsoft Visual Studio 2012 with the Windows SDK for Windows 8. Supported for Win32 desktop apps, Windows Store apps, and Windows Phone 8 apps.

Requirements

Requirement Value
Target Platform Windows
Header directxmath.h (include DirectXMath.h)

See also

DirectXMath Library 3D Vector Transformation Functions

XMVector3Unproject