Exemple #1
0
        internal override void UpdateProjectionMatrix()
        {
            if (useViewOffset)
            {
                var aspect = fullWidth / fullHeight;
                var top    = Mathf.Tan(Mathf.DegreesToRadians(fov * 0.5f)) * near;
                var bottom = -top;
                var left   = aspect * bottom;
                var right  = aspect * top;
                var width  = Mathf.Abs(right - left);
                var height = Mathf.Abs(top - bottom);

                projectionMatrix = Matrix4.MakeFrustum(
                    left + x * width / fullWidth,
                    left + (x + width) * width / fullWidth,
                    top - (y + height) * height / fullHeight,
                    top - y * height / fullHeight,
                    near, far);
            }
            else
            {
                projectionMatrix = Matrix4.MakePerspective(fov, renderer.AspectRatio, near, far);
            }
        }
Exemple #2
0
 /// <summary>
 /// Creates a new instance of the AngularVelocity type from an angle in degrees.
 /// </summary>
 public static AngularVelocity FromDegrees(float degrees) => new AngularVelocity(Mathf.DegreesToRadians(degrees));
Exemple #3
0
 /// <summary>
 /// Initialises an angle from a relative angle value in degrees.
 /// </summary>
 public static Angle FromDegrees(float degrees)
 {
     return(new Angle(Mathf.DegreesToRadians(degrees)));
 }
Exemple #4
0
 /// <summary>
 /// Creates a new instance of the AngularAcceleration type from an angle in degrees.
 /// </summary>
 public static AngularAcceleration FromDegrees(float degrees) => new AngularAcceleration(Mathf.DegreesToRadians(degrees));