Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // In-place alternate
- // Efficiently concatenate a translation into the matrix
- static void VecMatrixTranslate_2(float *a, const float *pVec)
- {
- float cTmp[16];
- cTmp[_M44(0,0)] = a[_M44(0,0)];
- cTmp[_M44(0,1)] = a[_M44(0,1)];
- cTmp[_M44(0,2)] = a[_M44(0,2)];
- cTmp[_M44(0,3)] = a[_M44(0,0)] * pVec[0] + a[_M44(0,1)] * pVec[1] + a[_M44(0,2)] * pVec[2] + a[_M44(0,3)];
- cTmp[_M44(1,0)] = a[_M44(1,0)];
- cTmp[_M44(1,1)] = a[_M44(1,1)];
- cTmp[_M44(1,2)] = a[_M44(1,2)];
- cTmp[_M44(1,3)] = a[_M44(1,0)] * pVec[0] + a[_M44(1,1)] * pVec[1] + a[_M44(1,2)] * pVec[2] + a[_M44(1,3)];
- cTmp[_M44(2,0)] = a[_M44(2,0)];
- cTmp[_M44(2,1)] = a[_M44(2,1)];
- cTmp[_M44(2,2)] = a[_M44(2,2)];
- cTmp[_M44(2,3)] = a[_M44(2,0)] * pVec[0] + a[_M44(2,1)] * pVec[1] + a[_M44(2,2)] * pVec[2] + a[_M44(2,3)];
- cTmp[_M44(3,0)] = a[_M44(3,0)];
- cTmp[_M44(3,1)] = + a[_M44(3,1)];
- cTmp[_M44(3,2)] = a[_M44(3,2)];
- cTmp[_M44(3,3)] = a[_M44(3,0)] * pVec[0] + a[_M44(3,1)] * pVec[1] + a[_M44(3,2)] * pVec[2] + a[_M44(3,3)];
- memcpy(a, cTmp, sizeof(cTmp));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement