#161392 - DiscoStew - Sat Aug 02, 2008 10:50 pm
Among the many defines in video.h, I noticed some time ago that while there is Position Test and that result address defined, there was nothing pertaining to the Vector Test. I have no idea why it wasn't there in the first place, but I use it in my projects for normals and lights, and had included it in video.h myself. Of course, when the header gets updated (or I reinstall the toolkit), I have to re-add it in.
Basically made the define as such after the Position Test defines...
Code: |
#define GFX_VEC_TEST (*(vuint32*) 0x040005C8)
#define GFX_VEC_RESULT ((vint32*) 0x04000630) |
EDIT:
And with that, I also have some problem that just came up. I believe that I was at release 22 of devkitARM prior to updating to release 23b. The lighting prior to the update was shown exactly how I wanted it to, but after updating, things went screwy. At first, I was thinking that maybe it was something I had changed in my program, but I had gone back to a backup of an old project, made a complete copy of the folder it was in, and took that one and recompiled it. The same screwiness appear in that backup. I'm gonna see if going back to that prior release will change anything.
_________________
DS - It's all about DiscoStew
#161393 - ritz - Sat Aug 02, 2008 11:13 pm
Me too. I manually add it to my own header file. Interestingly we have different types for the result:
Code: |
#define GFX_VEC_TEST (*(vuint32*)(0x040005C8))
#define GFX_VEC_RESULT ( (vuint16*)(0x04000630)) |
Probably makes more sense to use (vint16*) instead of (vuint16*), now that I re-read gbatek.
Last edited by ritz on Sat Aug 02, 2008 11:23 pm; edited 1 time in total
#161396 - DiscoStew - Sat Aug 02, 2008 11:20 pm
/sigh, this is what I get for NOT LOOKING CORRECTLY. I made sure all the other times when I added them into the header, and this one time made me boggle because for the result, it is supposed to be.....
.........vuint16...not vuint32.....
_________________
DS - It's all about DiscoStew
Last edited by DiscoStew on Sat Aug 02, 2008 11:20 pm; edited 1 time in total
#161397 - dovoto - Sat Aug 02, 2008 11:20 pm
Added to cvs and will be in next release.
If you have a function written to take advantage of these definitions you would like to see included let me know. Also a very short test would be appreciated to show usage.
Thanks for pointing this out. If you make any progress in the lighting issue post it and I will take a look.
_________________
www.drunkencoders.com
#161399 - DiscoStew - Sat Aug 02, 2008 11:29 pm
ritz wrote: |
Probably makes more sense to use (vint16*) instead of (vuint16*), now that I re-read gbatek. |
Yeah, in the original video.h, the position test result is defined as signed, so the vector test result should perhaps be the same? I recompiled as both unsigned and signed, as saw no change.
_________________
DS - It's all about DiscoStew
#161404 - ritz - Sat Aug 02, 2008 11:42 pm
Looked back in a revision... I don't use this code anymore, but it worked (if I remember correctly) at the time:
Code: |
...
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
v_gl3angrmat33(rota);
GFX_VEC_TEST = tn[sni[i]]->dp;
while (GFX_TEST_BUSY) ;
for (q = 0; q < 3; q++)
norm[q] = (int32)(((int16)(GFX_VEC_RESULT[q]<<3))>>3);
glMatrixMode(GL_POSITION);
... |
I see my shifting and (int16) cast, most likely not needed. Geez, what was I doing?! Ah, probably grabbing the sign.
#161405 - silent_code - Sat Aug 02, 2008 11:42 pm
@ DiscoStew:
How does the lighting screw up? Can you give us any screens?
There are many reasons why lighting could break. I hope I can help once I get the screens (or video or binary) to see for myself. Just some simple test.
EDIT: Okays, I get it. :^)
Btw: I'm using an extra "definitions" header file for that sort of problems in my programs. :^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.
Last edited by silent_code on Sun Aug 03, 2008 12:28 am; edited 1 time in total
#161408 - DiscoStew - Sun Aug 03, 2008 12:13 am
ritz pretty much had the answer. I was using the wrong variable type.
It only came about because after each update to video.h (or reinstalling the toolkit), I'd have to add the Vector Test define in myself, and this one time, I accidentally defined it as being 32-bit per value instead of 16-bit per value. The input/output were correct, but how I was getting them by indexing via 32-bit instead of 16-bit is what made it screw up.
All in all, it was user error.
_________________
DS - It's all about DiscoStew