void Camera::matrix4_to_float(Matrix4 & m_aos, float * m) { // copy Matrix4 to OpenGL matrix #ifdef USE_SSE2_MATH _mm_storeu_ps( (m+0 ), m_aos.getCol0().get128()); _mm_storeu_ps( (m+4 ), m_aos.getCol1().get128()); _mm_storeu_ps( (m+8 ), m_aos.getCol2().get128()); _mm_storeu_ps( (m+12), m_aos.getCol3().get128()); #else m[0 ] = m_aos.getElem(0,0); m[1 ] = m_aos.getElem(0,1); m[2 ] = m_aos.getElem(0,2); m[3 ] = m_aos.getElem(0,3); m[4 ] = m_aos.getElem(1,0); m[5 ] = m_aos.getElem(1,1); m[6 ] = m_aos.getElem(1,2); m[7 ] = m_aos.getElem(1,3); m[8 ] = m_aos.getElem(2,0); m[9 ] = m_aos.getElem(2,1); m[10] = m_aos.getElem(2,2); m[11] = m_aos.getElem(2,3); m[12] = m_aos.getElem(3,0); m[13] = m_aos.getElem(3,1); m[14] = m_aos.getElem(3,2); m[15] = m_aos.getElem(3,3); #endif }
void cellUtilMatrixToFloatArray(Matrix4 &matrix, float array[]) { for (int j = 0; j < 4; ++j) { for (int i = 0; i < 4; ++i) { array[j*4+i] = matrix.getElem(i, j); } } }