Matrix.CreatePerspective Method (Single, Single, Single, Single)
Builds a perspective projection matrix and returns the result by value.
Syntax
'Declaration
Public Shared Function CreatePerspective ( _
width As Single, _
height As Single, _
nearPlaneDistance As Single, _
farPlaneDistance As Single _
) As Matrix
public static Matrix CreatePerspective (
float width,
float height,
float nearPlaneDistance,
float farPlaneDistance
)
public:
static Matrix CreatePerspective(
float width,
float height,
float nearPlaneDistance,
float farPlaneDistance
)
Parameters
- width
Type: Single
Width of the view volume at the near view plane. - height
Type: Single
Height of the view volume at the near view plane. - nearPlaneDistance
Type: Single
Distance to the near view plane. - farPlaneDistance
Type: Single
Distance to the far view plane.
Return Value
Type: Matrix
The projection matrix.
Exceptions
Exception type | Condition |
---|---|
ArgumentOutOfRangeException | One of the following conditions is true:
|
Remarks
Projection space refers to the space after applying projection transformation from view space. After the projection transformation, visible content has x- and y-coordinates ranging from −1 to 1, and a z-coordinate ranging from 0 to 1.
To obtain the viewable area (in world space) of a scene, create a BoundingFrustum and pass the combined view and projection matrix to the constructor.
Requirements
Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Reference
Matrix Structure
Matrix Members
Microsoft.Xna.Framework Namespace
Platforms
Windows Phone