diff --git a/src/ds/gx.c b/src/ds/gx.c index 24984f69e..4430f1d13 100644 --- a/src/ds/gx.c +++ b/src/ds/gx.c @@ -137,7 +137,7 @@ static void _pullPipe(struct DSGX* gx) { } static void _updateClipMatrix(struct DSGX* gx) { - DSGXMtxMultiply(&gx->clipMatrix, &gx->projMatrix, &gx->posMatrix); + DSGXMtxMultiply(&gx->clipMatrix, &gx->posMatrix, &gx->projMatrix); } static int32_t _dotViewport(struct DSGXVertex* vertex, int32_t* col) { diff --git a/src/ds/matrix.c b/src/ds/matrix.c index 3b4b0de6b..d36b14fb9 100644 --- a/src/ds/matrix.c +++ b/src/ds/matrix.c @@ -35,22 +35,22 @@ void DSGXMtxIdentity(struct DSGXMatrix* mtx) { void DSGXMtxMultiply(struct DSGXMatrix* out, const struct DSGXMatrix* a, const struct DSGXMatrix* b) { struct DSGXMatrix o; // XXX: This is transposed because DS matrices are transposed - o.m[0] = _dot(&a->m[0], &b->m[0]); - o.m[1] = _dot(&a->m[1], &b->m[0]); - o.m[2] = _dot(&a->m[2], &b->m[0]); - o.m[3] = _dot(&a->m[3], &b->m[0]); - o.m[4] = _dot(&a->m[0], &b->m[4]); - o.m[5] = _dot(&a->m[1], &b->m[4]); - o.m[6] = _dot(&a->m[2], &b->m[4]); - o.m[7] = _dot(&a->m[3], &b->m[4]); - o.m[8] = _dot(&a->m[0], &b->m[8]); - o.m[9] = _dot(&a->m[1], &b->m[8]); - o.m[10] = _dot(&a->m[2], &b->m[8]); - o.m[11] = _dot(&a->m[3], &b->m[8]); - o.m[12] = _dot(&a->m[0], &b->m[12]); - o.m[13] = _dot(&a->m[1], &b->m[12]); - o.m[14] = _dot(&a->m[2], &b->m[12]); - o.m[15] = _dot(&a->m[3], &b->m[12]); + o.m[0] = _dot(&b->m[0], &a->m[0]); + o.m[1] = _dot(&b->m[1], &a->m[0]); + o.m[2] = _dot(&b->m[2], &a->m[0]); + o.m[3] = _dot(&b->m[3], &a->m[0]); + o.m[4] = _dot(&b->m[0], &a->m[4]); + o.m[5] = _dot(&b->m[1], &a->m[4]); + o.m[6] = _dot(&b->m[2], &a->m[4]); + o.m[7] = _dot(&b->m[3], &a->m[4]); + o.m[8] = _dot(&b->m[0], &a->m[8]); + o.m[9] = _dot(&b->m[1], &a->m[8]); + o.m[10] = _dot(&b->m[2], &a->m[8]); + o.m[11] = _dot(&b->m[3], &a->m[8]); + o.m[12] = _dot(&b->m[0], &a->m[12]); + o.m[13] = _dot(&b->m[1], &a->m[12]); + o.m[14] = _dot(&b->m[2], &a->m[12]); + o.m[15] = _dot(&b->m[3], &a->m[12]); *out = o; }