public Matrix4x4(Matrix4x4 Other) { M00 = Other.M00; M01 = Other.M01; M02 = Other.M02; M03 = Other.M03; M10 = Other.M10; M11 = Other.M11; M12 = Other.M12; M13 = Other.M13; M20 = Other.M20; M21 = Other.M21; M22 = Other.M22; M23 = Other.M23; M30 = Other.M30; M31 = Other.M31; M32 = Other.M32; M33 = Other.M33; }
public Matrix4x4 Translate(float x, float y, float z) { return (this *= new Matrix4x4(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1)); }
public Matrix4x4 Scale(float x, float y, float z) { return (this *= new Matrix4x4(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1)); }
public Matrix4x4 RotateZ(float angle) { float s = (float)Math.Sin(angle); float c = (float)Math.Cos(angle); return (this *= new Matrix4x4(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)); }
public static Matrix4x4 operator *(Matrix4x4 a, Matrix4x4 b) { Matrix4x4 r = new Matrix4x4(); for (int y = 0; y < 4; y++) for (int x = 0; x < 4; x++) { r[x, y] = (a[x, 0] * b[0, y]) + (a[x, 1] * b[1, y]) + (a[x, 2] * b[2, y]) + (a[x, 3] * b[3, y]); } return r; }
public void SetMatrix(string name, Matrix4x4 m) { handle.SetValue(name, m.AsSharpDX()); }