 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Visigotico
Joined: 23 Apr 2008 Posts: 11
|
Posted: Wed Apr 23, 2008 11:48 am Post subject: libpspgum_vfpu curiosity |
|
|
| libpspgum_vfpu still uses sinf and cosf instead of vfpu_sinf and vfpu_cosf. Why?!? |
|
| Back to top |
|
 |
jsharrad
Joined: 20 Oct 2005 Posts: 102
|
Posted: Wed Apr 23, 2008 2:42 pm Post subject: |
|
|
| Those two functions aren't part of the sdk, they're from an external library written by mrmr[ice] |
|
| Back to top |
|
 |
CarlosEFML
Joined: 14 Apr 2007 Posts: 2
|
Posted: Wed Apr 23, 2008 9:55 pm Post subject: |
|
|
hum.. ok. I'm trying to develop applications without GCC libs. SO, i think:
libpspgum_vfpu = libpspgum, using vfpu.
libpspgum uses libm (sinf, consf...) --> it's ok.
libpspgum_vfpu uses libpspmath(vfpu_sinf, vfpu_cosf...) --> I'm wrong
I'll try to define "float sinf(float v){return vfpu_sinf(v);}" and "float cosf(float v){return vfpu_cosf(v);}" somewhere, and compile without libm... |
|
| Back to top |
|
 |
Visigotico
Joined: 23 Apr 2008 Posts: 11
|
Posted: Wed Apr 23, 2008 10:10 pm Post subject: |
|
|
damn.. damn..
newer libpspgum_vfpu are pure vfpu, my lib is outdated.
--------------------------------------------------------------------------------------
void sceGumPerspective(float fovy, float aspect, float near, float far)
{
pspvfpu_use_matrices(gum_vfpucontext, VMAT3, VMAT0 | VMAT1);
__asm__ volatile (
"vmzero.q M100\n" // set M100 to all zeros
"mtv %0, S000\n" // S000 = fovy
"viim.s S001, 90\n" // S002 = 90.0f
"vrcp.s S001, S001\n" // S002 = 1/90
"vmul.s S000, S000, S000[1/2]\n" // S000 = fovy * 0.5 = fovy/2
"vmul.s S000, S000, S001\n" // S000 = (fovy/2)/90
"vrot.p C002, S000, [c, s]\n" // S002 = cos(angle), S003 = sin(angle)
"vdiv.s S100, S002, S003\n" // S100 = m->x.x = cotangent = cos(angle)/sin(angle)
"mtv %2, S001\n" // S001 = near
"mtv %3, S002\n" // S002 = far
"vsub.s S003, S001, S002\n" // S003 = deltaz = near-far
"vrcp.s S003, S003\n" // S003 = 1/deltaz
"mtv %1, S000\n" // S000 = aspect
"vmov.s S111, S100\n" // S111 = m->y.y = cotangent
"vdiv.s S100, S100, S000\n" // S100 = m->x.x = cotangent / aspect
"vadd.s S122, S001, S002\n" // S122 = m->z.z = far + near
"vmul.s S122, S122, S003\n" // S122 = m->z.z = (far+near)/deltaz
"vmul.s S132, S001, S002\n" // S132 = m->w.z = far * near
"vmul.s S132, S132, S132[2]\n" // S132 = m->w.z = 2 * (far*near)
"vmul.s S132, S132, S003\n" // S132 = m->w.z = 2 * (far*near) / deltaz
"vsub.s S123, S123, S123[1]\n" // S123 = m->z.w = -1.0
"vmmul.q M000, M300, M100\n"
"vmmov.q M300, M000\n"
: : "r"(fovy),"r"(aspect),"r"(near),"r"(far));
gum_current_matrix_update = 1;
}
-------------------------------------------------------------------------------------- |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|