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

◆ CreatePerspectiveFieldOfView() [2/2]

static void Microsoft.Xna.Framework.Matrix.CreatePerspectiveFieldOfView ( float fieldOfView,
float aspectRatio,
float nearPlaneDistance,
float farPlaneDistance,
out Matrix result )
inlinestatic

Definition at line 889 of file Matrix.cs.

890 {
891 if (fieldOfView <= 0f || fieldOfView >= (float)Math.PI)
892 {
893 throw new ArgumentOutOfRangeException("fieldOfView", string.Format(CultureInfo.CurrentCulture, FrameworkResources.OutRangeFieldOfView, new object[1] { "fieldOfView" }));
894 }
895 if (nearPlaneDistance <= 0f)
896 {
897 throw new ArgumentOutOfRangeException("nearPlaneDistance", string.Format(CultureInfo.CurrentCulture, FrameworkResources.NegativePlaneDistance, new object[1] { "nearPlaneDistance" }));
898 }
899 if (farPlaneDistance <= 0f)
900 {
901 throw new ArgumentOutOfRangeException("farPlaneDistance", string.Format(CultureInfo.CurrentCulture, FrameworkResources.NegativePlaneDistance, new object[1] { "farPlaneDistance" }));
902 }
903 if (nearPlaneDistance >= farPlaneDistance)
904 {
905 throw new ArgumentOutOfRangeException("nearPlaneDistance", FrameworkResources.OppositePlanes);
906 }
907 float num = 1f / (float)Math.Tan(fieldOfView * 0.5f);
908 float m = num / aspectRatio;
909 result.M11 = m;
910 result.M12 = (result.M13 = (result.M14 = 0f));
911 result.M22 = num;
912 result.M21 = (result.M23 = (result.M24 = 0f));
913 result.M31 = (result.M32 = 0f);
914 result.M33 = farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
915 result.M34 = -1f;
916 result.M41 = (result.M42 = (result.M44 = 0f));
917 result.M43 = nearPlaneDistance * farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
918 }
static CultureInfo CurrentCulture
static double Tan(double a)
const double PI
Definition Math.cs:16

References System.Globalization.CultureInfo.CurrentCulture, System.Globalization.Format, Microsoft.Xna.Framework.FrameworkResources.NegativePlaneDistance, Microsoft.Xna.Framework.FrameworkResources.OppositePlanes, Microsoft.Xna.Framework.FrameworkResources.OutRangeFieldOfView, System.Math.PI, and System.Math.Tan().