Not particularly nice code and not really the way I was wanting to do it but this goes inside the triangle code. Atm it's stuck to 128*128 maps and the values of vx,vy,vz (which is the camera-vertex vector normalised then reflected using the vertex normal in object space) are interpolated with perspective correction using u,v,s. The cubemap's rendered to by doing 6 renders starting with the objects position and orientation and rotating through 90 each time.
zzz=1.0f/zz;
lu=u*zzz;
lv=v*zzz;
ls=s*zzz;
if ((abs(lu)>abs(lv))&&(abs(lu)>abs(ls)))
{
if (lu>0.0f)
{
zzz=1.0f/lu;
ud=ls*zzz;
vd=lv*zzz;
argb=*(cubemap->texture[1]->argb+(int)((1.0f-ud)*63.5f) + ((int)((1.0f-vd)*63.5f)<<7) );
}else{
zzz=-1.0f/lu;
ud=ls*zzz;
vd=lv*zzz;
argb=*(cubemap->texture[3]->argb+(int)((1.0f+ud)*63.5f) + ((int)((1.0f-vd)*63.5f)<<7) );
}
}
if ((abs(lv)>abs(lu))&&(abs(lv)>abs(ls)))
{
if (lv>0.0f)
{
zzz=1.0f/lv;
ud=ls*zzz;
vd=lu*zzz;
argb=*(cubemap->texture[4]->argb+(int)((1.0f+ud)*63.5f) + ((int)((1.0f-vd)*63.5f)<<7) );
}else{
zzz=-1.0f/lv;
ud=-ls*zzz;
vd=lu*zzz;
argb=*(cubemap->texture[5]->argb+(int)((1.0f-ud)*63.5f) + ((int)((1.0f+vd)*63.5f)<<7) );
}
}
if ((abs(ls)>abs(lu))&&(abs(ls)>abs(lv)))
{
if (ls>0.0f)
{
zzz=1.0f/ls;
ud=lu*zzz;
vd=lv*zzz;
argb=*(cubemap->texture[0]->argb+(int)((1.0f+ud)*63.5f) + ((int)((1.0f-vd)*63.5f)<<7) );
}else{
zzz=-1.0f/ls;
ud=lu*zzz;
vd=lv*zzz;
argb=*(cubemap->texture[2]->argb+(int)((1.0f-ud)*63.5f) + ((int)((1.0f-vd)*63.5f)<<7) );
}
}