diff --git a/ANX.Framework.TestCenter/AssertHelper.cs b/ANX.Framework.TestCenter/AssertHelper.cs index 52c18a1c..b9091778 100644 --- a/ANX.Framework.TestCenter/AssertHelper.cs +++ b/ANX.Framework.TestCenter/AssertHelper.cs @@ -504,12 +504,17 @@ namespace ANX.Framework.TestCenter public static void ConvertEquals(XNAVector2[] xna, ANXVector2[] anx, String test) { bool result = true; + string xnaString = string.Empty; + string anxString = string.Empty; for (int i = 0; i < xna.Length; i++) { result = CompareFloats(xna[i].X, anx[i].X, epsilon) && CompareFloats(xna[i].Y, anx[i].Y, epsilon); + xnaString = xna[i].ToString() + " "; + anxString = anx[i].ToString() + " "; + if (!result) break; } @@ -520,7 +525,7 @@ namespace ANX.Framework.TestCenter } else { - Assert.Fail(string.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString())); + Assert.Fail(string.Format("{0} failed: xna({1}) anx({2})", test, xnaString, anxString)); } } @@ -541,6 +546,8 @@ namespace ANX.Framework.TestCenter public static void ConvertEquals(XNAVector3[] xna, ANXVector3[] anx, String test) { bool result = true; + string xnaString = string.Empty; + string anxString = string.Empty; for (int i = 0; i < xna.Length; i++) { @@ -548,6 +555,9 @@ namespace ANX.Framework.TestCenter CompareFloats(xna[i].Y, anx[i].Y, epsilon) && CompareFloats(xna[i].Z, anx[i].Z, epsilon); + xnaString += xna[i].ToString() + " "; + anxString += anx[i].ToString() + " "; + if (!result) break; } @@ -558,7 +568,7 @@ namespace ANX.Framework.TestCenter } else { - Assert.Fail(string.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString())); + Assert.Fail(string.Format("{0} failed: xna({1}) anx({2})", test, xnaString, anxString)); } } @@ -580,13 +590,18 @@ namespace ANX.Framework.TestCenter public static void ConvertEquals(XNAVector4[] xna, ANXVector4[] anx, String test) { bool result = true; + string xnaString = string.Empty; + string anxString = string.Empty; for (int i = 0; i < xna.Length; i++) { result = CompareFloats(xna[i].X, anx[i].X, epsilon) && CompareFloats(xna[i].Y, anx[i].Y, epsilon) && CompareFloats(xna[i].Z, anx[i].Z, epsilon) && - CompareFloats(xna[i].Z, anx[i].W, epsilon); + CompareFloats(xna[i].W, anx[i].W, epsilon); + + xnaString += xna[i].ToString() + " "; + anxString += anx[i].ToString() + " "; if (!result) break; @@ -598,7 +613,7 @@ namespace ANX.Framework.TestCenter } else { - Assert.Fail(string.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString())); + Assert.Fail(string.Format("{0} failed: xna({1}) anx({2})", test, xnaString, anxString)); } } diff --git a/ANX.Framework.TestCenter/Strukturen/Vector2Test.cs b/ANX.Framework.TestCenter/Strukturen/Vector2Test.cs index af920465..f876e9be 100644 --- a/ANX.Framework.TestCenter/Strukturen/Vector2Test.cs +++ b/ANX.Framework.TestCenter/Strukturen/Vector2Test.cs @@ -873,9 +873,9 @@ namespace ANX.Framework.TestCenter.Strukturen ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); XNAVector2[] xna = new XNAVector2[2]; - XNAVector2.Transform(xnaVector, ref xnaMatrix, xna); + XNAVector2.TransformNormal(xnaVector, ref xnaMatrix, xna); ANXVector2[] anx = new ANXVector2[2]; - ANXVector2.Transform(anxVector, ref anxMatrix, anx); + ANXVector2.TransformNormal(anxVector, ref anxMatrix, anx); AssertHelper.ConvertEquals(xna, anx, "TransformNormalStaticToDestination"); } @@ -893,9 +893,9 @@ namespace ANX.Framework.TestCenter.Strukturen ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); XNAVector2[] xna = new XNAVector2[2]; - XNAVector2.Transform(xnaVector, 1, ref xnaMatrix, xna, 1, 1); + XNAVector2.TransformNormal(xnaVector, 1, ref xnaMatrix, xna, 1, 1); ANXVector2[] anx = new ANXVector2[2]; - ANXVector2.Transform(anxVector, 1, ref anxMatrix, anx, 1, 1); + ANXVector2.TransformNormal(anxVector, 1, ref anxMatrix, anx, 1, 1); AssertHelper.ConvertEquals(xna, anx, "TransformNormalStaticToDestinationWithIndex"); } diff --git a/ANX.Framework.TestCenter/Strukturen/Vector3Test.cs b/ANX.Framework.TestCenter/Strukturen/Vector3Test.cs index 2a7f6118..e45dfa14 100644 --- a/ANX.Framework.TestCenter/Strukturen/Vector3Test.cs +++ b/ANX.Framework.TestCenter/Strukturen/Vector3Test.cs @@ -768,9 +768,9 @@ namespace ANX.Framework.TestCenter.Strukturen ANXVector3[] anxVector = new ANXVector3[] { new ANXVector3(x1, y1, z1), new ANXVector3(x2, y2, z2) }; ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); - XNAVector3[] xna = new XNAVector3[2]; + XNAVector3[] xna = new XNAVector3[2] { XNAVector3.Zero, XNAVector3.Zero }; XNAVector3.Transform(xnaVector, ref xnaMatrix, xna); - ANXVector3[] anx = new ANXVector3[2]; + ANXVector3[] anx = new ANXVector3[2] { ANXVector3.Zero, ANXVector3.Zero }; ANXVector3.Transform(anxVector, ref anxMatrix, anx); AssertHelper.ConvertEquals(xna, anx, "TransformStaticMatrixToDestination"); @@ -789,9 +789,9 @@ namespace ANX.Framework.TestCenter.Strukturen ANXVector3[] anxVector = new ANXVector3[] { new ANXVector3(x1, y1, z1), new ANXVector3(x2, y2, z2) }; ANXQuaternion anxQuaternion = new ANXQuaternion(xQ, yQ, zQ, wQ); - XNAVector3[] xna = new XNAVector3[2]; + XNAVector3[] xna = new XNAVector3[2] { XNAVector3.Zero, XNAVector3.Zero }; XNAVector3.Transform(xnaVector, ref xnaQuaternion, xna); - ANXVector3[] anx = new ANXVector3[2]; + ANXVector3[] anx = new ANXVector3[2] { ANXVector3.Zero, ANXVector3.Zero }; ANXVector3.Transform(anxVector, ref anxQuaternion, anx); AssertHelper.ConvertEquals(xna, anx, "TransformStaticQuaternionToDestination"); @@ -809,9 +809,9 @@ namespace ANX.Framework.TestCenter.Strukturen ANXVector3[] anxVector = new ANXVector3[] { new ANXVector3(x1, y1, z1), new ANXVector3(x2, y2, z2) }; ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); - XNAVector3[] xna = new XNAVector3[2]; + XNAVector3[] xna = new XNAVector3[2] { XNAVector3.Zero, XNAVector3.Zero }; XNAVector3.Transform(xnaVector, 1, ref xnaMatrix, xna, 1, 1); - ANXVector3[] anx = new ANXVector3[2]; + ANXVector3[] anx = new ANXVector3[2] { ANXVector3.Zero, ANXVector3.Zero }; ANXVector3.Transform(anxVector, 1, ref anxMatrix, anx, 1, 1); AssertHelper.ConvertEquals(xna, anx, "TransformStaticMatrixToDestinationWithIndex"); @@ -830,9 +830,9 @@ namespace ANX.Framework.TestCenter.Strukturen ANXVector3[] anxVector = new ANXVector3[] { new ANXVector3(x1, y1, z1), new ANXVector3(x2, y2, z2) }; ANXQuaternion anxQuaternion = new ANXQuaternion(xQ, yQ, zQ, wQ); - XNAVector3[] xna = new XNAVector3[2]; + XNAVector3[] xna = new XNAVector3[2] { XNAVector3.Zero, XNAVector3.Zero }; XNAVector3.Transform(xnaVector, 1, ref xnaQuaternion, xna, 1, 1); - ANXVector3[] anx = new ANXVector3[2]; + ANXVector3[] anx = new ANXVector3[2] { ANXVector3.Zero, ANXVector3.Zero }; ANXVector3.Transform(anxVector, 1, ref anxQuaternion, anx, 1, 1); AssertHelper.ConvertEquals(xna, anx, "TransformStaticQuaternionToDestinationWithIndex"); @@ -868,10 +868,10 @@ namespace ANX.Framework.TestCenter.Strukturen ANXVector3[] anxVector = new ANXVector3[] { new ANXVector3(x1, y1, z1), new ANXVector3(x2, y2, z2) }; ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); - XNAVector3[] xna = new XNAVector3[2]; - XNAVector3.Transform(xnaVector, ref xnaMatrix, xna); - ANXVector3[] anx = new ANXVector3[2]; - ANXVector3.Transform(anxVector, ref anxMatrix, anx); + XNAVector3[] xna = new XNAVector3[2] { XNAVector3.Zero, XNAVector3.Zero }; + XNAVector3.TransformNormal(xnaVector, ref xnaMatrix, xna); + ANXVector3[] anx = new ANXVector3[2] { ANXVector3.Zero, ANXVector3.Zero }; + ANXVector3.TransformNormal(anxVector, ref anxMatrix, anx); AssertHelper.ConvertEquals(xna, anx, "TransformNormalStaticToDestination"); } @@ -888,10 +888,10 @@ namespace ANX.Framework.TestCenter.Strukturen ANXVector3[] anxVector = new ANXVector3[] { new ANXVector3(x1, y1, z1), new ANXVector3(x2, y2, z2) }; ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); - XNAVector3[] xna = new XNAVector3[2]; - XNAVector3.Transform(xnaVector, 1, ref xnaMatrix, xna, 1, 1); - ANXVector3[] anx = new ANXVector3[2]; - ANXVector3.Transform(anxVector, 1, ref anxMatrix, anx, 1, 1); + XNAVector3[] xna = new XNAVector3[2] { XNAVector3.Zero, XNAVector3.Zero }; + XNAVector3.TransformNormal(xnaVector, 1, ref xnaMatrix, xna, 0, 1); + ANXVector3[] anx = new ANXVector3[2] { ANXVector3.Zero, ANXVector3.Zero }; + ANXVector3.TransformNormal(anxVector, 1, ref anxMatrix, anx, 0, 1); AssertHelper.ConvertEquals(xna, anx, "TransformNormalStaticToDestinationWithIndex"); } diff --git a/ANX.Framework.TestCenter/Strukturen/Vector4Test.cs b/ANX.Framework.TestCenter/Strukturen/Vector4Test.cs index a3d2026f..e4faefe5 100644 --- a/ANX.Framework.TestCenter/Strukturen/Vector4Test.cs +++ b/ANX.Framework.TestCenter/Strukturen/Vector4Test.cs @@ -678,7 +678,43 @@ namespace ANX.Framework.TestCenter.Strukturen #region Transformations [Test, TestCaseSource("twentyfourFloats")] - public void TransformStaticMatrix( + public void TransformStaticMatrixVector2( + float x, float y, + float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, + float nop0, float nop1, float nop2, float nop3, float nop4, float nop5) + { + XNAVector2 xnaVector = new XNAVector2(x, y); + XNAMatrix xnaMatrix = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + + ANXVector2 anxVector = new ANXVector2(x, y); + ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + + XNAVector4 xna = XNAVector4.Transform(xnaVector, xnaMatrix); + ANXVector4 anx = ANXVector4.Transform(anxVector, anxMatrix); + + AssertHelper.ConvertEquals(xna, anx, "TransformStaticMatrixVector2"); + } + + [Test, TestCaseSource("twentyfourFloats")] + public void TransformStaticMatrixVector3( + float x, float y, float z, + float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, + float nop0, float nop1, float nop2, float nop3, float nop4) + { + XNAVector3 xnaVector = new XNAVector3(x, y, z); + XNAMatrix xnaMatrix = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + + ANXVector3 anxVector = new ANXVector3(x, y, z); + ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); + + XNAVector4 xna = XNAVector4.Transform(xnaVector, xnaMatrix); + ANXVector4 anx = ANXVector4.Transform(anxVector, anxMatrix); + + AssertHelper.ConvertEquals(xna, anx, "TransformStaticMatrixVector3"); + } + + [Test, TestCaseSource("twentyfourFloats")] + public void TransformStaticMatrixVector4( float x, float y, float z, float w, float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44, float nop0, float nop1, float nop2, float nop3) @@ -692,7 +728,7 @@ namespace ANX.Framework.TestCenter.Strukturen XNAVector4 xna = XNAVector4.Transform(xnaVector, xnaMatrix); ANXVector4 anx = ANXVector4.Transform(anxVector, anxMatrix); - AssertHelper.ConvertEquals(xna, anx, "TransformStaticMatrix"); + AssertHelper.ConvertEquals(xna, anx, "TransformStaticMatrixVector4"); } [Test, TestCaseSource("twentyfourFloats")] diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj index 7631e692..e28b73fa 100644 --- a/ANX.Framework/ANX.Framework.csproj +++ b/ANX.Framework/ANX.Framework.csproj @@ -160,57 +160,57 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ANX.Framework/Vector2.cs b/ANX.Framework/Vector2.cs index 53f0f816..007e355c 100644 --- a/ANX.Framework/Vector2.cs +++ b/ANX.Framework/Vector2.cs @@ -453,32 +453,41 @@ namespace ANX.Framework public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length) { - throw new NotImplementedException(); + length += sourceIndex; + for (int i = sourceIndex; i < length; i++, destinationIndex++) + Transform(ref sourceArray[i], ref matrix, out destinationArray[destinationIndex]); } public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector2[] destinationArray, int destinationIndex, int length) { - throw new NotImplementedException(); + length += sourceIndex; + for (int i = sourceIndex; i < length; i++, destinationIndex++) + Transform(ref sourceArray[i], ref rotation, out destinationArray[destinationIndex]); } public static void Transform(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray) { - throw new NotImplementedException(); + for (int i = 0; i < sourceArray.Length; i++) + Transform(ref sourceArray[i], ref matrix, out destinationArray[i]); } public static void Transform(Vector2[] sourceArray, ref Quaternion rotation, Vector2[] destinationArray) { - throw new NotImplementedException(); + for (int i = 0; i < sourceArray.Length; i++) + Transform(ref sourceArray[i], ref rotation, out destinationArray[i]); } public static Vector2 TransformNormal(Vector2 normal, Matrix matrix) { - throw new NotImplementedException(); + Vector2 result; + TransformNormal(ref normal, ref matrix, out result); + return result; } public static void TransformNormal(ref Vector2 normal, ref Matrix matrix, out Vector2 result) { - throw new NotImplementedException(); + result.X = ((normal.X * matrix.M11) + (normal.Y * matrix.M21)); + result.Y = ((normal.X * matrix.M12) + (normal.Y * matrix.M22)); } public static void TransformNormal( @@ -489,7 +498,9 @@ namespace ANX.Framework int destinationIndex, int length) { - throw new NotImplementedException(); + length += sourceIndex; + for (int i = sourceIndex; i < length; i++, destinationIndex++) + TransformNormal(ref sourceArray[i], ref matrix, out destinationArray[destinationIndex]); } public static void TransformNormal( @@ -497,7 +508,8 @@ namespace ANX.Framework ref Matrix matrix, Vector2[] destinationArray) { - throw new NotImplementedException(); + for (int i = 0; i < sourceArray.Length; i++) + TransformNormal(ref sourceArray[i], ref matrix, out destinationArray[i]); } #endregion diff --git a/ANX.Framework/Vector3.cs b/ANX.Framework/Vector3.cs index fd05c360..36da2672 100644 --- a/ANX.Framework/Vector3.cs +++ b/ANX.Framework/Vector3.cs @@ -509,66 +509,91 @@ namespace ANX.Framework result.Z = MathHelper.SmoothStep(value1.Z, value2.Z, amount); } - #region Transformations public static Vector3 Transform(Vector3 position, Matrix matrix) { - throw new NotImplementedException(); - } - - public static Vector3 Transform(Vector3 value, Quaternion rotation) - { - throw new NotImplementedException(); + Vector3 result; + Transform(ref position, ref matrix, out result); + return result; } + //source: XNI public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector3 result) { - throw new NotImplementedException(); + result.X = (position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41; + result.Y = (position.X * matrix.M12) + (position.Y * matrix.M22) + (position.Z * matrix.M32) + matrix.M42; + result.Z = (position.X * matrix.M13) + (position.Y * matrix.M23) + (position.Z * matrix.M33) + matrix.M43; + } + + public static Vector3 Transform(Vector3 value, Quaternion quaternion) + { + Vector3 result; + Transform(ref value, ref quaternion, out result); + return result; } public static void Transform(ref Vector3 value, ref Quaternion rotation, out Vector3 result) { - throw new NotImplementedException(); + result.X = (rotation.Y * value.Z - rotation.Z * value.Y); + result.Y = (rotation.Z * value.X - rotation.X * value.Z); + result.Z = (rotation.X * value.Y - rotation.Y * value.X); + + result.X = value.X + result.X * rotation.W + (rotation.Y * result.Z - rotation.Z * result.Y); + result.Y = value.Y + result.Y * rotation.W + (rotation.Z * result.X - rotation.X * result.Z); + result.Z = value.Z + result.Z * rotation.W + (rotation.X * result.Y - rotation.Y * result.X); } public static void Transform(Vector3[] sourceArray, ref Matrix matrix, Vector3[] destinationArray) { - throw new NotImplementedException(); + for (int i = 0; i < sourceArray.Length; i++) + Transform(ref sourceArray[i], ref matrix, out destinationArray[i]); } public static void Transform(Vector3[] sourceArray, ref Quaternion rotation, Vector3[] destinationArray) { - throw new NotImplementedException(); + for (int i = 0; i < sourceArray.Length; i++) + Transform(ref sourceArray[i], ref rotation, out destinationArray[i]); } public static void Transform(Vector3[] sourceArray, int sourceIndex, ref Matrix matrix, Vector3[] destinationArray, int destinationIndex, int length) { - throw new NotImplementedException(); + length += sourceIndex; + for (int i = sourceIndex; i < length; i++, destinationIndex++) + Transform(ref sourceArray[i], ref matrix, out destinationArray[destinationIndex]); } public static void Transform(Vector3[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector3[] destinationArray, int destinationIndex, int length) { - throw new NotImplementedException(); + length += sourceIndex; + for (int i = sourceIndex; i < length; i++, destinationIndex++) + Transform(ref sourceArray[i], ref rotation, out destinationArray[destinationIndex]); } public static Vector3 TransformNormal(Vector3 normal, Matrix matrix) { - throw new NotImplementedException(); + Vector3 result; + TransformNormal(ref normal, ref matrix, out result); + return result; } public static void TransformNormal(ref Vector3 normal, ref Matrix matrix, out Vector3 result) { - throw new NotImplementedException(); + result.X = (normal.X * matrix.M11) + (normal.Y * matrix.M21) + (normal.Z * matrix.M31); + result.Y = (normal.X * matrix.M12) + (normal.Y * matrix.M22) + (normal.Z * matrix.M32); + result.Z = (normal.X * matrix.M13) + (normal.Y * matrix.M23) + (normal.Z * matrix.M33); } public static void TransformNormal(Vector3[] sourceArray, ref Matrix matrix, Vector3[] destinationArray) { - throw new NotImplementedException(); + for (int i = 0; i < sourceArray.Length; i++) + TransformNormal(ref sourceArray[i], ref matrix, out destinationArray[i]); } public static void TransformNormal(Vector3[] sourceArray, int sourceIndex, ref Matrix matrix, Vector3[] destinationArray, int destinationIndex, int length) { - throw new NotImplementedException(); + length += sourceIndex; + for (int i = sourceIndex; i < length; i++, destinationIndex++) + TransformNormal(ref sourceArray[i], ref matrix, out destinationArray[destinationIndex]); } #endregion diff --git a/ANX.Framework/Vector4.cs b/ANX.Framework/Vector4.cs index e7a63256..25a40e7d 100644 --- a/ANX.Framework/Vector4.cs +++ b/ANX.Framework/Vector4.cs @@ -453,17 +453,24 @@ namespace ANX.Framework public static Vector4 Transform(Vector2 position, Matrix matrix) { - throw new NotImplementedException(); ; + Vector4 result; + Transform(ref position, ref matrix, out result); + return result; } public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector4 result) { - throw new NotImplementedException(); + result.X = (position.X * matrix.M11) + (position.Y * matrix.M21) + matrix.M41; + result.Y = (position.X * matrix.M12) + (position.Y * matrix.M22) + matrix.M42; + result.Z = (position.X * matrix.M13) + (position.Y * matrix.M23) + matrix.M43; + result.W = (position.X * matrix.M14) + (position.Y * matrix.M24) + matrix.M44; } public static Vector4 Transform(Vector2 value, Quaternion rotation) { - throw new NotImplementedException(); + Vector4 result; + Transform(ref value, ref rotation, out result); + return result; } public static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector4 result) @@ -473,17 +480,24 @@ namespace ANX.Framework public static Vector4 Transform(Vector3 position, Matrix matrix) { - throw new NotImplementedException(); + Vector4 result; + Transform(ref position, ref matrix, out result); + return result; } public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector4 result) { - throw new NotImplementedException(); + result.X = (position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41; + result.Y = (position.X * matrix.M12) + (position.Y * matrix.M22) + (position.Z * matrix.M32) + matrix.M42; + result.Z = (position.X * matrix.M13) + (position.Y * matrix.M23) + (position.Z * matrix.M33) + matrix.M43; + result.W = (position.X * matrix.M14) + (position.Y * matrix.M24) + (position.Z * matrix.M34) + matrix.M44; } public static Vector4 Transform(Vector3 value, Quaternion rotation) { - throw new NotImplementedException(); + Vector4 result; + Transform(ref value, ref rotation, out result); + return result; } public static void Transform(ref Vector3 value, ref Quaternion rotation, out Vector4 result) @@ -493,17 +507,24 @@ namespace ANX.Framework public static Vector4 Transform(Vector4 vector, Matrix matrix) { - throw new NotImplementedException(); + Vector4 result; + Transform(ref vector, ref matrix, out result); + return result; } public static void Transform(ref Vector4 vector, ref Matrix matrix, out Vector4 result) { - throw new NotImplementedException(); + result.X = (vector.X * matrix.M11) + (vector.Y * matrix.M21) + (vector.Z * matrix.M31) + (vector.W * matrix.M41); + result.Y = (vector.X * matrix.M12) + (vector.Y * matrix.M22) + (vector.Z * matrix.M32) + (vector.W * matrix.M42); + result.Z = (vector.X * matrix.M13) + (vector.Y * matrix.M23) + (vector.Z * matrix.M33) + (vector.W * matrix.M43); + result.W = (vector.X * matrix.M14) + (vector.Y * matrix.M24) + (vector.Z * matrix.M34) + (vector.W * matrix.M44); } public static Vector4 Transform(Vector4 value, Quaternion rotation) { - throw new NotImplementedException(); + Vector4 result; + Transform(ref value, ref rotation, out result); + return result; } public static void Transform(ref Vector4 value, ref Quaternion rotation, out Vector4 result) @@ -511,26 +532,31 @@ namespace ANX.Framework throw new NotImplementedException(); } - public static void Transform(Vector4[] sourceArray, int sourceIndex, ref Matrix matrix, Vector4[] destinationArray, int destinationIndex, int length) - { - throw new NotImplementedException(); - } - - public static void Transform(Vector4[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector4[] destinationArray, int destinationIndex, int length) - { - throw new NotImplementedException(); - } - public static void Transform(Vector4[] sourceArray, ref Matrix matrix, Vector4[] destinationArray) { - throw new NotImplementedException(); + for (int i = 0; i < sourceArray.Length; i++) + Transform(ref sourceArray[i], ref matrix, out destinationArray[i]); + } + + public static void Transform(Vector4[] sourceArray, int sourceIndex, ref Matrix matrix, Vector4[] destinationArray, int destinationIndex, int length) + { + length += sourceIndex; + for (int i = sourceIndex; i < length; i++, destinationIndex++) + Transform(ref sourceArray[i], ref matrix, out destinationArray[destinationIndex]); } public static void Transform(Vector4[] sourceArray, ref Quaternion rotation, Vector4[] destinationArray) { - throw new NotImplementedException(); + for (int i = 0; i < sourceArray.Length; i++) + Transform(ref sourceArray[i], ref rotation, out destinationArray[i]); } + public static void Transform(Vector4[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector4[] destinationArray, int destinationIndex, int length) + { + length += sourceIndex; + for (int i = sourceIndex; i < length; i++, destinationIndex++) + Transform(ref sourceArray[i], ref rotation, out destinationArray[destinationIndex]); + } #endregion #region Public Methods diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/ANX.InputSystem.Windows.XInput.csproj b/InputSystems/ANX.InputSystem.Windows.XInput/ANX.InputSystem.Windows.XInput.csproj index e6030fbc..f436fa45 100644 --- a/InputSystems/ANX.InputSystem.Windows.XInput/ANX.InputSystem.Windows.XInput.csproj +++ b/InputSystems/ANX.InputSystem.Windows.XInput/ANX.InputSystem.Windows.XInput.csproj @@ -18,7 +18,7 @@ full false ..\..\bin\Debug\ - DEBUG;TRACE + TRACE;DEBUG;XNAEXT prompt 4 diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs b/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs index 4b4d7646..1703b65e 100644 --- a/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs +++ b/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs @@ -95,6 +95,5 @@ namespace ANX.InputSystem.Windows.XInput get {return null; } } #endif - } } diff --git a/Tools/bin/ANX.Framework.Windows.DX10.dll b/Tools/bin/ANX.Framework.Windows.DX10.dll index 0d7bb54f..dc373b6d 100644 Binary files a/Tools/bin/ANX.Framework.Windows.DX10.dll and b/Tools/bin/ANX.Framework.Windows.DX10.dll differ diff --git a/Tools/bin/ANX.Framework.Windows.GL3.dll b/Tools/bin/ANX.Framework.Windows.GL3.dll index 5095441a..a914c157 100644 Binary files a/Tools/bin/ANX.Framework.Windows.GL3.dll and b/Tools/bin/ANX.Framework.Windows.GL3.dll differ diff --git a/Tools/bin/ANX.Framework.dll b/Tools/bin/ANX.Framework.dll index d8ca3d37..9b7ab610 100644 Binary files a/Tools/bin/ANX.Framework.dll and b/Tools/bin/ANX.Framework.dll differ diff --git a/Tools/bin/asc.exe b/Tools/bin/asc.exe index a5b7510f..ece50a08 100644 Binary files a/Tools/bin/asc.exe and b/Tools/bin/asc.exe differ diff --git a/Tools/bin/sscg.exe b/Tools/bin/sscg.exe index 27a91d4b..6e5fa59d 100644 Binary files a/Tools/bin/sscg.exe and b/Tools/bin/sscg.exe differ