public void Multiply(Matrix34 *m) { Matrix34 m2 = this; float *s1 = (float *)&m2, s2 = (float *)m; fixed(float *p = _data) { int index = 0; float val; for (int b = 0; b < 12; b += 4) { for (int a = 0; a < 4; a++) { val = 0.0f; for (int x = b, y = a; y < 12; y += 4) { val += s1[x++] * s2[y]; } p[index++] = val; } } p[3] += s1[3]; p[7] += s1[7]; p[11] += s1[11]; } }
public void Subtract(Matrix34 *m) { float *s = (float *)m; fixed(float *d = _data) for (int i = 0; i < 12; i++) { d[i] -= s[i]; } }
public void Add(Matrix34 *m) { float *s = (float *)m; fixed(float *d = _data) for (int i = 0; i < 12; i++) { d[i] += s[i]; } }