コード例 #1
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Transforms a given vector by a matrix and put the result in a vector.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="vector">A <see cref="Vector4F"/> instance.</param>
		/// <param name="result">A <see cref="Vector4F"/> instance to hold the result.</param>
		public static void Transform(Matrix4F matrix, Vector4F vector, ref Vector4F result)
		{
			result.X = (matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z) + (matrix.M14 * vector.W);
			result.Y = (matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z) + (matrix.M24 * vector.W);
			result.Z = (matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z) + (matrix.M34 * vector.W);
			result.W = (matrix.M41 * vector.X) + (matrix.M42 * vector.Y) + (matrix.M43 * vector.Z) + (matrix.M44 * vector.W);
		}
コード例 #2
0
ファイル: Matrix4F.cs プロジェクト: stenfalp/Sharp3D.Math
 /// <summary>
 /// Transforms a given vector by a matrix and put the result in a vector.
 /// </summary>
 /// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="vector">A <see cref="Vector3F"/> instance.</param>
 /// <param name="result">A <see cref="Vector3F"/> instance to hold the result.</param>
 public static void Transform(Matrix4F matrix, Vector4F vector, ref Vector3F result)
 {
     result.X = (matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z) + matrix.M14;
     result.Y = (matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z) + matrix.M24;
     result.Z = (matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z) + matrix.M34;
 }
コード例 #3
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Subtracts a scalar from a matrix and put the result in a third matrix.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <param name="result">A <see cref="Matrix4F"/> instance to hold the result.</param>
		public static void Subtract(Matrix4F matrix, float scalar, ref Matrix4F result)
		{
			result.M11 = matrix.M11 - scalar;
			result.M12 = matrix.M12 - scalar;
			result.M13 = matrix.M13 - scalar;
			result.M14 = matrix.M14 - scalar;

			result.M21 = matrix.M21 - scalar;
			result.M22 = matrix.M22 - scalar;
			result.M23 = matrix.M23 - scalar;
			result.M24 = matrix.M24 - scalar;

			result.M31 = matrix.M31 - scalar;
			result.M32 = matrix.M32 - scalar;
			result.M33 = matrix.M33 - scalar;
			result.M34 = matrix.M34 - scalar;

			result.M41 = matrix.M41 - scalar;
			result.M42 = matrix.M42 - scalar;
			result.M43 = matrix.M43 - scalar;
			result.M44 = matrix.M44 - scalar;
		}
コード例 #4
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Multiplies two matrices and put the result in a third matrix.
		/// </summary>
		/// <param name="left">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="right">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="result">A <see cref="Matrix4F"/> instance to hold the result.</param>
		public static void Multiply(Matrix4F left, Matrix4F right, ref Matrix4F result)
		{
			result.M11 = left.M11 * right.M11 + left.M12 * right.M21 + left.M13 * right.M31 + left.M14 * right.M41;
			result.M12 = left.M11 * right.M12 + left.M12 * right.M22 + left.M13 * right.M32 + left.M14 * right.M42;
			result.M13 = left.M11 * right.M13 + left.M12 * right.M23 + left.M13 * right.M33 + left.M14 * right.M43;
			result.M14 = left.M11 * right.M14 + left.M12 * right.M24 + left.M13 * right.M34 + left.M14 * right.M44;

			result.M21 = left.M21 * right.M11 + left.M22 * right.M21 + left.M23 * right.M31 + left.M24 * right.M41;
			result.M22 = left.M21 * right.M12 + left.M22 * right.M22 + left.M23 * right.M32 + left.M24 * right.M42;
			result.M23 = left.M21 * right.M13 + left.M22 * right.M23 + left.M23 * right.M33 + left.M24 * right.M43;
			result.M24 = left.M21 * right.M14 + left.M22 * right.M24 + left.M23 * right.M34 + left.M24 * right.M44;

			result.M31 = left.M31 * right.M11 + left.M32 * right.M21 + left.M33 * right.M31 + left.M34 * right.M41;
			result.M32 = left.M31 * right.M12 + left.M32 * right.M22 + left.M33 * right.M32 + left.M34 * right.M42;
			result.M33 = left.M31 * right.M13 + left.M32 * right.M23 + left.M33 * right.M33 + left.M34 * right.M43;
			result.M34 = left.M31 * right.M14 + left.M32 * right.M24 + left.M33 * right.M34 + left.M34 * right.M44;

			result.M41 = left.M41 * right.M11 + left.M42 * right.M21 + left.M43 * right.M31 + left.M44 * right.M41;
			result.M42 = left.M41 * right.M12 + left.M42 * right.M22 + left.M43 * right.M32 + left.M44 * right.M42;
			result.M43 = left.M41 * right.M13 + left.M42 * right.M23 + left.M43 * right.M33 + left.M44 * right.M43;
			result.M44 = left.M41 * right.M14 + left.M42 * right.M24 + left.M43 * right.M34 + left.M44 * right.M44;
		}
コード例 #5
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Adds a matrix and a scalar and put the result in a third matrix.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <param name="result">A <see cref="Matrix4F"/> instance to hold the result.</param>
		public static void Add(Matrix4F matrix, float scalar, ref Matrix4F result)
		{
			result.M11 = matrix.M11 + scalar;
			result.M12 = matrix.M12 + scalar;
			result.M13 = matrix.M13 + scalar;
			result.M14 = matrix.M14 + scalar;

			result.M21 = matrix.M21 + scalar;
			result.M22 = matrix.M22 + scalar;
			result.M23 = matrix.M23 + scalar;
			result.M24 = matrix.M24 + scalar;

			result.M31 = matrix.M31 + scalar;
			result.M32 = matrix.M32 + scalar;
			result.M33 = matrix.M33 + scalar;
			result.M34 = matrix.M34 + scalar;

			result.M41 = matrix.M41 + scalar;
			result.M42 = matrix.M42 + scalar;
			result.M43 = matrix.M43 + scalar;
			result.M44 = matrix.M44 + scalar;
		}
コード例 #6
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Subtracts a scalar from a matrix.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <returns>A new <see cref="Matrix4F"/> instance containing the difference.</returns>
		public static Matrix4F Subtract(Matrix4F matrix, float scalar)
		{
			return new Matrix4F(
				matrix.M11 - scalar, matrix.M12 - scalar, matrix.M13 - scalar, matrix.M14 - scalar,
				matrix.M21 - scalar, matrix.M22 - scalar, matrix.M23 - scalar, matrix.M24 - scalar,
				matrix.M31 - scalar, matrix.M32 - scalar, matrix.M33 - scalar, matrix.M34 - scalar,
				matrix.M41 - scalar, matrix.M42 - scalar, matrix.M43 - scalar, matrix.M44 - scalar
				);
		}
コード例 #7
0
 /// <summary>
 /// Multiplies two matrices.
 /// </summary>
 /// <param name="left">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="right">A <see cref="Matrix4F"/> instance.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the result.</returns>
 public static Matrix4F operator *(Matrix4F left, Matrix4F right)
 {
     return(Matrix4F.Multiply(left, right));;
 }
コード例 #8
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Adds a matrix and a scalar.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="scalar">A single-precision floating-point number.</param>
		/// <returns>A new <see cref="Matrix4F"/> instance containing the sum.</returns>
		public static Matrix4F Add(Matrix4F matrix, float scalar)
		{
			return new Matrix4F(
				matrix.M11 + scalar, matrix.M12 + scalar, matrix.M13 + scalar, matrix.M14 + scalar,
				matrix.M21 + scalar, matrix.M22 + scalar, matrix.M23 + scalar, matrix.M24 + scalar,
				matrix.M31 + scalar, matrix.M32 + scalar, matrix.M33 + scalar, matrix.M34 + scalar,
				matrix.M41 + scalar, matrix.M42 + scalar, matrix.M43 + scalar, matrix.M44 + scalar
				);
		}
コード例 #9
0
 /// <summary>
 /// Subtracts a matrix from a matrix.
 /// </summary>
 /// <param name="left">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="right">A <see cref="Matrix4F"/> instance.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the difference.</returns>
 public static Matrix4F operator -(Matrix4F left, Matrix4F right)
 {
     return(Matrix4F.Subtract(left, right));;
 }
コード例 #10
0
 /// <summary>
 /// Subtracts a scalar from a matrix.
 /// </summary>
 /// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="scalar">A single-precision floating-point number.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the difference.</returns>
 public static Matrix4F operator -(Matrix4F matrix, float scalar)
 {
     return(Matrix4F.Subtract(matrix, scalar));
 }
コード例 #11
0
 /// <summary>
 /// Adds a matrix and a scalar.
 /// </summary>
 /// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="scalar">A single-precision floating-point number.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the sum.</returns>
 public static Matrix4F operator +(float scalar, Matrix4F matrix)
 {
     return(Matrix4F.Add(matrix, scalar));
 }
コード例 #12
0
 /// <summary>
 /// Adds two matrices.
 /// </summary>
 /// <param name="left">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="right">A <see cref="Matrix4F"/> instance.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the sum.</returns>
 public static Matrix4F operator +(Matrix4F left, Matrix4F right)
 {
     return(Matrix4F.Add(left, right));;
 }
コード例 #13
0
ファイル: Matrix4F.cs プロジェクト: stenfalp/Sharp3D.Math
 /// <summary>
 /// Multiplies two matrices.
 /// </summary>
 /// <param name="a">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="b">A <see cref="Matrix4F"/> instance.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the result.</returns>
 public static Matrix4F operator*(Matrix4F a, Matrix4F b)
 {
     return(Matrix4F.Multiply(a, b));
 }
コード例 #14
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Converts the specified string to its <see cref="Matrix4F"/> equivalent.
		/// A return value indicates whether the conversion succeeded or failed.
		/// </summary>
		/// <param name="value">A string representation of a <see cref="Matrix4F"/>.</param>
		/// <param name="result">
		/// When this method returns, if the conversion succeeded,
		/// contains a <see cref="Matrix4F"/> representing the vector specified by <paramref name="value"/>.
		/// </param>
		/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
		/// <remarks>
		/// The string should be in the following form: "4x4..matrix elements..>".<br/>
		/// Exmaple : "4x4[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]"
		/// </remarks>
		public static bool TryParse(string value, out Matrix4F result)
		{
			Regex r = new Regex(regularExp, RegexOptions.Singleline);
			Match m = r.Match(value);
			if (m.Success)
			{
				result = new Matrix4F(
					float.Parse(m.Result("${m11}")),
					float.Parse(m.Result("${m12}")),
					float.Parse(m.Result("${m13}")),
					float.Parse(m.Result("${m14}")),

					float.Parse(m.Result("${m21}")),
					float.Parse(m.Result("${m22}")),
					float.Parse(m.Result("${m23}")),
					float.Parse(m.Result("${m24}")),

					float.Parse(m.Result("${m31}")),
					float.Parse(m.Result("${m32}")),
					float.Parse(m.Result("${m33}")),
					float.Parse(m.Result("${m34}")),

					float.Parse(m.Result("${m41}")),
					float.Parse(m.Result("${m42}")),
					float.Parse(m.Result("${m43}")),
					float.Parse(m.Result("${m44}"))
					);

				return true;
			}

			result = Matrix4F.Zero;
			return false;
		}
コード例 #15
0
 /// <summary>
 /// Transforms a given vector by a matrix.
 /// </summary>
 /// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="vector">A <see cref="Vector4F"/> instance.</param>
 /// <returns>A new <see cref="Vector4F"/> instance containing the result.</returns>
 public static Vector4F operator *(Matrix4F matrix, Vector4F vector)
 {
     return(Matrix4F.Transform(matrix, vector));
 }
コード例 #16
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Adds two matrices.
		/// </summary>
		/// <param name="left">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="right">A <see cref="Matrix4F"/> instance.</param>
		/// <returns>A new <see cref="Matrix4F"/> instance containing the sum.</returns>
		public static Matrix4F Add(Matrix4F left, Matrix4F right)
		{
			return new Matrix4F(
				left.M11 + right.M11, left.M12 + right.M12, left.M13 + right.M13, left.M14 + right.M14,
				left.M21 + right.M21, left.M22 + right.M22, left.M23 + right.M23, left.M24 + right.M24,
				left.M31 + right.M31, left.M32 + right.M32, left.M33 + right.M33, left.M34 + right.M34,
				left.M41 + right.M41, left.M42 + right.M42, left.M43 + right.M43, left.M44 + right.M44
				);
		}
コード例 #17
0
ファイル: Matrix4F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Adds two matrices.
 /// </summary>
 /// <param name="a">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="b">A <see cref="Matrix4F"/> instance.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the sum.</returns>
 public static Matrix4F operator +(Matrix4F a, Matrix4F b)
 {
     return(Matrix4F.Add(a, b));
 }
コード例 #18
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Adds two matrices and put the result in a third matrix.
		/// </summary>
		/// <param name="left">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="right">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="result">A <see cref="Matrix4F"/> instance to hold the result.</param>
		public static void Add(Matrix4F left, Matrix4F right, ref Matrix4F result)
		{
			result.M11 = left.M11 + right.M11;
			result.M12 = left.M12 + right.M12;
			result.M13 = left.M13 + right.M13;
			result.M14 = left.M14 + right.M14;

			result.M21 = left.M21 + right.M21;
			result.M22 = left.M22 + right.M22;
			result.M23 = left.M23 + right.M23;
			result.M24 = left.M24 + right.M24;

			result.M31 = left.M31 + right.M31;
			result.M32 = left.M32 + right.M32;
			result.M33 = left.M33 + right.M33;
			result.M34 = left.M34 + right.M34;

			result.M41 = left.M41 + right.M41;
			result.M42 = left.M42 + right.M42;
			result.M43 = left.M43 + right.M43;
			result.M44 = left.M44 + right.M44;
		}
コード例 #19
0
ファイル: Matrix4F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Adds a matrix and a scalar.
 /// </summary>
 /// <param name="a">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the sum.</returns>
 public static Matrix4F operator +(float s, Matrix4F a)
 {
     return(Matrix4F.Add(a, s));
 }
コード例 #20
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Subtracts a matrix from a matrix.
		/// </summary>
		/// <param name="left">A <see cref="Matrix4F"/> instance to subtract from.</param>
		/// <param name="right">A <see cref="Matrix4F"/> instance to subtract.</param>
		/// <returns>A new <see cref="Matrix4F"/> instance containing the difference.</returns>
		/// <remarks>result[x][y] = left[x][y] - right[x][y]</remarks>
		public static Matrix4F Subtract(Matrix4F left, Matrix4F right)
		{
			return new Matrix4F(
				left.M11 - right.M11, left.M12 - right.M12, left.M13 - right.M13, left.M14 - right.M14,
				left.M21 - right.M21, left.M22 - right.M22, left.M23 - right.M23, left.M24 - right.M24,
				left.M31 - right.M31, left.M32 - right.M32, left.M33 - right.M33, left.M34 - right.M34,
				left.M41 - right.M41, left.M42 - right.M42, left.M43 - right.M43, left.M44 - right.M44
				);
		}
コード例 #21
0
ファイル: Matrix4F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a matrix from a matrix.
 /// </summary>
 /// <param name="a">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="b">A <see cref="Matrix4F"/> instance.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the difference.</returns>
 public static Matrix4F operator -(Matrix4F a, Matrix4F b)
 {
     return(Matrix4F.Subtract(a, b));
 }
コード例 #22
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Subtracts a matrix from a matrix and put the result in a third matrix.
		/// </summary>
		/// <param name="left">A <see cref="Matrix4F"/> instance to subtract from.</param>
		/// <param name="right">A <see cref="Matrix4F"/> instance to subtract.</param>
		/// <param name="result">A <see cref="Matrix4F"/> instance to hold the result.</param>
		/// <remarks>result[x][y] = left[x][y] - right[x][y]</remarks>
		public static void Subtract(Matrix4F left, Matrix4F right, ref Matrix4F result)
		{
			result.M11 = left.M11 - right.M11;
			result.M12 = left.M12 - right.M12;
			result.M13 = left.M13 - right.M13;
			result.M14 = left.M14 - right.M14;

			result.M21 = left.M21 - right.M21;
			result.M22 = left.M22 - right.M22;
			result.M23 = left.M23 - right.M23;
			result.M24 = left.M24 - right.M24;

			result.M31 = left.M31 - right.M31;
			result.M32 = left.M32 - right.M32;
			result.M33 = left.M33 - right.M33;
			result.M34 = left.M34 - right.M34;

			result.M41 = left.M41 - right.M41;
			result.M42 = left.M42 - right.M42;
			result.M43 = left.M43 - right.M43;
			result.M44 = left.M44 - right.M44;
		}
コード例 #23
0
ファイル: Matrix4F.cs プロジェクト: ekampf/Sharp3D.Math
 /// <summary>
 /// Subtracts a scalar from a matrix.
 /// </summary>
 /// <param name="a">A <see cref="Matrix4F"/> instance.</param>
 /// <param name="s">A <see cref="Matrix4F"/> instance.</param>
 /// <returns>A new <see cref="Matrix4F"/> instance containing the difference.</returns>
 public static Matrix4F operator -(Matrix4F a, float s)
 {
     return(Matrix4F.Subtract(a, s));
 }
コード例 #24
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Multiplies two matrices.
		/// </summary>
		/// <param name="left">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="right">A <see cref="Matrix4F"/> instance.</param>
		/// <returns>A new <see cref="Matrix4F"/> instance containing the result.</returns>
		public static Matrix4F Multiply(Matrix4F left, Matrix4F right)
		{
			return new Matrix4F(
				left.M11 * right.M11 + left.M12 * right.M21 + left.M13 * right.M31 + left.M14 * right.M41,
				left.M11 * right.M12 + left.M12 * right.M22 + left.M13 * right.M32 + left.M14 * right.M42,
				left.M11 * right.M13 + left.M12 * right.M23 + left.M13 * right.M33 + left.M14 * right.M43,
				left.M11 * right.M14 + left.M12 * right.M24 + left.M13 * right.M34 + left.M14 * right.M44,

				left.M21 * right.M11 + left.M22 * right.M21 + left.M23 * right.M31 + left.M24 * right.M41,
				left.M21 * right.M12 + left.M22 * right.M22 + left.M23 * right.M32 + left.M24 * right.M42,
				left.M21 * right.M13 + left.M22 * right.M23 + left.M23 * right.M33 + left.M24 * right.M43,
				left.M21 * right.M14 + left.M22 * right.M24 + left.M23 * right.M34 + left.M24 * right.M44,

				left.M31 * right.M11 + left.M32 * right.M21 + left.M33 * right.M31 + left.M34 * right.M41,
				left.M31 * right.M12 + left.M32 * right.M22 + left.M33 * right.M32 + left.M34 * right.M42,
				left.M31 * right.M13 + left.M32 * right.M23 + left.M33 * right.M33 + left.M34 * right.M43,
				left.M31 * right.M14 + left.M32 * right.M24 + left.M33 * right.M34 + left.M34 * right.M44,

				left.M41 * right.M11 + left.M42 * right.M21 + left.M43 * right.M31 + left.M44 * right.M41,
				left.M41 * right.M12 + left.M42 * right.M22 + left.M43 * right.M32 + left.M44 * right.M42,
				left.M41 * right.M13 + left.M42 * right.M23 + left.M43 * right.M33 + left.M44 * right.M43,
				left.M41 * right.M14 + left.M42 * right.M24 + left.M43 * right.M34 + left.M44 * right.M44
				);
		}
コード例 #25
0
ファイル: EngineWrapper.cs プロジェクト: azykise/olawork
        public Matrix4F getViewMatrix()
        {
            IntPtr f44 = EngineWrapper.RenderCore_MallocFloats(16);
            EngineWrapper.RenderCore_GetViewMatrix(mRenderCore, f44);

            float[] fs = new float[16];
            Marshal.Copy(f44, fs, 0, 16);

            EngineWrapper.RenderCore_FreeFloats(f44);

            Matrix4F m44 = new Matrix4F(fs);
            return m44;
        }
コード例 #26
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Transforms a given vector by a matrix.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4F"/> instance.</param>
		/// <param name="vector">A <see cref="Vector4F"/> instance.</param>
		/// <returns>A new <see cref="Vector4F"/> instance containing the result.</returns>
		public static Vector4F Transform(Matrix4F matrix, Vector4F vector)
		{
			return new Vector4F(
				(matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z) + (matrix.M14 * vector.W),
				(matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z) + (matrix.M24 * vector.W),
				(matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z) + (matrix.M34 * vector.W),
				(matrix.M41 * vector.X) + (matrix.M42 * vector.Y) + (matrix.M43 * vector.Z) + (matrix.M44 * vector.W));
		}
コード例 #27
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Initializes a new instance of the <see cref="Matrix4F"/> class using a given matrix.
		/// </summary>
		public Matrix4F(Matrix4F m)
		{
			_m11 = m.M11; _m12 = m.M12; _m13 = m.M13; _m14 = m.M14;
			_m21 = m.M21; _m22 = m.M22; _m23 = m.M23; _m24 = m.M24;
			_m31 = m.M31; _m32 = m.M32; _m33 = m.M33; _m34 = m.M34;
			_m41 = m.M41; _m42 = m.M42; _m43 = m.M43; _m44 = m.M44;
		}
コード例 #28
0
ファイル: Matrix4F.cs プロジェクト: TimVelo/StackBuilder
		/// <summary>
		/// Transposes a matrix.
		/// </summary>
		/// <param name="m">A <see cref="Matrix4F"/> instance.</param>
		/// <returns>A new <see cref="Matrix4F"/> instance containing the transposed matrix.</returns>
		public static Matrix4F Transpose(Matrix4F m)
		{
			Matrix4F t = new Matrix4F(m);
			t.Transpose();
			return t;
		}
コード例 #29
0
ファイル: Camera.cs プロジェクト: azykise/olawork
 public virtual void doUpdate( RenderSystem rendersys)
 {
     rendersys.setViewParament(m_view_param);
     m_viewmat = (Matrix4F)rendersys.getViewMatrix();
     m_projmat = (Matrix4F)rendersys.getProjMatrix();
 }