Are you guys sure about the following code?
When multiplying a vector with a matrix using the following function my translation gets lost cause it is stored in 12,13,14
So to get the expected result I first have to take the transpose of my matrix or fix the following implementation as shown further below.
<br />
PVRTVec4& PVRTVec4::operator*=(const PVRTMat4& rhs)<br />
{<br />
VERTTYPE tx = VERTTYPEMUL(x,rhs.f[0])+VERTTYPEMUL(y,rhs.f[1])+VERTTYPEMUL(z,rhs.f[2])+VERTTYPEMUL(w,rhs.f[3]);<br />
VERTTYPE ty = VERTTYPEMUL(x,rhs.f[4])+VERTTYPEMUL(y,rhs.f[5])+VERTTYPEMUL(z,rhs.f[6])+VERTTYPEMUL(w,rhs.f[7]);<br />
VERTTYPE tz = VERTTYPEMUL(x,rhs.f[8])+VERTTYPEMUL(y,rhs.f[9])+VERTTYPEMUL(z,rhs.f[10])+VERTTYPEMUL(w,rhs.f[11]);<br />
w = VERTTYPEMUL(x,rhs.f[12])+VERTTYPEMUL(y,rhs.f[13])+VERTTYPEMUL(z,rhs.f[14])+VERTTYPEMUL(w,rhs.f[15]);<br />
x = tx;<br />
y = ty;<br />
z = tz;<br />
return *this;<br />
}<br />
```<br />
<br />
Possible fix:<br />
<br />
PVRTVec4& PVRTVec4::operator*=(const PVRTMat4& rhs)
{
VERTTYPE tx = VERTTYPEMUL(x,rhs.f[0])+VERTTYPEMUL(y,rhs.f[4])+VERTTYPEMUL(z,rhs.f[8])+VERTTYPEMUL(w,rhs.f[12]);
VERTTYPE ty = VERTTYPEMUL(x,rhs.f[1])+VERTTYPEMUL(y,rhs.f[5])+VERTTYPEMUL(z,rhs.f[9])+VERTTYPEMUL(w,rhs.f[13]);
VERTTYPE tz = VERTTYPEMUL(x,rhs.f[2])+VERTTYPEMUL(y,rhs.f[6])+VERTTYPEMUL(z,rhs.f[10])+VERTTYPEMUL(w,rhs.f[14]);
w = VERTTYPEMUL(x,rhs.f[3])+VERTTYPEMUL(y,rhs.f[7])+VERTTYPEMUL(z,rhs.f[11])+VERTTYPEMUL(w,rhs.f[15]);
x = tx;
y = ty;
z = tz;
return *this;
}
<br />