all repos — mgba @ 71916913e9fb0fa9f33324e63f662ab25b46b54e

mGBA Game Boy Advance Emulator

DS GX: Fix vertex texture transformation (fixes #702)
Vicki Pfau vi@endrift.com
Wed, 26 Apr 2017 23:57:08 -0700
commit

71916913e9fb0fa9f33324e63f662ab25b46b54e

parent

e211869c921939b9d212bd85c5dad1259d85bbae

2 files changed, 10 insertions(+), 9 deletions(-)

jump to
M CHANGESCHANGES

@@ -1,6 +1,8 @@

medusa alpha 3 (Future) Features: - DS GX: Toon shading +Bugfixes: + - DS GX: Fix vertex texture transformation (fixes mgba.io/i/702) 0.6.0: (Future) Features:
M src/ds/gx.csrc/ds/gx.c

@@ -385,7 +385,7 @@

static int16_t _dotTexture(struct DSGXVertex* vertex, int mode, int32_t* col) { int64_t a; int64_t b; - int64_t sum; + int64_t sum = 0; switch (mode) { case 1: a = col[0];

@@ -400,24 +400,23 @@ sum += a * b;

a = col[12]; b = MTX_ONE >> 4; sum += a * b; - break; - case 2: - return 0; + return sum >> 20; case 3: a = col[0]; - b = vertex->viewCoord[0] << 8; + b = vertex->coord[0]; sum = a * b; a = col[4]; - b = vertex->viewCoord[1] << 8; + b = vertex->coord[1]; sum += a * b; a = col[8]; - b = vertex->viewCoord[2] << 8; + b = vertex->coord[2]; sum += a * b; - a = col[12]; + a = col[12] << 12; b = MTX_ONE; sum += a * b; + return sum >> 24; } - return sum >> 20; + return 0; } static int32_t _dotFrac(int16_t x, int16_t y, int16_t z, int32_t* col) {