From dd84fddf1976a3cce1b3dcad228d015c77e61261 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sun, 12 Apr 2009 16:34:35 +0000 Subject: [PATCH] Added new matrix constructors that take 16 distinct matrix elements. --- Source/OpenTK/Math/Matrix4.cs | 41 +++++++++++++++++++++++++++++----- Source/OpenTK/Math/Matrix4d.cs | 37 +++++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 8 deletions(-) diff --git a/Source/OpenTK/Math/Matrix4.cs b/Source/OpenTK/Math/Matrix4.cs index 21321a62..23b066f0 100644 --- a/Source/OpenTK/Math/Matrix4.cs +++ b/Source/OpenTK/Math/Matrix4.cs @@ -63,12 +63,12 @@ namespace OpenTK.Math #region Constructors /// - /// Construct a new matrix from 4 vectors representing each row + /// Constructs a new instance. /// - /// Top row of the matrix - /// 2nd row of the matrix - /// 3rd row of the matrix - /// Bottom row of the matrix + /// Top row of the matrix + /// Second row of the matrix + /// Third row of the matrix + /// Bottom row of the matrix public Matrix4(Vector4 row0, Vector4 row1, Vector4 row2, Vector4 row3) { Row0 = row0; @@ -77,6 +77,37 @@ namespace OpenTK.Math Row3 = row3; } + /// + /// Constructs a new instance. + /// + /// First item of the first row of the matrix. + /// Second item of the first row of the matrix. + /// Third item of the first row of the matrix. + /// Fourth item of the first row of the matrix. + /// First item of the second row of the matrix. + /// Second item of the second row of the matrix. + /// Third item of the second row of the matrix. + /// Fourth item of the second row of the matrix. + /// First item of the third row of the matrix. + /// Second item of the third row of the matrix. + /// Third item of the third row of the matrix. + /// First item of the third row of the matrix. + /// Fourth item of the fourth row of the matrix. + /// Second item of the fourth row of the matrix. + /// Third item of the fourth row of the matrix. + /// Fourth item of the fourth row of the matrix. + public Matrix4( + float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) + { + Row0 = new Vector4(m00, m01, m02, m03); + Row1 = new Vector4(m10, m11, m12, m13); + Row2 = new Vector4(m20, m21, m22, m23); + Row3 = new Vector4(m30, m31, m32, m33); + } + #endregion #region Public Members diff --git a/Source/OpenTK/Math/Matrix4d.cs b/Source/OpenTK/Math/Matrix4d.cs index d650301f..8597425b 100644 --- a/Source/OpenTK/Math/Matrix4d.cs +++ b/Source/OpenTK/Math/Matrix4d.cs @@ -63,11 +63,11 @@ namespace OpenTK.Math #region Constructors /// - /// Construct a new matrix from 4 vectors representing each row. + /// Constructs a new instance. /// /// Top row of the matrix - /// 2nd row of the matrix - /// 3rd row of the matrix + /// Second row of the matrix + /// Third row of the matrix /// Bottom row of the matrix public Matrix4d(Vector4d row0, Vector4d row1, Vector4d row2, Vector4d row3) { @@ -77,6 +77,37 @@ namespace OpenTK.Math Row3 = row3; } + /// + /// Constructs a new instance. + /// + /// First item of the first row. + /// Second item of the first row. + /// Third item of the first row. + /// Fourth item of the first row. + /// First item of the second row. + /// Second item of the second row. + /// Third item of the second row. + /// Fourth item of the second row. + /// First item of the third row. + /// Second item of the third row. + /// Third item of the third row. + /// First item of the third row. + /// Fourth item of the fourth row. + /// Second item of the fourth row. + /// Third item of the fourth row. + /// Fourth item of the fourth row. + public Matrix4d( + float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) + { + Row0 = new Vector4d(m00, m01, m02, m03); + Row1 = new Vector4d(m10, m11, m12, m13); + Row2 = new Vector4d(m20, m21, m22, m23); + Row3 = new Vector4d(m30, m31, m32, m33); + } + #endregion #region Public Members