Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreatePerspective() [1/2]

static Matrix Microsoft.Xna.Framework.Matrix.CreatePerspective ( float width,
float height,
float nearPlaneDistance,
float farPlaneDistance )
inlinestatic

Definition at line 920 of file Matrix.cs.

921 {
922 if (nearPlaneDistance <= 0f)
923 {
924 throw new ArgumentOutOfRangeException("nearPlaneDistance", string.Format(CultureInfo.CurrentCulture, FrameworkResources.NegativePlaneDistance, new object[1] { "nearPlaneDistance" }));
925 }
926 if (farPlaneDistance <= 0f)
927 {
928 throw new ArgumentOutOfRangeException("farPlaneDistance", string.Format(CultureInfo.CurrentCulture, FrameworkResources.NegativePlaneDistance, new object[1] { "farPlaneDistance" }));
929 }
930 if (nearPlaneDistance >= farPlaneDistance)
931 {
932 throw new ArgumentOutOfRangeException("nearPlaneDistance", FrameworkResources.OppositePlanes);
933 }
934 Matrix result = default(Matrix);
935 result.M11 = 2f * nearPlaneDistance / width;
936 result.M12 = (result.M13 = (result.M14 = 0f));
937 result.M22 = 2f * nearPlaneDistance / height;
938 result.M21 = (result.M23 = (result.M24 = 0f));
939 result.M33 = farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
940 result.M31 = (result.M32 = 0f);
941 result.M34 = -1f;
942 result.M41 = (result.M42 = (result.M44 = 0f));
943 result.M43 = nearPlaneDistance * farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
944 return result;
945 }
static CultureInfo CurrentCulture
Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
Definition Matrix.cs:210

References System.Globalization.CultureInfo.CurrentCulture, System.Globalization.Format, Microsoft.Xna.Framework.FrameworkResources.NegativePlaneDistance, and Microsoft.Xna.Framework.FrameworkResources.OppositePlanes.