From: Jarl Gullberg Date: Tue, 20 Jun 2017 13:22:51 +0000 (+0200) Subject: Removed obsolete Matrix functions. X-Git-Tag: v3.0.0~95^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=289dd1749a68d4d73bb7d5e684555f145e172f59;p=platform%2Fcore%2Fcsapi%2Fopentk.git Removed obsolete Matrix functions. --- diff --git a/src/OpenTK/Math/Matrix4.cs b/src/OpenTK/Math/Matrix4.cs index e0fd23c..e70dc08 100644 --- a/src/OpenTK/Math/Matrix4.cs +++ b/src/OpenTK/Math/Matrix4.cs @@ -56,7 +56,7 @@ namespace OpenTK /// Bottom row of the matrix. /// public Vector4 Row3; - + /// /// The identity matrix. /// @@ -284,7 +284,7 @@ namespace OpenTK /// Gets or sets the value at row 4, column 4 of this instance. /// public float M44 { get { return Row3.W; } set { Row3.W = value; } } - + /// /// Gets or sets the values along the main diagonal of the matrix. /// @@ -525,9 +525,9 @@ namespace OpenTK #endregion #region Static - + #region CreateFromAxisAngle - + /// /// Build a rotation matrix from the specified axis/angle rotation. /// @@ -571,7 +571,7 @@ namespace OpenTK result.Row2.W = 0; result.Row3 = Vector4.UnitW; } - + /// /// Build a rotation matrix from the specified axis/angle rotation. /// @@ -584,7 +584,7 @@ namespace OpenTK CreateFromAxisAngle(axis, angle, out result); return result; } - + #endregion #region CreateFromQuaternion @@ -927,9 +927,9 @@ namespace OpenTK } #endregion - + #region CreatePerspectiveFieldOfView - + /// /// Creates a perspective projection matrix. /// @@ -958,7 +958,7 @@ namespace OpenTK throw new ArgumentOutOfRangeException("zNear"); if (zFar <= 0) throw new ArgumentOutOfRangeException("zFar"); - + float yMax = zNear * (float)System.Math.Tan(0.5f * fovy); float yMin = -yMax; float xMin = yMin * aspect; @@ -966,7 +966,7 @@ namespace OpenTK CreatePerspectiveOffCenter(xMin, xMax, yMin, yMax, zNear, zFar, out result); } - + /// /// Creates a perspective projection matrix. /// @@ -991,11 +991,11 @@ namespace OpenTK CreatePerspectiveFieldOfView(fovy, aspect, zNear, zFar, out result); return result; } - + #endregion - + #region CreatePerspectiveOffCenter - + /// /// Creates an perspective projection matrix. /// @@ -1022,7 +1022,7 @@ namespace OpenTK throw new ArgumentOutOfRangeException("zFar"); if (zNear >= zFar) throw new ArgumentOutOfRangeException("zNear"); - + float x = (2.0f * zNear) / (right - left); float y = (2.0f * zNear) / (top - bottom); float a = (right + left) / (right - left); @@ -1047,7 +1047,7 @@ namespace OpenTK result.Row3.Z = d; result.Row3.W = 0; } - + /// /// Creates an perspective projection matrix. /// @@ -1075,187 +1075,6 @@ namespace OpenTK #endregion - #region Obsolete Functions - - #region Translation Functions - - /// - /// Builds a translation matrix. - /// - /// The translation vector. - /// A new Matrix4 instance. - [Obsolete("Use CreateTranslation instead.")] - public static Matrix4 Translation(Vector3 trans) - { - return CreateTranslation(trans); - } - - /// - /// Build a translation matrix with the given translation - /// - /// X translation - /// Y translation - /// Z translation - /// A Translation matrix - [Obsolete("Use CreateTranslation instead.")] - public static Matrix4 Translation(float x, float y, float z) - { - return CreateTranslation(x, y, z); - } - - #endregion - - #region Rotation Functions - - /// - /// Build a rotation matrix that rotates about the x-axis - /// - /// angle in radians to rotate counter-clockwise around the x-axis - /// A rotation matrix - [Obsolete("Use CreateRotationX instead.")] - public static Matrix4 RotateX(float angle) - { - return CreateRotationX(angle); - } - - /// - /// Build a rotation matrix that rotates about the y-axis - /// - /// angle in radians to rotate counter-clockwise around the y-axis - /// A rotation matrix - [Obsolete("Use CreateRotationY instead.")] - public static Matrix4 RotateY(float angle) - { - return CreateRotationY(angle); - } - - /// - /// Build a rotation matrix that rotates about the z-axis - /// - /// angle in radians to rotate counter-clockwise around the z-axis - /// A rotation matrix - [Obsolete("Use CreateRotationZ instead.")] - public static Matrix4 RotateZ(float angle) - { - return CreateRotationZ(angle); - } - - /// - /// Build a rotation matrix to rotate about the given axis - /// - /// the axis to rotate about - /// angle in radians to rotate counter-clockwise (looking in the direction of the given axis) - /// A rotation matrix - [Obsolete("Use CreateFromAxisAngle instead.")] - public static Matrix4 Rotate(Vector3 axis, float angle) - { - return CreateFromAxisAngle(axis, angle); - } - - /// - /// Build a rotation matrix from a quaternion - /// - /// the quaternion - /// A rotation matrix - [Obsolete("Use CreateFromQuaternion instead.")] - public static Matrix4 Rotate(Quaternion q) - { - return CreateFromQuaternion(q); - } - - #endregion - - #region Scale Functions - - /// - /// Build a scaling matrix - /// - /// Single scale factor for x,y and z axes - /// A scaling matrix - [Obsolete("Use CreateScale instead.")] - public static Matrix4 Scale(float scale) - { - return Scale(scale, scale, scale); - } - - /// - /// Build a scaling matrix - /// - /// Scale factors for x,y and z axes - /// A scaling matrix - [Obsolete("Use CreateScale instead.")] - public static Matrix4 Scale(Vector3 scale) - { - return Scale(scale.X, scale.Y, scale.Z); - } - - /// - /// Build a scaling matrix - /// - /// Scale factor for x-axis - /// Scale factor for y-axis - /// Scale factor for z-axis - /// A scaling matrix - [Obsolete("Use CreateScale instead.")] - public static Matrix4 Scale(float x, float y, float z) - { - Matrix4 result; - result.Row0 = Vector4.UnitX * x; - result.Row1 = Vector4.UnitY * y; - result.Row2 = Vector4.UnitZ * z; - result.Row3 = Vector4.UnitW; - return result; - } - - #endregion - - #region Camera Helper Functions - - /// - /// Build a projection matrix - /// - /// Left edge of the view frustum - /// Right edge of the view frustum - /// Bottom edge of the view frustum - /// Top edge of the view frustum - /// Distance to the near clip plane - /// Distance to the far clip plane - /// A projection matrix that transforms camera space to raster space - [Obsolete("Use CreatePerspectiveOffCenter instead.")] - public static Matrix4 Frustum(float left, float right, float bottom, float top, float near, float far) - { - float invRL = 1.0f / (right - left); - float invTB = 1.0f / (top - bottom); - float invFN = 1.0f / (far - near); - return new Matrix4(new Vector4(2.0f * near * invRL, 0.0f, 0.0f, 0.0f), - new Vector4(0.0f, 2.0f * near * invTB, 0.0f, 0.0f), - new Vector4((right + left) * invRL, (top + bottom) * invTB, -(far + near) * invFN, -1.0f), - new Vector4(0.0f, 0.0f, -2.0f * far * near * invFN, 0.0f)); - } - - /// - /// Build a projection matrix - /// - /// Angle of the field of view in the y direction (in radians) - /// Aspect ratio of the view (width / height) - /// Distance to the near clip plane - /// Distance to the far clip plane - /// A projection matrix that transforms camera space to raster space - [Obsolete("Use CreatePerspectiveFieldOfView instead.")] - public static Matrix4 Perspective(float fovy, float aspect, float near, float far) - { - float yMax = near * (float)System.Math.Tan(0.5f * fovy); - float yMin = -yMax; - float xMin = yMin * aspect; - float xMax = yMax * aspect; - - return Frustum(xMin, xMax, yMin, yMax, near, far); - } - - #endregion - - #endregion - #region Camera Helper Functions /// @@ -1469,9 +1288,9 @@ namespace OpenTK int[] pivotIdx = { -1, -1, -1, -1 }; // convert the matrix to an array for easy looping - float[,] inverse = {{mat.Row0.X, mat.Row0.Y, mat.Row0.Z, mat.Row0.W}, - {mat.Row1.X, mat.Row1.Y, mat.Row1.Z, mat.Row1.W}, - {mat.Row2.X, mat.Row2.Y, mat.Row2.Z, mat.Row2.W}, + float[,] inverse = {{mat.Row0.X, mat.Row0.Y, mat.Row0.Z, mat.Row0.W}, + {mat.Row1.X, mat.Row1.Y, mat.Row1.Z, mat.Row1.W}, + {mat.Row2.X, mat.Row2.Y, mat.Row2.Z, mat.Row2.W}, {mat.Row3.X, mat.Row3.Y, mat.Row3.Z, mat.Row3.W} }; int icol = 0; int irow = 0; diff --git a/src/OpenTK/Math/Matrix4d.cs b/src/OpenTK/Math/Matrix4d.cs index db194b3..6db0328 100644 --- a/src/OpenTK/Math/Matrix4d.cs +++ b/src/OpenTK/Math/Matrix4d.cs @@ -53,7 +53,7 @@ namespace OpenTK /// Bottom row of the matrix /// public Vector4d Row3; - + /// /// The identity matrix /// @@ -958,114 +958,6 @@ namespace OpenTK CreateFromQuaternion(ref q, out result); return result; } - - - /// - /// Build a rotation matrix from the specified quaternion. - /// - /// Quaternion to translate. - /// Matrix result. - [Obsolete("Use double-precision overload instead")] - public static void CreateFromQuaternion(ref Quaternion q,ref Matrix4 m) - { - m = Matrix4.Identity; - - float X = q.X; - float Y = q.Y; - float Z = q.Z; - float W = q.W; - - float xx = X * X; - float xy = X * Y; - float xz = X * Z; - float xw = X * W; - float yy = Y * Y; - float yz = Y * Z; - float yw = Y * W; - float zz = Z * Z; - float zw = Z * W; - - m.M11 = 1 - 2 * (yy + zz); - m.M21 = 2 * (xy - zw); - m.M31 = 2 * (xz + yw); - m.M12 = 2 * (xy + zw); - m.M22 = 1 - 2 * (xx + zz); - m.M32 = 2 * (yz - xw); - m.M13 = 2 * (xz - yw); - m.M23 = 2 * (yz + xw); - m.M33 = 1 - 2 * (xx + yy); - } - - /// - /// Build a rotation matrix from the specified quaternion. - /// - /// Quaternion to translate. - /// A matrix instance. - [Obsolete("Use double-precision overload instead")] - public static Matrix4 CreateFromQuaternion(ref Quaternion q) - { - Matrix4 result = Matrix4.Identity; - - float X = q.X; - float Y = q.Y; - float Z = q.Z; - float W = q.W; - - float xx = X * X; - float xy = X * Y; - float xz = X * Z; - float xw = X * W; - float yy = Y * Y; - float yz = Y * Z; - float yw = Y * W; - float zz = Z * Z; - float zw = Z * W; - - result.M11 = 1 - 2 * (yy + zz); - result.M21 = 2 * (xy - zw); - result.M31 = 2 * (xz + yw); - result.M12 = 2 * (xy + zw); - result.M22 = 1 - 2 * (xx + zz); - result.M32 = 2 * (yz - xw); - result.M13 = 2 * (xz - yw); - result.M23 = 2 * (yz + xw); - result.M33 = 1 - 2 * (xx + yy); - return result; - } - - #endregion - - #region Obsolete Functions - - #region Translation Functions - - /// - /// Build a translation matrix with the given translation - /// - /// The vector to translate along - /// A Translation matrix - [Obsolete("Use CreateTranslation instead.")] - public static Matrix4d Translation(Vector3d trans) - { - return Translation(trans.X, trans.Y, trans.Z); - } - - /// - /// Build a translation matrix with the given translation - /// - /// X translation - /// Y translation - /// Z translation - /// A Translation matrix - [Obsolete("Use CreateTranslation instead.")] - public static Matrix4d Translation(double x, double y, double z) - { - Matrix4d result = Identity; - result.Row3 = new Vector4d(x, y, z, 1.0); - return result; - } - - #endregion #endregion @@ -1443,9 +1335,9 @@ namespace OpenTK int[] pivotIdx = { -1, -1, -1, -1 }; // convert the matrix to an array for easy looping - double[,] inverse = {{mat.Row0.X, mat.Row0.Y, mat.Row0.Z, mat.Row0.W}, - {mat.Row1.X, mat.Row1.Y, mat.Row1.Z, mat.Row1.W}, - {mat.Row2.X, mat.Row2.Y, mat.Row2.Z, mat.Row2.W}, + double[,] inverse = {{mat.Row0.X, mat.Row0.Y, mat.Row0.Z, mat.Row0.W}, + {mat.Row1.X, mat.Row1.Y, mat.Row1.Z, mat.Row1.W}, + {mat.Row2.X, mat.Row2.Y, mat.Row2.Z, mat.Row2.W}, {mat.Row3.X, mat.Row3.Y, mat.Row3.Z, mat.Row3.W} }; int icol = 0; int irow = 0;