#12942 - GunterPete - Mon Dec 01, 2003 9:52 pm
Hi there.
I'm trying to implement Mode 7 3D graphics based around DarkFader's tutorial at http://users.raketnet.nl/darkfader/http://darkfader.net/gba/files/Mode%207%20tutorial.txt. I'm using C++, and have implemented Vector and Matrix classes using fixed point maths.
I can determine the map coordinates for any given ray projected through the frustum. The only bit I don't understand is the final part, where this information is loaded into the GBA background registers.
Can anyone help explain this to me? Or are there any other usefull tutorials on Mode 7 graphics for the GBA (I can't seem to find any other than this one).
Thanks in advance (No pun intended).
-Pete Gunter
I'm trying to implement Mode 7 3D graphics based around DarkFader's tutorial at http://users.raketnet.nl/darkfader/http://darkfader.net/gba/files/Mode%207%20tutorial.txt. I'm using C++, and have implemented Vector and Matrix classes using fixed point maths.
I can determine the map coordinates for any given ray projected through the frustum. The only bit I don't understand is the final part, where this information is loaded into the GBA background registers.
Quote: |
Put the left/right results (X/Z) into StartX, StartY, H_DiffX & H_DiffY into a BgAffineDestData array: d->StartX = V2AFF(left3[0]); // simply does a divide by 256 (16:16 -> 24:8 fixed point) d->StartY = V2AFF(left3[2]); // " d->H_DiffX = V2AFF2(right3[0] - left3[0]); // same, but also includes a division by 240 d->H_DiffY = V2AFF2(right3[2] - left3[2]); // " Interrupt & DMA the rotation/scaling values ------------------------------------------- Set up a V-count interrupt at scanline 0 or something... void VCountIntr() { rDMA0CNT_H = 0; // stop DMA rDMA0SAD = bgAffineDestData; rDMA0DAD = (void *)&rBg2Affine; rDMA0CNT = DMA_ENABLE | DMA_TIMMING_H_BLANK | DMA_16BIT_BUS | DMA_CONTINUOUS_ON | DMA_SRC_INC | DMA_DEST_RELOAD | 8; } |
Can anyone help explain this to me? Or are there any other usefull tutorials on Mode 7 graphics for the GBA (I can't seem to find any other than this one).
Thanks in advance (No pun intended).
-Pete Gunter