C
Chris Forone
hello group,
what do you think/know is faster:
Matrix& Matrix::Translate(GLfloat x, GLfloat y, GLfloat z)
{
const std::array<GLfloat, 16> translate =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
x, y, z, 1.0f
};
return *this *= translate;
}
or to use a second std::array<GLfloat, 16> member, clear it every call
to Matrix::Translate and do the multiply.
in other words: is to clear/set a member faster than to use a local
temporary? the methode(s) is/are called very frequently!
thanks!
cheers, chris
what do you think/know is faster:
Matrix& Matrix::Translate(GLfloat x, GLfloat y, GLfloat z)
{
const std::array<GLfloat, 16> translate =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
x, y, z, 1.0f
};
return *this *= translate;
}
or to use a second std::array<GLfloat, 16> member, clear it every call
to Matrix::Translate and do the multiply.
in other words: is to clear/set a member faster than to use a local
temporary? the methode(s) is/are called very frequently!
thanks!
cheers, chris