Skip to content

Instantly share code, notes, and snippets.

@dpasca
Created February 28, 2020 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpasca/4dddbba4b2e0b7998591f0599b831150 to your computer and use it in GitHub Desktop.
Save dpasca/4dddbba4b2e0b7998591f0599b831150 to your computer and use it in GitHub Desktop.
// RTPS *OK*
void gteRTPS(void) // RTPS (ROT TRANS PERSP SINGLE) 180001
{
long SSX, SSY, SSZ;
long SX, SY;
float xf, yf, zf, P;
float hoz;
long halfH;
GTEPROFILE[34]++;
SYSLOG((13,"GTE: RTPS"));
gteFLAG = 0; // we are resetting FLAG register
halfH = gtesuH >> 1;
//====== CALC VECTOR 0 ========
xf = gtesVX0;
yf = gtesVY0;
zf = gtesVZ0;
SSX = gteTRX + float2int(gtefR11*xf + gtefR12*yf + gtefR13*zf);
SSY = gteTRY + float2int(gtefR21*xf + gtefR22*yf + gtefR23*zf);
SSZ = gteTRZ + float2int(gtefR31*xf + gtefR32*yf + gtefR33*zf);
gteIR1 = limA1S(SSX);
gteIR2 = limA2S(SSY);
gteIR3 = limA3S(SSZ);
gteSZ0 = gteSZ1;
gteSZ1 = gteSZ2;
gteSZ2 = gteSZ3;
gteSZ3 = limC(SSZ);
hoz = (float)gtesuH / limPerspZ( gteSZ3, halfH );
SX = gtesOFX + float2int( SSX*hoz );
SY = gtesOFY + float2int( SSY*hoz );
fifoSX( limD1(SX) );
fifoSY( limD2(SY) );
//P = (gteDQB >> 8) + (float2int( gtesDQA*hoz ) << 8) >> 4;
//gteIR0 = limE(P >> 12);
P = gteDQB + gtesDQA*hoz * (float)65536.;
gteIR0 = limE( float2int(P * (float)(1./4096.)) );
gteMAC0 = float2int( P );
gteMAC1 = SSX;
gteMAC2 = SSY;
gteMAC3 = SSZ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment